PDA

View Full Version : what is the difference among three ways of constructing a Qtopia application?



honest581
27th September 2007, 13:27
method 1:int main( int argc, char ** argv )
{
QPEApplication a( argc, argv );
skizzy mw;
a.showMainWidget( &mw );
return a.exec();
}
mothed 2:

QTOPIA_ADD_APPLICATION("skizzy",skizzy);
QTOPIA_MAIN

method 3:
static Main *m = 0;

void qtopiaInit( int argc, char *argv[] )
{
m = new Main();
qApp->showMainWidget(m);
}

void qtopiaDestroy()
{
delete m;
}

QTOPIA_MAIN

and the QTOPIA_MAIN macro is implemented as:


int main( int argc, char **argv )
{
QPEApplication a( argc, argv );
qtopiaInit( argc, argv );
int rv = a.exec();
qtopiaDestroy();
return rv;
}
all the examples comes from the offical documents (http//doc.trolltech.com)?who can tell me the difference ?

wysota
27th September 2007, 13:38
All these basically do the same. The difference is that you might want to do some additional things here and there thus you can either go for a minimal and standard application startup (method 2), semi automatic method3 or method1 that gives you full control over everything (allowing for instance to use a subclass of QPEApplication).

honest581
16th July 2010, 16:03
thanks ,years gone ,here is my topic still