PDA

View Full Version : qmake not invoking uic?



Regenlied
22nd November 2010, 10:54
Hello.

I have made an ui stub by using QT Designer following an example from the book C++ Gui Programming for QT. I saved the ui file (gotocelldialog.ui) in folder togehter with this main.cpp:

#include <QApplication>
#include <QDialog>

#include "ui_gotocelldialog.h"

int main(int argc, char *argv[])
{
QApplication app(argc, argv);

Ui::GoToCellDialog ui;
QDialog *dialog = new QDialog;
ui.setupUi(dialog);
dialog->show();

return app.exec();
}


And then I run "qmake -project" which creates this gotocell.pro:

TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .

# Input
FORMS += gotocelldialog.ui
SOURCES += main.cpp

After that i run "qmake gotocell.pro". This creates a makefile. Regarding the description in the book executing qmake should create a ui_gotocelldialog.h by invoking the uic but his is not happening. Thus, i cant compile it since the header which is inculded int he main.cpp is missing.
I would be really happy if you could help me! For compilation i am using Visual Studio 10 with the QT plugin which has been working fine on the previous qt examples so far.

Best Regards,
Regenlied

Zlatomir
22nd November 2010, 11:06
Aren't you forgetting a step?
I didn't use Qt from the cmd in a while, but the commands should be:


1) qmake -project
2) qmake NAME_OF_PRO.pro
3) make or nmake or mingw32-make

high_flyer
22nd November 2010, 11:09
This creates a makefile.
Does the make file contain an uic rule in it?
(Please post it).
Did you run nmake on it?


For compilation i am using Visual Studio 10 with the QT plugin...
But the way you describe here is the console way, not VS + plugin way...

So, either really use VS and the plugin, then you only need to include the ui in to the project.
Or, post the make file.

As last resort on the console you can call uic explicitly on the your ui.
But that usually should not come to that.

franz
22nd November 2010, 11:22
Regarding the description in the book executing qmake should create a ui_gotocelldialog.h by invoking the uic but his is not happening.
This is wrong. It is running qmake that gives you the makefile as you state. It is calling make (or nmake, jom, whatever) that will produce the ui_gotocelldialog.h before your source files are being compiled.

Zlatomir
22nd November 2010, 11:31
This is wrong. It is running qmake that gives you the makefile as you state. It is calling make (or nmake, jom, whatever) that will produce the ui_gotocelldialog.h before your source files are being compiled.
Those files (ui_name_bla.h and makefiles) are generated by qmake projectName.pro second step from my previous post, those are generated before running make (any of them)

LE: i just tested, i'm wrong about ui_file.h :o
Is as Franz said those are generated by running nmake
my bad, sorry

Regenlied
22nd November 2010, 11:58
Thanks alot for the fast help. As you stated, I confused the steps which had to be done in the console/Visual Studio.

buddyzyw
4th August 2011, 12:25
Thanks alot for the fast help. As you stated, I confused the steps which had to be done in the console/Visual Studio.

I have met the same problem as yours and I still don't get it.
Would you explain the way you create the "ui_gotocelldialog.h" file to me in more detail? What's the reason why qmake cannot create this header file automatically?

Mnay thanks!

high_flyer
9th August 2011, 16:07
and I still don't get it.
You don't get what? what is 'it'?
What did you try?
Show code.


What's the reason why qmake cannot create this header file automatically?
The reason is that its not qmakes job, as simple as that.
qmake creates a make file.
The make file will call uic which will create ui_xxxxx.h out of an xxxxxxx.ui file - as stated in post #4.