Solved Newb issues
-
Hi,
I'm using Qt Creator 4.0.2 (based on Qt 5.7.0) on Ubuntu 16.04.
I'm trying to work through "C++ GUI Programming with Qt 4, Second Edition" by Blanchette & Summerfield.I've been told that Qt version 4 is close enough to Qt version 5 so as to make this text usable.
However, there are a number of differences and, seeing as I'm starting out, I don't know what I don't know.
It talks of Qt Designer.
I am using Qt Creator which contains the GUI designer.I am trying to follow the text, however it directs you to run qmake. This appears to exist as a tool within Creator but is not installed alongside the IDE as a command-line option (as directed by the book.)
I have created a form in the GUI Designer withing Qt Creator, but at a certain point, it says that running qmake will take the myform.ui file and generate ui_myform.h
I can't seem to make this happen.What has changed between the two version that I must do to continue?
Thanks.
Uberlinc.
-
Hi
There also exists a standalone Designer but the
one inside Creator should be just as fine.qmake is normally always installed. it lives under the compiler
"C:\Qt\5.10.1\mingw53_32\bin\qmake.exe"
or
"C:\Qt\5.10.1\msvc2015_64\bin\qmake.exe"
(path is ofc different for say 5.7 but nearly the same)Regarding the ui files, qmake normally calls a tool to create those and unclear why its not happening. Normally its automatically. the files are included in the .pro file?
Maybe its a path thing.
Try to find
"C:\Qt\5.10.1\mingw53_32\bin\qtenv2.bat"
(again, folders are name little different but same)and open a cmd prompt and run it. and then try qmake it that cmd.
that files sets up paths etc.You can also generate a default gui project, File -> New project
and see if that just works. then we know if installation is ok. -
Many thanks for your reply.
I am running Ubuntu 16.04, so references to C:\ drive are not applicable, I'm afraid.
I have, however, noticed that there is indeed a "qmake" option in the Build Menu, which I ran but appeared to run instantly and silently (i.e. nothing appeared on the screen to indicate it's functionality)
Indeed, it did create a "make" file in a directory separate to my actual project.
It did not, however, as the book suggests, create a file ui_myform.h (that I could physically see.)Is this file supposed to actually be physically created or is something that only the compiler can see?
Is it necessary to use qmake in the version of Qt via the command line or is the GUI menu option okay to use just the same?
I am no expert (obviously) but I have reason to believe that my installation is sound as all basic template options are available when creating a new project.
This project that I am doing is actually done by Selecting Projects->Applications->Qt Widgets Application (I simply made an educated guess as to how I might proceed using Qt Creator, in the absence of Qt Designer.)
It would be infinitely better if there was indeed a published, teach-yourself book for Qt Creator!
Trying to work it out by myself has been most trying and confusing!Regards,
Uberlinc.
-
Edit: I found the ui_myform.h file (that presumably was created by the qmake menu option) in an adjacent folder.)
Funny.... I hit the qmake menu option a few times, but this file had not appeared before.
Can anyone explain?
-
@Uberlinc
Hi
the ui_ are actually made by
http://doc.qt.io/qt-5/uic.html
which qmake calls. ( its generated files, lives in build folder)But normally you use use run/debug in creator and it calls qmake and all other needed tools. Nothing wrong learning doing it manually in shell but
Creator makes this much easier.
Also, the whole truth is the pro file and you can always make default gui project and simply replace the files with what ever book uses.did you browse
http://doc.qt.io/qtcreator/ -
Okay, I think I've sort of worked out how to play it for the time being.
I had a breakthrough last night and was able to make the code from the book work perfectly.
Instead of selecting a Widgets GUI application from the New->Project menu, I simply select an empty qmake project, then add the required files manually (including the ui form) one-by-one.
Hopefully this will work for the time being until I get a little more experienced.
Thank you for your help.