Application instructions
-
Hi there,
I am following this book C++ GUI Programming with Qt 4, Second Edition and I am stuck somewhere. Would appreciate it if you could have a look here and let me know.
It says,
Save the dialog as gotocelldialog.ui in a directory called gotocell (is that a new Qt project name or just a normal folder), and create a main.cpp file in the same directory using a plain text editor:
@
#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();
}
@
This part is the most hard,Now run qmake to create a .pro file and a makefile (qmake -project; qmake gotocell.pro). The qmake tool is smart enough to detect the user interface file gotocelldialog.ui and to generate the appropriate makefile rules to invoke uic, Qt's user interface compiler. The uic tool converts gotocelldialog.ui into C++ and puts the result in ui_gotocelldialog.h.
Where do I need to run qmake? In command prompt? If so what should be the filename? qmake <filename>
In the folder I have only,
gotocelldialog.ui and main.cpp
Thank you in advance.
-
Yes in a cmd/console. You can specify with "-o filename" a filename. Otherwise qmake creates one.
-
qmake gotocelldialog.ui
qmake main.cpp
or
qmake <folder name>
-
qmake -project -o filename
-
just as written in the book:
@
qmake -project
@it will create a project file with the name of the folder. Thats why the folder name was given in the book.
If you follow the instructions, it works. The only thing that is missing is:
Open a conmmand shell and navigate to the created directory. There call.... -
Works perfectly indeed. I noticed also I was using wrong command prompt.
Thanks a lot guys.
But in truth, what's the point of this? I mean, you can always use the Qt Creator and Add New Project right?
-
You can, indeed. Remember, though, that Qt Creator is a relatively new asset in the Qt toolbox. Before we had the luxury of Creator's integrated project management features, qmake -project was pretty much the de facto standard for getting a project started.
-
Right, well this sounds reasonable.
Thanks everyone for your replies. Problem solved now and I can continue with the book.
-
Qt creator came with Wt 4.6 I think. Afaik, the book is assigned to Qt 4.3. But everything he describes should also work with 4.7. There are only more features there.