×
Namespaces

Variants
Actions

How to use QApplication in Qt

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

Introduction

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.
55 page views in the last 30 days.
×