Revision as of 04:16, 11 October 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

How to use QApplication in Qt

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Platform(s): Qt
Keywords: QApplication
Created: kamaljaiswal (16 Jan 2008)
Last edited: hamishwillee (11 Oct 2012)


The QApplication class manages the GUI application's control flow and main settings.

For all Qt GUI application, there is one QApplication object, whether the application has one or more windows at any time. For non-GUI Qt applications, QCoreApplication is used instead of QApplication, which doesn't depend on the QtGui library.

It initializes the window system and constructs an application object with argc command line arguments in argv. The global qApp pointer refers to this application object. Only one application object should be created.

This application object must be constructed before any paint devices (including widgets, pixmaps, bitmaps etc.).

Code Snippet

#include <QApplication>
int main(int argc, char *argv[])
QApplication app(argc, argv);
// code
return app.exec();

See also

This page was last modified on 11 October 2012, at 04:16.
44 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.