Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-99436

Quick Drag and Drop Tiles example broken in Qt 6

    XMLWordPrintable

Details

    • Android, Linux/X11, Windows
    • b81e27e652 (qt/qtdeclarative/dev) 5174504fd7 (qt/qtdeclarative/6.3) 33ad379056 (qt/qtdeclarative/6.2)

    Description

      Example in Qt-6.2.2\quick\draganddrop\tiles seems to be broken. It is working in 5.15.2.

      There are two gifs in attachments

      6.2.2.gif shows current apparently wrong behavior.

      6.2.2 fixed.gif shows correct behavior which is the same as in 5.15.2. To achieve that, I had to make changes to tile's states property in DragTile.qml:

      states: [
        State {
          when: mouseArea.drag.active
          ParentChange { target: tile; parent: root }
          AnchorChanges { target: tile; anchors.verticalCenter: undefined; anchors.horizontalCenter: undefined }
        }
        ,State {
          when: !mouseArea.drag.active
          ParentChange { target: tile; parent: mouseArea }
          AnchorChanges { target: tile; anchors.verticalCenter: mouseArea.verticalCenter; anchors.horizontalCenter: mouseArea.horizontalCenter }
        }
      ] 

      Adding a new state which resets parent and anchors to their original values seems reasonable and makes me wonder how it worked before without that change. The same fix worked for me in our production code when we migrated from Qt 5 to Qt 6.

      Is this a Qt bug? If this is not a Qt bug, but an intended behavior change, I haven't found any warnings and migration guidance.

      Please, kindly provide a better solution, if any.

       

      Attachments

        1. 5.15.2 grid ok.gif
          5.15.2 grid ok.gif
          3.14 MB
        2. 6.2.2.gif
          6.2.2.gif
          609 kB
        3. 6.2.2 fixed.gif
          6.2.2 fixed.gif
          419 kB
        4. 6.2.2 grid wrong (without ParentChange).gif
          6.2.2 grid wrong (without ParentChange).gif
          2.56 MB
        5. 6.2.2 grid wrong (with ParentChange).gif
          6.2.2 grid wrong (with ParentChange).gif
          1.53 MB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              ulherman Ulf Hermann
              vserdyuk Vladimir Serdyuk
              Votes:
              8 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews