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. When Rectangle not get load in Qt Qml based Application ?
Qt 6.11 is out! See what's new in the release blog

When Rectangle not get load in Qt Qml based Application ?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 355 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.
  • Q Offline
    Q Offline
    Qt embedded developer
    wrote on last edited by Qt embedded developer
    #1

    Hi i have added the below code in qml. i am loading this qml using mvc based code.

    import QtQuick 2.12
    import QtQuick.Window 2.12
    import QtGraphicalEffects 1.12
    import QtQuick.Controls 2.4
    import QtQuick.Layouts 1.12
    import QtQuick.VirtualKeyboard 2.0
    import QtQuick.VirtualKeyboard.Settings 2.0
    
    Window {
        width: 640
        height: 480
        visible: true
        title: qsTr("Hello World")
    
        Rectangle{
            width: 200
            height: 400
            color: "red"
        }
    
        Component.onCompleted: {
            console.log("Print")
        }
    }
    
    

    in the output

    i get the console output : qml: Print

    why it open this screen and not show the rectangle ? and why i am not able to load rectangle ?
    Why when i click on close at that time it not close this window also ?

    3d3874fe-120f-4505-8848-5326330d3e63-image.png

    How to debug and find root cause of this type of problem?

    because the code is working fine and not crash but just only when load the qml at that time this problem come

    Q 1 Reply Last reply
    0
    • Q Qt embedded developer

      Hi i have added the below code in qml. i am loading this qml using mvc based code.

      import QtQuick 2.12
      import QtQuick.Window 2.12
      import QtGraphicalEffects 1.12
      import QtQuick.Controls 2.4
      import QtQuick.Layouts 1.12
      import QtQuick.VirtualKeyboard 2.0
      import QtQuick.VirtualKeyboard.Settings 2.0
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Rectangle{
              width: 200
              height: 400
              color: "red"
          }
      
          Component.onCompleted: {
              console.log("Print")
          }
      }
      
      

      in the output

      i get the console output : qml: Print

      why it open this screen and not show the rectangle ? and why i am not able to load rectangle ?
      Why when i click on close at that time it not close this window also ?

      3d3874fe-120f-4505-8848-5326330d3e63-image.png

      How to debug and find root cause of this type of problem?

      because the code is working fine and not crash but just only when load the qml at that time this problem come

      Q Offline
      Q Offline
      Qt embedded developer
      wrote on last edited by Qt embedded developer
      #2

      @Qt-embedded-developer This issue happen due to

      calling the below line into class constructor :

      pPtr->installEventFilter(this);
      

      And i have written the below function def:

      bool Bapplication::eventFilter(QObject *watched, QEvent *event)
      {

      return true;
      }

      1 Reply Last reply
      0
      • Q Qt embedded developer has marked this topic as solved on

      • Login

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