Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Cannot run/preview qml files from qtcreator, but works from terminal
Forum Updated to NodeBB v4.3 + New Features

Cannot run/preview qml files from qtcreator, but works from terminal

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 764 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    phoneticallySAARTHaK
    wrote on last edited by phoneticallySAARTHaK
    #1

    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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved