Inside Qt for Symbian QApplication: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
h2. How is the application started?
h2. How is the application started?


We all know that the application is started after we create a QApplication like the following:<br /><code>QApplication app(argv, args);<code><br />wow, thats really much easier than symbian, you know, you have to know so much about the AVKON application framework when using Symbian C++, and for now, all you have to know is creating a QApplication. But Im the person who always wanna know more, so lets look inside the source code.
We all know that the application is started after we create a QApplication like the following:
<code>QApplication app(argv, args);<code>
wow, thats really much easier than symbian, you know, you have to know so much about the AVKON application framework when using Symbian C++, and for now, all you have to know is creating a QApplication. But Im the person who always wanna know more, so lets look inside the source code.


First, let us take a look at QApplication's ctor:<br /></code>QApplication::QApplication(int &amp;argc, char **argv)<br /> : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient) //create a QApplicationPrivate<br />{<br /> Q_D(QApplication); //just Q_D macro, so we can just the following d<br /> d-&gt;construct(); //call d's construct()<br />}<code>
First, let us take a look at QApplication's ctor:
</code>QApplication::QApplication(int &amp;argc, char **argv)
: QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient) //create a QApplicationPrivate
{
Q_D(QApplication); //just Q_D macro, so we can just the following d
d->construct(); //call d's construct()
}<code>


Line 2 creates a QApplicationPrivate with argc, argv and GuiClient. Here GuiClient is an enum, and we use it to tell QCoreApplication what type of application we wanna create.
Line 2 creates a QApplicationPrivate with argc, argv and GuiClient. Here GuiClient is an enum, and we use it to tell QCoreApplication what type of application we wanna create.

Revision as of 13:15, 25 February 2015

h2. How is the application started?

We all know that the application is started after we create a QApplication like the following:

QApplication app(argv, args);<code>
wow, thats really much easier than symbian, you know, you have to know so much about the AVKON application framework when using Symbian C++, and for now, all you have to know is creating a QApplication. But Im the person who always wanna know more, so lets look inside the source code.

First, let us take a look at QApplication's ctor:

QApplication::QApplication(int &argc, char **argv)

: QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient) //create a QApplicationPrivate

{

Q_D(QApplication); //just Q_D macro, so we can just the following d
d->construct(); //call d's construct()

}

Line 2 creates a QApplicationPrivate with argc, argv and GuiClient. Here GuiClient is an enum, and we use it to tell QCoreApplication what type of application we wanna create.