qt

Proper use of Q_OBJECT?

If I derive my class from QObject (or a subclass), the Qt documentation says that I have to put the Q_OBJECT macro into my class declaration. It also ways I need to "run the meta-object compiler" for my class. I have no idea how to do this. Is this something I need to add to the .pro file? Do I need to edit the makefile? This seems ...

Qt 101: Why can't I use this class?

I have experience with C++ but I've never really used Qt before. I'm trying to connect to a SQLite database, so I found a tutorial here and am going with that. In the QtCreator IDE, I went to Add New --> C++ Class and in the header file pasted in the header the header from that link and in the .cpp file I pasted the source. My main.cpp l...

When should we use * , & , . , -> ?

Why are we using * character when we are creating button but we aren't adding it to app instance? #include <QApplication> #include <QPushButton> int main(int argc,char *argv[]) { QApplication app(argc,argv); QPushButton *button = new QPushButton("Button Text"); QObject::connect(button,SIGNAL(clicked()),&app,SLOT(quit())); ...

How to know if a QLineEdit got focus ?

I want to be able to know if in the QLineEdit it was a click. So I guess I should reimplement the following function(??): void QLineEdit::focusInEvent ( QFocusEvent * e ) [virtual protected] How I should do that? Also, please tell me how to use focusInEvent() function in order to know if QLineEdit myEdit; object got focus. EDIT: H...

Context Menu event with QGraphicsWidget

In my application I subclass QGraphicsWidget In paint I am drawing a line with pen width 4. I reimplemented boundingRect() and shape(). But I can't catch context menu event every time I click right mouse button. What is the problem.(Pen Width ? ) //Sample code for boundingRect() and shape() QRectF boundingRect() const { qreal r...

How to get all attributes for a particular xml node in qt

hello is it possible to get all attributes for a particular node in pyqt ? for example .. consider for following node: < asset Name="3dAsset" ID="5"/> i want to retrieve the ("Name" and "ID") strings is it possible? thanks in advance ...

Is it possible to use QT buttons on existing win32 GUI?

I have an existing GUI for Maya plugin written in VC++ (Win32 API). Now Maya 2011 is using QT and I want to change the Button and menu as per the Maya theme. My question is is it possible to make use QT buttons over Win32 GUI? ...

Embedded QGraphicsView do not hide after Dialog closes

I call a QDialog in to modes, showNormal and showFullscreen. In normal mode all works fine. With a Keyevent the Dialog closes as expected. In Fullscreen, after a keyevent the Dialog closes, but the QGraphicsView will stay on top. All things i've tried (like closing/updating the view) failed. the View sta on top. view = new QGraphicsView...

Qt - A login dialog

I want to create a login dialog by inheriting QDialog. I put in subclass named LoginDialog 2 QLineEdits: for login for password. I want to be able to warn the user with a message if the caps lock is ON while he will start to fill passwordLineEdit. Suppose I have a function that tells the current state of CapsLock button. So I want t...

Any tutorial on Qt SOAP

Hello. Qt library provides a classes to work with SOAP in qt components. Unfortunately, it's not a part of 'core' Qt and is not well documented. Is it any tutorials / guides/ examples awailable i can use as starting point to learn QtSoap? I want to create a very simple SOAP client for JIRA. ...

QT - How to apply a QToolTip on a QLineEdit

On a dialog I have a QLineEdit and a button. I want to enable a tool tip for the QLineEdit(in it or under it) when I press the button. Please give me a code snippet. ...

how-to add "warnings as error" rule to Qt .pro file ?

Hi, When I usually work on a C++ project, one of the first things I do is setting up the "treat warning as errors" on my compiler. When using Qt, qmake generates the Makefile for you and doesn't include this option on the compilation commands. I'm pretty sure there is a way to add such an option (and others) into the generated Makefile...

Qt: Animating the 'roll down' of a QWidget

I have a QWidget that contains various other widgets. I want to animate it appearing on the screen by gradually revealing it from the top down, increasing it's height from 0 to whatever it's natural height would be. The way I have it currently is: mAnimation = new QPropertyAnimation(this, "maximumHeight"); mAnimation->setStartValue(0)...

Qt - How to post a banner on the dialog?

I have a directroy where I have several pictures and gif animations. I want to post that pictures and animations on a QDialog in an infinite loop (by cyclically changing pictures in 2 minutes interval) and on that pictures and animations I want to set a link so that when you click the browser open the set link. How I could do this? Ple...

What does QPainter::save () and QPainter::restore () do?

I am not certain what it is that QPainter does when I invoke save and restore. Is it saving the image it is drawing or is it just saving information like penWidth and color etc... Could I use it to restore the image of a previous paint event? ...

Qt QMainWindow at Close

Hey, this may seem like a very simple question, but I want to dump some data whenever the QMainWindow closes, so I used the following piece of code: QObject::connect(MainWindow.centralwidget, SIGNAL(destroyed()), this, SLOT(close())); but this doesnt seem to make it call close(). Am I doing this wrong? Isnt the centralwidget suppos...

Printing complex widgets in Qt

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"...

how can i use youtube chromeless player in desktop application ?

Hello all i like to use youtube chromeless player in my QT c++ application im using qwebkit , but in the youtube doc's its says: " To test any of these calls, you must have your file running on a webserver...." how can i overcome this restriction and use chromeless player or some alternative? ...

optimizing widget painting.

I am painting a widget and I want to optimize the process. Basically i will be sliding the image in the x direction and I only want to fill the newly exposed area. Is there a way to translate the pixels of a widget without calling update or using paintevent? I know of pixmaps and such but I am wondering If I can for example draw a pix...

how to update newly exposed area of a scrolled widget

I am scrolling a widget but as I am updating the exposed area the widget keeps scrolling so I am left with a 'lag" that I need to compensate for or need to handle. I have setAttribute(Qt::WA_OpaquePaintEvent,true). From a mouseMoveEvent, I widget->scroll(delta,0); the widget. In other words, while the paint event is trying to draw the ...