QtCreator design editor can't open template QML file.
-
I have no experience with Qt or QtCreator, and I'm attempting to learn by creating my first project. I used a built-in template, in this case the Python "Qt Quick Application - Empty" template
When I click the Design button, I get 3 errors:
- Line: 0: Qt Quick 6 is not supported with a Qt 5 Kit.
- Line: 1: QML module not found (QtQuick).
- Line: 2: QML module not found (QtQuick.Window).
The last 2 show up in the code editor and I'm not too worried about them as the program builds and runs fine. But the first error doesn't make much sense to me and I'm assuming it is the reason I can't edit the layout graphically...
I checked my "kits" in the settings, and noticed it only showed Qt 5.15.9 in Qt Versions (it found it via PATH), so I manually added /bin/qtmake6 since I have it as well.
-
The first error does indeed mean that it attempts to use a Qt 5 Kit with a Qt Quick 6 application. After adding Qt 6 as kit, you should be able to select it on the start page with the overview of all examples (there should be a dropdown menu with the kits near the top left).
The two latter errors probably stem from that issue above, a missmatch in the Qt versions.
-
@aran I wasn't using an example, just one of the templates from the New Project menu. In fact, my examples screen is empty...
Also, interestingly, Qt 6 (6.5.0) is my only option in that drop down list, no Qt 5.
Edit: your comment did get me searching a bit more, and I've resolved the line 0 error about Qt version, however the other 2 still did not go away and I still cannot design the layout (the OK button doesn't do anything):
I resolved the line 0 error by going to Edit -> Preferences... -> Kits -> Kits -> Select Desktop (default) under Manual -> Scroll down to Qt version drop-down -> Select Qt 6.5.0 ().
Checking in
/usr/lib/qt/qml
I do see QtQuick (and like I said earlier, the project does build), so this seems to be the Designer not reading whatever info the project already has available (somewhere)...
Here's the templated code:
import QtQuick import QtQuick.Window Window { width: 640 height: 480 visible: true title: qsTr("Hello World") }
In the editor window, the two lines say
QML module not found (<module>).
, but in the Issues tab at the bottom of the IDE, those two lines show a different error:package import requires a version number
. -
@Magicrafter13 Can you please show us a screenshot of the following?
- "Edit" > "Preferences..." > "Kits" > "Qt Versions"
- "Edit" > "Preferences..." > "Kits" > "Kits"
Also, how did you install Qt and Qt Creator?
-
I didn't personally install Qt (that I remember), I believe they were just dependencies for packages in my system. Qt Creator was installed via the package manager (as I assume Qt versions automatically were as well).
I'm on Manjaro Linux (Arch).
Edit:
Oh, when I opened the project today it was fine. It must be when I switched the Desktop kit to use Qt 6.5.1 that it didn't apply that change until I reopened Qt Creator, but everything seems to be fine now... -
1/5