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. Label is not a Type (only with 5.12)
Forum Updated to NodeBB v4.3 + New Features

Label is not a Type (only with 5.12)

Scheduled Pinned Locked Moved Solved QML and Qt Quick
6 Posts 3 Posters 1.4k Views 2 Watching
  • 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.
  • D Offline
    D Offline
    deleted372
    wrote on last edited by aha_1980
    #1

    Hi.
    In my app, I load this piece of qml inside a QQuickView. It works fine on all platforms and versions, but Qt 5.12 for iOS.

    Only on Qt 5.12 for iOS I get the error "Ctrls.Label is not a type"

    Does somebody have any idea how and where to debug?

    import QtQuick 2.12
    import QtQuick.Controls 2.5 as Ctrls
    
    Rectangle {
        id: window
        visible: true
    
        Column {
            spacing: 2
            width: parent.width
    
            Ctrls.Label {
                width: parent.width
                wrapMode: Label.Wrap
                height: implicitHeight
                horizontalAlignment: Qt.AlignHCenter
                text: "This is just a Label."
            }
        }
    }
    
    
    1 Reply Last reply
    0
    • D Offline
      D Offline
      deleted372
      wrote on last edited by
      #6

      The problem is solved by adding this line of code in the main() :
      QQuickStyle::setStyle("Fusion");

      main.cpp

      
      int main(int argc, char *argv[])
      {
         QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
         QApplication app(argc, argv); 
         QQuickStyle::setStyle("Fusion");
      
      ...
      
      }
      
      1 Reply Last reply
      0
      • KazuoAsanoK Offline
        KazuoAsanoK Offline
        KazuoAsano
        Qt Champions 2018
        wrote on last edited by
        #2

        I tried on your issue.
        However, My environment is Ubuntu 16.04 LTS x64 (linux) / Qt 5.12 :(
        Unfortunately, I don't have iOS develop environment....

        It isn't iOS, but it was able to execute normally.
        0_1545985291061_Screenshot from 2018-12-28 16-56-52.png

        import QtQuick.Controls 2.5 as Ctrls
        

        As far as I see Qt document, I think that QtQuick.Controls version is correct at 5.12.
        http://doc.qt.io/qt-5/qtquickcontrols-index.html#versions

        import QtQuick.Controls 2.12 as Ctrls
        

        0_1545985337352_QtQuick.png

        Please confirm it.

        D 1 Reply Last reply
        1
        • KazuoAsanoK KazuoAsano

          I tried on your issue.
          However, My environment is Ubuntu 16.04 LTS x64 (linux) / Qt 5.12 :(
          Unfortunately, I don't have iOS develop environment....

          It isn't iOS, but it was able to execute normally.
          0_1545985291061_Screenshot from 2018-12-28 16-56-52.png

          import QtQuick.Controls 2.5 as Ctrls
          

          As far as I see Qt document, I think that QtQuick.Controls version is correct at 5.12.
          http://doc.qt.io/qt-5/qtquickcontrols-index.html#versions

          import QtQuick.Controls 2.12 as Ctrls
          

          0_1545985337352_QtQuick.png

          Please confirm it.

          D Offline
          D Offline
          deleted372
          wrote on last edited by
          #3

          @KazuoAsano

          Thank you very much for replying. You are right, should be QtQuick.Controls 2.12.

          I tried the code on another project and it works fine. So, the problem is only on my main project. It looks like is not including the necessary components in the bundle deployed to the device.

          But I have no idea where to look for such an issue.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #4

            Hi,

            Compare your projects .pro file for any difference in the modules used for example.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • KazuoAsanoK Offline
              KazuoAsanoK Offline
              KazuoAsano
              Qt Champions 2018
              wrote on last edited by
              #5

              @JoZCaVaLLo ,
              thk reply @SGaist, and my others solution.

              For iOS, I think that the necessary modules will be automatically deployed for iOS.
              If QML module error occurs in iOS, it may be improved by distclean and deploy,again.
              In Android case, I could improved similarity issue.

              1 Reply Last reply
              0
              • D Offline
                D Offline
                deleted372
                wrote on last edited by
                #6

                The problem is solved by adding this line of code in the main() :
                QQuickStyle::setStyle("Fusion");

                main.cpp

                
                int main(int argc, char *argv[])
                {
                   QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
                   QApplication app(argc, argv); 
                   QQuickStyle::setStyle("Fusion");
                
                ...
                
                }
                
                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