QtCreator 2.6 on Qt 5: “No qmlviewer installed”, “No valid targets found” and other newbie issues
Hi, I had some previous experience with non-Gui Qt development and now I would like to try the fresh and hot QtQuick 2. Yesterday I built Qt5 Beta1 on my Ubuntu 12.04 32 bit by following the guidelines at http://qt-project.org/wiki/Building_Qt_5_from_Git:
- git clone git://gitorious.org/qt/qt5 qt5
- cd qt5
- perl init-repository --no-webkit
- unset QTDIR; export PATH="$PWD/qtbase/bin:$PWD/qtrepotools/bin:$PATH"
- ./build -j 4
- PATH=/media/MediaExt4/Qt5Beta_1:$PATH QTDIR=/media/MediaExt4/Qt5Beta_1 make -j 4 install
Then I built QtCreator 2.6, which I assume should work OK with Qt5:
- cd $SOURCE_DIRECTORY
- git clone git://gitorious.org/qt-creator/qt-creator.git .
- git checkout -t remotes/origin/2.6
- cd ..
- mkdir $BUILD_DIRECTORY
- cd $BUILD_DIRECTORY
- qmake $SOURCE_DIRECTORY/qtcreator.pro
- time make -j 4
With this setup I have got the following (silly? ;) questions:
1. I did not have any other Qt installations prior to this one (Qt5Beta_1). In Tools->Options->Build and run->Qt Versions I’ve set Qt version to point to /media/MediaExt4/Qt5Beta_1/bin/qmake in the “Manual” field. Got “No qmlviewer installed” warning, however QML dump and qmake were located fine by QtCreator.
I rolled up my sleeves and dived into the code. In ../src/plugins/qtsupport I found that QtCreator parses $QTDIR/mkspecs/default/qmake.conf to get “QT.qml.bins” as a location directory of qmlviewer (for QT >= 5 this is qmlscene actually). I added “QT.qml.bins = /media/MediaExt4/Qt5Beta_1/bin” to the qmake.conf and the warning in QtCreator was gone. But, I assume there is a nicer way to avoid this warning. Probably my build/installation was not properly made…
2. (Related to 1?) When I click “File->New file or project->Qt Gui Application”, and reach the “Target setup” window, I see “No valid targets found”, but below this text I can actually choose the “Desktop” target and click Next. The created “Gui Application” would compile and run just fine. But when I try to “File->New file or project->Qt Quick Application (Build in elements)”, the “No valid targets found” text is again there and this time there are no targets listed in the window and I can’t press “next”.
In “Build and run->Targets” I have:
Device type: Desktop
Device: Run locally
Toolchain: GCC (x86 32bit)
Debugger command: /usr/bin/gdb
Qt version: Qt 5.0.0 (Qt5Beta_1)
Qt mkspec: <empty>
(Btw, when I try to enter “linux-g++” to “Qt mkspec” and press “Apply”, the field wont save my changes and remain empty. Should I leave it empty?)
Any ideas? I have not found any instructions on setting up the Desktop target in QtCreator…
3. When I configure Qt5 with “-developer-build”, the built $QTDIR/bin won’t contain assistant, designer, etc. I guess developers don’t need all that stuff, right? So, I used “-release” and got much more executables, including qmlviewer, which I though was phased out by qmlscene (but probably left for older qml versions?). Also, “make install” for Qt5 actually took quite a lot of time to complete: it built qtdeclarative and some other stuff, if my memory serves. Is this normal? I expected everything to be built by “./build -j 4”…
4. Typing “$BUILD_DIRECTORY/bin/qtcreator” in shell gives:
Failed to load platform plugin “-no-gtkstyle”. Available platforms are:
Aborted (core dumped)
Same thing is with the executables in $QTDIR/bin: assistant, qmlscene, etc.
I can fix this by passing “-platform xcb” as a parameter to the executables, but this is more like hacking than finding the root cause. Qmlscene won’t start from within QtCreator for .qml files due to this issue. Any ideas on what I did wrong during the build/install?
5. Just to make sure I am using the right version of QtCreator: “Help”->“About Qt Creator” shows version 2.5.81. Is this a soon-to-become 2.6 version? I’ve built it from remotes/origin/2.6, so I assume it is “2.6”, right?
6. I also tried to launch QtCreator and other executables in QTDIR/bin on Kubuntu (KDE), but their style is still GTK-alike, not a native Plasma look. Can it be fixed? What is “-no-gtkstyle” for then?
Sorry for too wordy questions. Hopefully with your help I would get my hands on QtQuick2 soon =)
How are those “newb questions”? Judging from the configure line you have used, you are a bit more than a newbie ;)
Ad. 1. QMLViewer for Qt5 is not ready in Qt Creator. It was working in older versions, but they have dropped it, because Qt5 sources were changing too rapidly, and maintenance was too cumbersome. Search for posts by Tobias Hunger, he explained the issue several times in other topics.
Ad. 2. If you’ve added Qt5 as in 1), this one should work. Probably. I’m using projects that already exist, so maybe I just did not run into that problem.
Ad. 3. I would advise against installing Qt5. Make a local, dev build. It’s easier, safer, and often works. You can install 4.8.2 globally and that might solve some problems you have with QtCreator, actually.
Ad. 4. It might be that your configure line there was wrong, but I’m not sure here.
Ad. 5. Yes. You can build from master to get even newer code, but there is probably no need to. 2.5 works fine, too, apart from missing includes.
Ad. 6. -no-gtkstyle is there to make sure Qt4 does not get into PATH on some systems. If you want to try Qt Quick 2, you should not bother yourself with styles anyway ;)
2) The “no valid targets” is always shown, which is a bug… It did not show up a while back. I’ll fix it once I get round to it. Qt Quick applications are actually Qt Quick 1 applications: They require Qt 4. There is still some work ongoing to get Qt 5 Qt Quick application wizards, but I am currently not sure about their status.