barnabyr
24th March 2006, 04:20
Hello ..
I have built a few Gui apps with QT and I am familiar with the concept of building
a main window and then building widgets and having them talk to each other ...
... but I am a little confused how I would write a
command line program using QCoreApplication.
If I subclassed QCoreApplication and had a main function like
#include "MyCoreApplication.h"
int main(int argc, char *argv[])
{
MyCoreApplication a(argc, argv);
return a.exec();
}
Then what is the next step ? ... I want to pass my program some arguments
and then have it perform some tasks and then quit i.e. I don't believe I need
an event loop ... However the structure of the code is confusing me.
Would I put most of my core code now in the subclass of QCoreApplication
and then call exit() inside its constructor or one of its methods ?
As you can see I am confused on a very fundamental level so I would appreciate
if someone could post some code of just a simple command line app that
does something simple and then quits.
Thank you very much if you can help.
barnaby.
I have built a few Gui apps with QT and I am familiar with the concept of building
a main window and then building widgets and having them talk to each other ...
... but I am a little confused how I would write a
command line program using QCoreApplication.
If I subclassed QCoreApplication and had a main function like
#include "MyCoreApplication.h"
int main(int argc, char *argv[])
{
MyCoreApplication a(argc, argv);
return a.exec();
}
Then what is the next step ? ... I want to pass my program some arguments
and then have it perform some tasks and then quit i.e. I don't believe I need
an event loop ... However the structure of the code is confusing me.
Would I put most of my core code now in the subclass of QCoreApplication
and then call exit() inside its constructor or one of its methods ?
As you can see I am confused on a very fundamental level so I would appreciate
if someone could post some code of just a simple command line app that
does something simple and then quits.
Thank you very much if you can help.
barnaby.