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

Overlay.rotation gets discarded when window is resized

    XMLWordPrintable

Details

    • d51847e32 (dev), 8e9bd27e2 (6.6)

    Description

      Code

      import QtQuick 2.15
      import QtQuick.Window 2.15
      import QtQuick.Controls 2.15
      
      Window {
          id: window
          width: 640
          height: 480
          visible: true
          Overlay.overlay.rotation: slider.value
      
          Column {
              Slider {
                  id: slider
                  from: 0
                  to: 360
              }
              Text { text: `Rotation: ${slider.value.toFixed(1)}°` }
          }
      
          Popup {
              id: popup
              anchors.centerIn: parent
              width: 320
              height: 240
              modal: false
              closePolicy: Popup.NoAutoClose
      
              Text {
                  anchors.centerIn: parent
                  text: "Hello"
              }
          }
          Component.onCompleted: popup.open()
      }
      

       

      Steps to reproduce

      1. Run the code above
      2. Move the slider to a value that is not 0° or 360°
      3. Resize the window
      4. Repeat Steps #2 and #3 multiple times, using different slider values

       

      Expected Outcome
      At Step #3, the Popup's rotation remains unchanged (== slider.value)

       

      Actual Outcome
      At Step #3, the Popup's rotation resets to 0

       

      Workaround
      Instead of binding Overlay.overlay.rotation: slider.value, use a Transform:

      Overlay.overlay.transform: Rotation {
          angle: slider.value
          origin.x: window.Overlay.overlay.width / 2
          origin.y: window.Overlay.overlay.height / 2
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              vhilshei Volker Hilsheimer
              skoh-qt Sze Howe Koh
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes