PDA

View Full Version : GUI procedure which does not freeze command line. Is this possible?



Harvey West
10th November 2006, 11:07
Hello

How go I create a qt gui for windows which does not freeze up the command promt.

i.e.
from command shell I type c:\MyQTApp.exe

this launches my gui but my command line window is frozen until i close
MyQTApp.exe.

I've tried tweaking prog file with CONFIG =+ console
looked at QProcess but thats refering to how other apps are spawned from within MyQTApp.exe

looked at cmd /c c:\MyQTApp.exe but no luck yet.

Any ideas?

Harvey West | Technical support - BSkyB Creative Services http://www.sky.com

munna
10th November 2006, 11:25
I have a Qt based GUI application. When I launch it from the command prompt, it does not freeze the command prompt

This is what I got

E:\MyApplication>myapp (press enter)

myapp launches

Command Prompt shows

E:\MyApplication>

Probably, I did not understand what you meant

Harvey West
10th November 2006, 11:38
Yep thats what I ment humm...

Are you using qmake to setup the .vcproj file

Here my .prog and main loop does that look similar to your setup?

################################################## ####################
# Automatically generated by qmake (2.00a) Tue 7. Nov 18:06:28 2006
################################################## ####################
TEMPLATE = vcapp
TARGET +=
DEPENDPATH += .
INCLUDEPATH += .
QT += xml
# Input
HEADERS += toolbar.h
SOURCES += main.cpp toolbar.cpp

#include <QApplication>
#include "toolbar.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Toolbar *toolbar = new Toolbar;
toolbar->show();
return app.exec();
}

munna
10th November 2006, 11:48
Are you using qmake to setup the .vcproj file

Yes.

Try this




#include <QApplication>
#include "toolbar.h"

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Toolbar toolbar;
toolbar.show();
return app.exec();
}



Another difference that I noticed was



TEMPLATE = app


But I don't think that should be the problem.

Harvey West
10th November 2006, 12:07
Edited the QTCode, that seems to do the trick. Cheers.

Any ideas why?