Cannot run/preview qml files from qtcreator, but works from terminal
-
Hi, I recently started learning qt, from the book packt: Application development using Qt creator
I made the hello world project as described in the book.
(Qt quick project > added qt quick UI file) The project builds but doesnt run, or preview
However, explicitly running$ qml6 *qml
from the terminal in the project directory does show the preview, and the application window works fine (turns blue)Running gives this error:
02:09:53: /home/sarthak/git/Qt-learning/app-dev-qtcreator/build-HelloWorldQuick-Desktop-Debug/HelloWorldQuick exited with code 255
and QML preview from build file menu gives: (under General Messages)
Error loading QML Live Preview: qrc:/HelloWorldQuick/main.qml:9 MyGuiForm is not a type
Same error occurs if I manually run qmake6, make and the binary file.
My main.qml file is:
import QtQuick Window { width: 640 height: 480 visible: true title: qsTr("Hello World") MyGuiForm { anchors.fill: parent mouseArea.onClicked: { rectangle.color = "blue"; } } }
MyGui.qml:
import QtQuick 2.4 MyGuiForm { }
MyGuiForm.ui.qml:
import QtQuick 2.4 Item { width: 400 height: 400 property alias rectangle: rectangle property alias mouseArea: mouseArea Rectangle { id: rectangle color: "#b00003" anchors.fill: parent MouseArea { id: mouseArea anchors.fill: parent } } }
.pro and main.cpp files are the default ones.
I downloaded qt6-base, qtcreator(6.0) and qt6-declarative from arch linux repositories. This makes the binaries end with "6". eg qml6, qmake6. Could it be related to this?