Search Results

Search found 386 results on 16 pages for 'qt4'.

Page 10/16 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Visual C++ doesn't operator<< overload

    - by PierreBdR
    I have a vector class that I want to be able to input/output from a QTextStream object. The forward declaration of my vector class is: namespace util { template <size_t dim, typename T> class Vector; } I define the operator<< as: namespace util { template <size_t dim, typename T> QTextStream& operator<<(QTextStream& out, const util::Vector<dim,T>& vec) { ... } template <size_t dim, typename T> QTextStream& operator>>(QTextStream& in,util::Vector<dim,T>& vec) { .. } } However, if I ty to use these operators, Visual C++ returns this error: error C2678: binary '<<' : no operator found which takes a left-hand operand of type 'QTextStream' (or there is no acceptable conversion) A few things I tried: Originaly, the methods were defined as friends of the template, and it is working fine this way with g++. The methods have been moved outside the namespace util I changed the definition of the templates to fit what I found on various Visual C++ websites. The original friend declaration is: friend QTextStream& operator>>(QTextStream& ss, Vector& in) { ... } The "Visual C++ adapted" version is: friend QTextStream& operator>> <dim,T>(QTextStream& ss, Vector<dim,T>& in); with the function pre-declared before the class and implemented after. I checked the file is correctly included using: #pragma message ("Including vector header") And everything seems fine. Doesn anyone has any idea what might be wrong?

    Read the article

  • Problem with detecting phone orientation change in Symbian/Qt

    - by trex279
    I want to do some custom processing when the orientation of the phone changes. I have re-implemented the resizeEvent(QResizeEvent*) virtual function in my class. The strange thing is, for the first one time when the phone orientation is changed, this function is actually called, and works fine. But all subsequent orientation changes, this function isn't even called? Why does this happen? Are there any other ways to detect phone orientation change? Thanks.

    Read the article

  • How do I controll clipping with non-opaque graphics-item's in Qt?

    - by JJacobsson
    I have a bunch of QGraphicsSvgItem's in a QGraphicsScene that are drawn connected by QGraphicsLineItem's. This show's a graph of a tree-structure. What I want to do is provide a feature where everything but a selected sub-tree becomes transparent. A kind of "highlight this sub-tree" feature. That part was easy, but the results are ugly because now the lines can be seen through the semi-transparent svg's. I am looking for some way to still clip other QGraphicsItem's in the scene to the svg item's, giving the effect that the svg's are semi-transparent windows to the background. I know this code does not use svg's but I figure you can replace that yourself if you are so inclined. int main(int argc, char *argv[]) { QApplication app(argc, argv); QGraphicsScene scene; for( int i = 0; i < 10; ++i ) { QGraphicsLineItem* line = new QGraphicsLineItem; line->setLine( i * 25.0 + 1.0, 0, i * 25.0 + 23.0, 0 ); scene.addItem( line ); } for( int i = 0; i < 11; ++i ) { QGraphicsEllipseItem* ellipse = new QGraphicsEllipseItem; ellipse->setRect( (i * 25.0) - 9.0, -9.0, 18.0, 18.0f ); ellipse->setBrush( QBrush( Qt::green, Qt::SolidPattern ) ); ellipse->setOpacity( 0.5 ); scene.addItem( ellipse ); } QGraphicsView view( &scene ); view.show(); return app.exec(); } I would like the line's to not be seen behind the circle's. I have tried fiddling with the depth-buffer and the stencil buffer using opengl rendering to no avail. How do I get the QGraphicsSvgItem's (or QGraphicsEllipseItem's in the example code) to still clip the lines even though they are semi-transparent?

    Read the article

  • Transparent QGLWidget on top of QGraphicsView

    - by maciej.gryka
    I'm using QGraphicsView to show a 2D image and also have a separate QGLWidget window to display some 3D object. I'm dynamically changing the image displayed in `QGraphicsView' based on the rotation of the 3D object. I would like to render a semi-transparent 3D object on top of the 2D image, something like Maya 2009 used to do (notice the cube in the upper right corner of the viewport): Is it possible to do this with my current widgets? If not, how could it be done? One option I can think of would be to render everything in QGLWidget and display the 2D image as a texture on a background plane, but that seems slightly painful.

    Read the article

  • c++ Design pattern for CoW, inherited classes, and variable shared data?

    - by krunk
    I've designed a copy-on-write base class. The class holds the default set of data needed by all children in a shared data model/CoW model. The derived classes also have data that only pertains to them, but should be CoW between other instances of that derived class. I'm looking for a clean way to implement this. If I had a base class FooInterface with shared data FooDataPrivate and a derived object FooDerived. I could create a FooDerivedDataPrivate. The underlying data structure would not effect the exposed getters/setters API, so it's not about how a user interfaces with the objects. I'm just wondering if this is a typical MO for such cases or if there's a better/cleaner way? What peeks my interest, is I see the potential of inheritance between the the private data classes. E.g. FooDerivedDataPrivate : public FooDataPrivate, but I'm not seeing a way to take advantage of that polymorphism in my derived classes. class FooDataPrivate { public: Ref ref; // atomic reference counting object int a; int b; int c; }; class FooInterface { public: // constructors and such // .... // methods are implemented to be copy on write. void setA(int val); void setB(int val); void setC(int val); // copy constructors, destructors, etc. all CoW friendly private: FooDataPrivate *data; }; class FooDerived : public FooInterface { public: FooDerived() : FooInterface() {} private: // need more shared data for FooDerived // this is the ???, how is this best done cleanly? };

    Read the article

  • How to make the title bold?

    - by Solitaire
    Hi all, In Qmessagebox how can I make the title text bold? Here is the sample code, which I am using to disply a messagebox int ret = QMessageBox::warning(this, tr("My Application"), tr("document has been modified.\n" "Do you want to save your changes?"), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Save); I just want “tr("My Application")” to be bold, and rest to be in normal font. How can I do that? By default I am getting the normal font for both title and descriptive text. Thanks.

    Read the article

  • Which function pair in QString to use for converting to/from std::string?

    - by Noah Roberts
    I'm working on a project that we want to use Unicode and could end up in countries like Japan, etc... We want to use std::string for the underlying type that holds string data in the data layer (see Qt, MSVC, and /Zc:wchar_t- == I want to blow up the world as to why). The problem is that I'm not completely sure which function pair (to/from) to use for this and be sure we're 100% compatible with anything the user might enter in the Qt layer. A look at to/fromStdString indicates that I'd have to use setCodecForCStrings. The documentation for that function though indicates that I wouldn't want to do this for things like Japanese. This is the set that I'd LIKE to use though. Does someone know enough to explain how I'd set this up if it's possible? The other option that looks like I could be pretty sure of it working is the to/fromUTF8 functions. Those would require a two step approach though so I'd prefer the other if possible. Is there anything I've missed?

    Read the article

  • Implementing implicitly shared classes outside of Qt

    - by Timothy Baldridge
    I'm familiar with the way Qt uses D-pointers for managing data. How do I do this in my code? I tried this method: 1) move all data into a struct 2) add a QAtomicInt to the struct 3) implement a = operator and change my constructor/deconstructor to check-up on the reference count. The issue is, when I go to do a shallow copy of the object, I get an error about QObject declaring = as private. How then do I accomplish this? Here's an example of my copy operator: HttpRequest & HttpRequest::operator=(const HttpRequest &other) { other.d->ref.ref(); if (!d->ref.deref()) delete d; d = other.d; return *this; } Am I going about this the wrong way?

    Read the article

  • Distinguish between single and double click events in Qt

    - by Jesse
    I have a QAbstractItemView that needs to react to single and double click events. The actions are different depending on whether it was single clicked or double clicked. The problem that is occurring is that the single click event is received prior to the double click event. Is there a recommended way/best practice for distinguishing between the two? I don't want to perform the single click action when the user has actually double clicked. I am using Qt 4.6

    Read the article

  • Speed of QHash lookups using QStrings as keys.

    - by Ryan R.
    I need to draw a dynamic overlay on a QImage. The component parts of the overlay are defined in XML and parsed out to a QHash<QString, QPicture> where the QString is the name (such as "crosshairs") and the QPicture is the resolution independent drawing. I then draw components of the overlay as they are needed at a position determined during runtime. Example: I have 10 pictures in my QHash composing every possible element in a HUD. During a particular frame of video I need to draw 6 of them at different positions on the image. During the next frame something has changed and now I only need to draw 4 of them but 2 of those positions have changed. Now to my question: If I am trying to do this quickly, should I redefine my QHash as QHash<int, QPicture> and enumerate the keys to counteract the overhead caused by string comparisons; or are the comparisons not going to make a very big impact on performance? I can easily make the conversion to integer keys as the XML parser and overlay composer are completely separate classes; but I would like to use a consistent data structure across the application. Should I overcome my desire for consistency and re-usability in order to increase performance? Will it even matter very much if I do?

    Read the article

  • exposing subcontrols from the custom widget plugin in QT

    - by Santosh
    I am using QT 4.3. I have created one custom widget plugin. I could be able to show it in the desiner tool box as well as use it on the form with no problem. This custom widget internally holds QGroupBox, QLabel, QTextEdit. Now I want to apply the styles to individual componets of this custom widget. I want to expose these internal conrols as sub-control and style them. This would be similar to tear subcontrol of QTabWidget. In style sheet we can refer it as QTabWidget::tear... Is there any way by which I can do similar thing with my custom widget?

    Read the article

  • how to create a theme with QT

    - by Moayyad Yaghi
    hello im looking for a way to make my pyqt interface look nicer by adding a theme to it. im new to Qt and i still have no idea how to add a custom theme for widgets.. so how is that possible ? and is it possible through qt designer ? sorry for my bad english , its my third language. i hope the idea is clear enough . please let me know if something was unclear .. thanks in advace

    Read the article

  • QT NOOB: Add action handler for multiple objects of same type.

    - by what
    I have a simple QT application with 10 radio buttons with names radio_1 through radio_10. It is a ui called Selector, and is part of a class called TimeSelector In my header file for this design, i have this: //! [1] class TimeSelector : public QWidget { Q_OBJECT public: TimeSelector(QWidget *parent = 0); private slots: //void on_inputSpinBox1_valueChanged(int value); //void on_inputSpinBox2_valueChanged(int value); private: Ui::Selector ui; }; //! [1] the commented out void_on_inputSpinBox1_valueChanged(int value) is from the tutorial for the simple calculator. I know i can do: void on_radio_1_valueChanged(int value); but I would need 10 functions. I want to be able to make one function that works for everything, and lets me pass in maybe a name of the radio button that called it, or a reference to the radio button so i can work with it and determine who it was. I am very new to QT but this seems like it should be very basic and doable, thanks.

    Read the article

  • Printing complex widgets in Qt

    - by Jens
    I have a complex widget with tons of different subwidgets, e.g. subclasses of QLabel. I want to print this widget, but obviously I do not want to print the background, I want to print with differing text colors or have the style of frames slightly modified. As I do not really want to iterate through all subwidgets with a special "print" function, which I would need to attach to all widgets (how to add "print" to a QLabel?), I would like to use paintEvent. If I have a hierarchy MyWidget - derived from - some QWidget, I would like to insert a sublayer MyWidget - MyPrintWidget - some QWidget, where myPrintWidget::paintEvent would check, if the current print is going to the screen (thus call QWidget::paintEvent), else if we are printing to the printer, call some function MyPrintWidget::drawWidget instead. Is this the right way to print-enable a widget? How can I figure out in paintEvent, that I'm printing to a printer instead of the screen? Is there a good example of printing complex widgets?

    Read the article

  • QWinWidget's position is always 0 (zero)

    - by Kevin
    I hosted a QWinWidget in a CView and want it to stay at a designated position when resizing. But QWinWidget always moves to (0, 0), i.e. left-top corner of the CView. I tried to debug in this way: QWinWidget* pWidget = new QWinWidget(pCView); pWidget->move(50, 50); QPoint pos = pWidget->pos(); Note that: the pos is always (0, 0). Why is that?

    Read the article

  • Qt: force resource reloading on every compilation.

    - by greg
    Is there a way to force QtCreator to recompile all the resources (images / qss files) i have specified in my qrc file every time i build the project? Currently if i change some styles in my qss file but dont remove the file and re-add it to the qrc file the old version of my qss file is used. Thanks.

    Read the article

  • Qt Direct Connection

    - by user152508
    Hello I have created Qt tree control( and its nodes ) in different thread than the main thread. In the main thread I want to show context menu for the clicked node, so I am connectiong the actions in the menu with appropriate slots in the main thread. The connect function returns true , but slot is never executed. If I explicitly say in connect function that this is Qt :: DirectConnection then everything works fine. Why is this ? I I create my tree in main thread, everything also works fine , without having to say that this is Qt::DirectConnection .

    Read the article

  • what's the best way to learn C++ and Qt at the same time?

    - by Daniel Hill
    Hi I did A Google search and couldn't find anything, so I wanna learn Qt/C++ my University (I'm a first year CompSci Student) won't be teaching C++ next year which is a big disappointment I already know Python and dabbled in LaTeX, Javascript, C++ I'm currently helping out a free software project Clementine but it's programmed in Qt/C++ and I don't know enough of both to help out enough. Is there any tips, Tutorial, howtos out there?

    Read the article

  • QGraphicsView ensureVisible() and centerOn()

    - by onurozcelik
    Hi, I am going to do pan/scale stuff on QGraphicsView. So I read the documentation of QGraphicsView and see some utility functions like ensureVisible() and centerOn(). I think I understand what the documentation says but I can' t manage to write a working example. Could you please write/suggest me an example code to understand the issue.

    Read the article

  • Which compiler option I should choose?

    - by Surjya Narayana Padhi
    Hi Geeks, I have to use the third party static library for my qt application to run on windows. The third party provides me a .lib and .h file for use. These libraries are compiled with MSVC compiler. My qt Creator is using MinGW compiler to compile my application. I copied the .h and .lib file to my qt project directory and then added those in .pro file as follows QT += core gui TARGET = MyTest TEMPLATE = app LIBS += C:\Qt\2010.05\qt\MyTest\newApi.lib SOURCES += main.cpp\ mainwindow.cpp HEADERS += mainwindow.h \ newApi.h FORMS += mainwindow.ui Now I am getting some runtime error like this - Starting C:\Qt\2010.05\qt\MyTest-build-desktop\debug\MyTest.exe... C:\Qt\2010.05\qt\MyTest-build-desktop\debug\MyTest.exe exited with code -1073741515 Can any body suggest is this runtime error is due to mismatch of compiler? (because of my .lib file I added is comipled in MSVC compiler and my qt app is compiled using MinGW compiler) If not what may be the reason? Am I missing anything in adding the .h and .lib file to my qt project? If my MinGW compiler will not support the .lib file generated in MSVC compiler what may be the work-arround? Can I create the .lib files in MinGW compiler? or this format is supported only by MSVC compiler only? Please suggest...

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16  | Next Page >