Integrating Qt5 in Creator? Multiple <Qt...> headers not found!
-
Ok, after a series of epic failures I seem to have succeeded in building Qt5.
I added Qt5 manually in Creator by pointing to the qmake file.
The problem is the new project templates Creator generates don't seem to find the right include directories and plenty the headers are simply not found. I notice in Qt5 there is no longer one bunch of headers in a single include directory, but different for qtbase, qtdeclarative and so on.
Is the structure of Qt5 incompatible with the project presets of creator or do I have some other issue?
For example, a new QML application in 4.8:@#include <QtGui/QApplication>@
is found. However when I switch the same project to Qt5 I get the "there is no such file or directory"
Naturally, I can fix that by including the entire QtGui module, but then another deeper include fails, and some I found not really fixable, since I reach non project, Qt stock headers which also can't find their own includes.
In fact even including <QApplication> itself fails, even thou QApplication IS in qtbase/include...
-
QApplication is for use with widget based applications in Qt5 and is found in QtWidgets/QApplication.
For non-widget but still gui applications i.e. QML applications you need to use QtGui/QGuiApplication.
Non-gui applications can still use QtCore/QCoreApplication as in Qt 4.x.
This is the result of the refactoring happening for Qt5 to provide a distinction between the older widget-based approach and the newer QML-based approach without having to encumber QML applications with all the widget "baggage" when it is not needed.
Hope this helps.
-
Well, it pretty much clears out that the project templates currently shipping with Creator will not work for Qt5. Logically, this applies to Qt 4.x.x projects as well.
What I find more disturbing is even the majority of examples that came with Qt5 either fail to build, crash, don't show anything or in the case of the few that actually ran, in the case of QGraphicsScene examples were very sluggish which made me wonder if this is due to the immaturity of Qt5 or due to the changes it introduced to the old graphics stack. Still it is not like QGraphicsScene is immature or something...
I kind of expected more, seeing all those cool Qt5 demos around the web, and just about when I started to get proficient with Qt4 it is like going back to square one, with the exception of the lack of learning resources...
I guess for the time being it is best to reconcile with the time wasted on Qt5 so far and be smart to not waste any more and stick to what I know. I was hoping to save myself the effort of extending my Qt4 just to be rendered obsolete when Qt5 arrives, and jump on the Qt5 bandwagon instead but it appears Qt5 is far too immature for noobs like me.
-
The main thrust of the work on Qt5 so far has been to clean up broken API and refactoring to split it into smaller repositories.
Performance improvements and making all of the examples work will be done from now until release.
There will only be minor differences in the API between Qt4 and Qt5 so I would recommend learning Qt using Qt4 for the time being and switch to Qt5 once it reaches beta or a final release.
-
Yes the API doesn't seem to change all that much, the issues I faced come mostly from the changes to its structure.
By the way, is there some estimate how long before Qt5 hits a beta stage?
-
Released versions of Qt Creator focus on released versions of Qt;-)
Please consider to "file a bug report":http://bugreports.qt.nokia.com/ if this is still the case in the master branch of Qt Creator.
-
There will be an alpha of Qt5 soon. Beta will appear in due course but the release of 5.0 will be sometime this summer.
-
So it will be pretty soon. I ask because apart from learning Qt I have planned a few relatively large scale projects, which could benefit from the changes introduced to Qt5, so the wiser decision would be to wait a little more while working on my skills with what Qt4 has to offer.
Tobias Hunger - a bug suggests unwanted behavior, and as far as I understand, all the factors that break compatibility between what is currently final and Qt5 are rational decisions, so I guess there is no need to file any bug reports at all. I am sure a lot of people, far more experienced than me are engaged with Qt5 :)
-
ddriver: Oh, I am not referring to reporting a bug against Qt, but against Qt Creator for its wizard not creating code that works with Qt5 (or for not saying that the wizard is Qt4 only).
-
But is it really a bug? I think it just has not yet been implemented yet.
-
Bug/feature request. Let's not split semantic hairs ;-)
-
I tend to think of JIRA as one big todo list. Yes, it is not a bug, but JIRA lets you create tasks and feature requests, too, so you can always go for the more generic term "task".
-
Thanks ZapB
I started Qt couple of days ago.
Followed NewBoston YouTube series by Bucky.
In his "C++ GUI with Qt Tutorial - 8 - Syncing Widgets and Layouts"
in headers he use "#include <QtWidgets/QApplication>"It gives an error. Then I tried your advice, use QtWidgets/QApplication
It worked.Thanks again
-
Thanks ZapB
I started Qt couple of days ago.
Followed NewBoston YouTube series by Bucky.
In his "C++ GUI with Qt Tutorial - 8 - Syncing Widgets and Layouts"
in headers he use "#include <QtWidgets/QApplication>"It gives an error. Then I tried your advice, use QtWidgets/QApplication
It worked.Thanks again