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

Material Popup is not properly anchored after being opened more than once

    XMLWordPrintable

Details

    • All
    • df33c79fb6579f94498164531777320e79c36fd5 (6.1)

    Description

      While QTBUG-84488 solved the scaling issue in popups, a new one appeared. The code bellow illustrates the issue:

       

      import QtQuick 2.15
      import QtQuick.Controls 2.15
      import QtQuick.Window 2.15
      
      /*
       * Run this passing the `--style material` option to `qmlscene`.
       * The first time you open the popup, all it's OK:
       *  ______________________
       * |  __________________  |
       * | |                  | |
       * | |                  | |
       * | |                  | |
       * | |                  | |
       * | |                  | |
       * | |                  | |
       * | |                  | |
       * | |                  | |
       * |  ------------------  |
       *  ----------------------
       *
       * The second... not so well:
       *  ______________________
       * |                      |
       * |    __________________|
       * |   |                  |
       * |   |                  |
       * |   |                  |
       * |   |                  |
       * |   |                  |
       * |   |                  |
       * |   |                  |
       * |   |                  |
       * |   |                  |
       *  ----------------------
       */
      
      Window {
      
          Button {
              anchors.centerIn: parent
              text: "Open popup"
              onClicked: popup.open()
          }
      
          Popup {
              id: popup
              anchors.centerIn: parent
              width: parent.width - 20
              height: parent.height - 20
              Button {
                  anchors.centerIn: parent
                  text: "Close popup"
                  onClicked: popup.close()
              }
          }
      }
      
      /*
       * A workaround is set the popup's position manually. For example:
       *
       *  parent: Overlay.overlay
       *  x: Math.round((parent.width - width) / 2)
       *  y: Math.round((parent.height - height) / 2)
       *
       * I guess that is why this bug does not ocurr in a `ComboBox`
       */
      

       

      Attachments

        Issue Links

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

          Activity

            People

              andysh Andy Shaw
              ceperez1996 Carlos Pérez
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes