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. Can't use QtQuick.Controls
Forum Updated to NodeBB v4.3 + New Features

Can't use QtQuick.Controls

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 378 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.
  • W Offline
    W Offline
    w.tkm
    wrote on last edited by w.tkm
    #1

    I can't use QtQuick.Controls.
    I try to import this, and no error when you build it.
    However, when I run this, I get the following error.

    QQmlApplicationEngine failed to load component
    qrc:/qml/main.qml:22:5: ?^ TestRect ?????p????????
    qrc:/qml/TestRect.qml:2:1: "QtQuick.Controls" ???W???[?????C???X?g?[??????????????

    MyCode:
    main.qml

    import QtQuick 2.12
    import QtQuick.Window 2.12
    
    Window {
        id: mainWindow
        width: 640
        height: 480
        visible: true
        title: qsTr("Hellow World")
    
        TestRect{
            id: test
        }
    
    }
    

    TestRect.qml

    import QtQuick 2.12
    import QtQuick.Controls 2.12
    
    Item {
        Rectangle{
            anchors.top: parent.top
            anchors.left: parent.left
            width: 200
            height: 200
            color: "red"
        }
    }
    

    What is the cause of this?
    I use Qt5.15.2 and windows10

    J.HilkJ 1 Reply Last reply
    0
    • W w.tkm

      I can't use QtQuick.Controls.
      I try to import this, and no error when you build it.
      However, when I run this, I get the following error.

      QQmlApplicationEngine failed to load component
      qrc:/qml/main.qml:22:5: ?^ TestRect ?????p????????
      qrc:/qml/TestRect.qml:2:1: "QtQuick.Controls" ???W???[?????C???X?g?[??????????????

      MyCode:
      main.qml

      import QtQuick 2.12
      import QtQuick.Window 2.12
      
      Window {
          id: mainWindow
          width: 640
          height: 480
          visible: true
          title: qsTr("Hellow World")
      
          TestRect{
              id: test
          }
      
      }
      

      TestRect.qml

      import QtQuick 2.12
      import QtQuick.Controls 2.12
      
      Item {
          Rectangle{
              anchors.top: parent.top
              anchors.left: parent.left
              width: 200
              height: 200
              color: "red"
          }
      }
      

      What is the cause of this?
      I use Qt5.15.2 and windows10

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @w-tkm have you considered upgrading to at least the latest 5.12 version?


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      W 1 Reply Last reply
      0
      • J.HilkJ J.Hilk

        @w-tkm have you considered upgrading to at least the latest 5.12 version?

        W Offline
        W Offline
        w.tkm
        wrote on last edited by w.tkm
        #3

        @J-Hilk
        No, I haven't considered it because it has been working fine until now.
        Sorry, I made a mistake, it's "5.15.2" to be exact.
        I created a new project with the exact same settings and the exact same code, and it worked.
        Was there a problem with the settings that I missed somewhere?

        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