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

Flickering when dragging a sub window

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 6.7.0 Beta3
    • None
    • macOS
    • 365cb95a7 (dev), 762906700 (6.8)

      I was trying out a simple use case to have a movable window inside main window. here is my code snippet. 

      // code placeholder
      import QtQuick import QtQuick.Controls
      Window {
      id: mainWindow
      width: 640
      height: 480
      visible: true
       
      Window {
          id: childWindow
          color: "steelblue"
          parent: mainWindow
          visible: true
          flags: Qt.FramelessWindowHint
      
          MouseArea {
              anchors.fill: parent
              property var clickPos: Qt.point(0, 0)
      
              onPressed:(mouse) => {
                            clickPos  = Qt.point(mouse.x,mouse.y)
                        }
      
              onPositionChanged: (mouse) =>{
                                     var delta = Qt.point(mouse.x-clickPos.x, mouse.y-clickPos.y)
                                     childWindow.x += delta.x;
                                     childWindow.y += delta.y;
                                 }
          }
      
          Column {
              anchors.centerIn: parent
              Label {
                  anchors.horizontalCenter: parent.horizontalCenter
                  text: `Drag to move !\n${childWindow.x}, ${childWindow.y}`
              }
      
              Button {
                  text: childWindow.parent === null ? "Attach" : "Detach"
                  onClicked: {
                      childWindow.parent = childWindow.parent === mainWindow ? null : mainWindow
                  }
              }
          }
      }
      
      } 

      If I detach the widow and drag it using the MouseArea the window moves fine, but if I do the same when it is being inside, I see weird flickering because of wrong position while dragging.

       

      CC: vestbo 

        For Gerrit Dashboard: QTBUG-122415
        # Subject Branch Project Status CR V

            vestbo Tor Arne Vestbø
            holo-pk Arun ParolKundan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes