Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. Different behavior in Qt5 and Qt6 with respect to QML files
Qt 6.11 is out! See what's new in the release blog

Different behavior in Qt5 and Qt6 with respect to QML files

Scheduled Pinned Locked Moved Unsolved Qt 6
4 Posts 2 Posters 872 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.
  • D Offline
    D Offline
    devil_coder
    wrote on last edited by devil_coder
    #1

    I am trying to create 2 classes derived from QQuickItem (ParentItem and ChildItem). Both these quickitems have event handlers (mousePressEvent and mouseReleaseEvent) overridden from QQuickItem.

    In QML, I am trying to create the quickitem as follows:

    ParentItem{
        id: parentItem
        width: 300
        height: 300
        visible: true
        Rectangle {
            color: "yellow"
            anchors.fill: parent
            z: -1
    
           ChildItem{
               id: childItem
               width: 150
               height: 150
               visible: true
               Rectangle {
                  color: "blue"
                  anchors.fill: parent
               }
           }
        } 
    }
    

    If I click on the blue rectangle (ChildItem), the ParentItem's event handlers are triggered.

    In Qt5, for the same project, the ChildItem's event handlers are triggered.
    Is this a new behavior with Qt6? Or is it a bug with Qt6?

    TomZT 1 Reply Last reply
    0
    • D devil_coder

      I am trying to create 2 classes derived from QQuickItem (ParentItem and ChildItem). Both these quickitems have event handlers (mousePressEvent and mouseReleaseEvent) overridden from QQuickItem.

      In QML, I am trying to create the quickitem as follows:

      ParentItem{
          id: parentItem
          width: 300
          height: 300
          visible: true
          Rectangle {
              color: "yellow"
              anchors.fill: parent
              z: -1
      
             ChildItem{
                 id: childItem
                 width: 150
                 height: 150
                 visible: true
                 Rectangle {
                    color: "blue"
                    anchors.fill: parent
                 }
             }
          } 
      }
      

      If I click on the blue rectangle (ChildItem), the ParentItem's event handlers are triggered.

      In Qt5, for the same project, the ChildItem's event handlers are triggered.
      Is this a new behavior with Qt6? Or is it a bug with Qt6?

      TomZT Offline
      TomZT Offline
      TomZ
      wrote on last edited by
      #2

      @devil_coder any specific parts that cause this behavior? The z index comes to mind.

      I'd love it if you can share your thoughts on the most detailed reason you deducted that caused this change.

      Also, which Qt versions exactly?

      D 1 Reply Last reply
      0
      • TomZT TomZ

        @devil_coder any specific parts that cause this behavior? The z index comes to mind.

        I'd love it if you can share your thoughts on the most detailed reason you deducted that caused this change.

        Also, which Qt versions exactly?

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

        @TomZ

        Specifically, behavioral difference when clicked was the main reason why I am suspecting z order can be causing the issue.

        The QT version used for Qt6 is Qt 6.5.2.
        For Qt5, its Qt 5.15.9

        TomZT 1 Reply Last reply
        0
        • D devil_coder

          @TomZ

          Specifically, behavioral difference when clicked was the main reason why I am suspecting z order can be causing the issue.

          The QT version used for Qt6 is Qt 6.5.2.
          For Qt5, its Qt 5.15.9

          TomZT Offline
          TomZT Offline
          TomZ
          wrote on last edited by TomZ
          #4

          @devil_coder said in Different behavior in Qt5 and Qt6 with respect to QML files:

          Specifically, behavioral difference when clicked was the main reason why I am suspecting z order can be causing the issue.

          As you have the code, and we don't. Please confirm that by playing with the z index in that qml.

          Please report back your findings.

          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