Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.7.0, 5.8.0
-
None
-
Mageia Linux Cauldron x86_64, Plasma 5
Description
If popup use margins, it position after open() is wrong. To reproduce, run test program. After window resize popup moves to the center.
Test program:
import QtQuick 2.7 import QtQuick.Controls 2.0 ApplicationWindow { visible: true width: 400 height: 300 Button { anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom text: "Open popup" onClicked: popup.open() Popup { id: popup property point position: parent.mapFromItem(null, (ApplicationWindow.window.width - width) / 2, (ApplicationWindow.window.height - height) / 2) x: position.x y: position.y margins: 20 contentItem: Item { implicitWidth: 100 implicitHeight: 100 Rectangle { anchors.fill: parent color: "skyblue" } } } } }
The workaround is to use code like this for the position calculation:
(main.width - width) / 2 + visible - visible
Attachments
Issue Links
- resulted in
-
QTBUG-60354 Centering popups and dialogs
-
- Closed
-