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. Several components is not displayed
Forum Updated to NodeBB v4.3 + New Features

Several components is not displayed

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 212 Views 1 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.
  • S Offline
    S Offline
    serebryakov
    wrote on last edited by serebryakov
    #1

    Hi everyone! I am beginning to learn QML. And throughout the Design section, I created a very simple application, but the busy indicator and label are not shown for some reason. Could you help me please find out what went wrong?

    Main.qml

    import QtQuick
    import QtQuick.Window
    import QtQuick.Controls 2.3
    
    Window {
        id: window
        width: 640
        height: 480
        visible: true
        title: qsTr("Hello World")
    
        BusyIndicator {
            id: busyIndicator
            //x: (window.width - busyIndicator.width) / 2
            //y: (window.height - busyIndicator.height) / 2
            visible: true
            anchors.verticalCenter: parent.verticalCenter
            anchors.horizontalCenter: parent.horizontalCenter
        }
    
        Label {
            id: label
            x: 185
            y: 198
            text: qsTr("Running = ") + busyIndicator.running
    
            Component.onCompleted: {
                console.log("Label displayed");
            }
        }
    
        Component.onCompleted: {
            console.log("Running = " + busyIndicator.running);
        }
    }
    

    main.cpp

    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    
    
    int main(int argc, char *argv[])
    {
        QGuiApplication app(argc, argv);
    
        QQmlApplicationEngine engine;
        const QUrl url(u"qrc:/testQMLB-8-3/Main.qml"_qs);
        QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
            &app, []() { QCoreApplication::exit(-1); },
            Qt::QueuedConnection);
        engine.load(url);
    
        return app.exec();
    }
    
    

    I have already checked all the necessary info like updates and whether enabled plugins for QtQuick or not and everything is OK:
    Screenshot 2023-05-02 at 16.29.36.png

    And in the Design section I can select my components but they are invisible:
    Screenshot 2023-05-02 at 16.29.56.png

    App output:
    Screenshot 2023-05-02 at 16.31.42.png

    App:
    Screenshot 2023-05-02 at 16.30.04.png

    sierdzioS 1 Reply Last reply
    0
    • S serebryakov

      Hi everyone! I am beginning to learn QML. And throughout the Design section, I created a very simple application, but the busy indicator and label are not shown for some reason. Could you help me please find out what went wrong?

      Main.qml

      import QtQuick
      import QtQuick.Window
      import QtQuick.Controls 2.3
      
      Window {
          id: window
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          BusyIndicator {
              id: busyIndicator
              //x: (window.width - busyIndicator.width) / 2
              //y: (window.height - busyIndicator.height) / 2
              visible: true
              anchors.verticalCenter: parent.verticalCenter
              anchors.horizontalCenter: parent.horizontalCenter
          }
      
          Label {
              id: label
              x: 185
              y: 198
              text: qsTr("Running = ") + busyIndicator.running
      
              Component.onCompleted: {
                  console.log("Label displayed");
              }
          }
      
          Component.onCompleted: {
              console.log("Running = " + busyIndicator.running);
          }
      }
      

      main.cpp

      #include <QGuiApplication>
      #include <QQmlApplicationEngine>
      
      
      int main(int argc, char *argv[])
      {
          QGuiApplication app(argc, argv);
      
          QQmlApplicationEngine engine;
          const QUrl url(u"qrc:/testQMLB-8-3/Main.qml"_qs);
          QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
              &app, []() { QCoreApplication::exit(-1); },
              Qt::QueuedConnection);
          engine.load(url);
      
          return app.exec();
      }
      
      

      I have already checked all the necessary info like updates and whether enabled plugins for QtQuick or not and everything is OK:
      Screenshot 2023-05-02 at 16.29.36.png

      And in the Design section I can select my components but they are invisible:
      Screenshot 2023-05-02 at 16.29.56.png

      App output:
      Screenshot 2023-05-02 at 16.31.42.png

      App:
      Screenshot 2023-05-02 at 16.30.04.png

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Try adding some dimensions to those missing components (width and height).

      (Z(:^

      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