-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
qquickpopuppositioner: fix popup mirroring
Fixed a bug where QQuickPopupPositioner::reposition() was confusing coordinates obtained by mapToSource() and mapToItem() during mirroring of the popup. This leads to popups at the wrong places, e.g. when a rotated combobox has not enough space to unroll its popup. Translate the coordinates using mapToItem instead of mapToSource after computing the alternative position of the popup (e.g. when it can not be unrolled correctly). Add a test to check if the combobox popup appears at the right places. Skip native styles as they might be pushing the popup around, same for Android as they might have too small screens (which involves more positioning logic then just the mirroring). Fixes: QTBUG-105148 Pick-to: 5.15 6.4 6.2 6.5 Change-Id: I0033509a8824e3a71698f91ef832b94527d8e2c8 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
- Loading branch information
1 parent
e09b72f
commit 5c1d96b
Showing
4 changed files
with
211 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
tests/auto/quickcontrols/qquickpopup/data/mirroredCombobox.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (C) 2022 The Qt Company Ltd. | ||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause | ||
|
||
import QtQuick | ||
import QtQuick.Controls | ||
|
||
Window { | ||
width: 400 | ||
height: 400 | ||
|
||
contentItem.rotation: 180 | ||
|
||
ComboBox { | ||
objectName: "first" | ||
x: 100 | ||
y: 300 // is missing space, needs to unroll in the "mirrored" direction | ||
model: ["First", "Second", "Third", "Fourth", "Fifth"] | ||
} | ||
|
||
ComboBox { | ||
objectName: "second" | ||
x: 200 | ||
y: 100 // has enough space to unroll | ||
model: ["A", "B", "C"] | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
tests/auto/quickcontrols/qquickpopup/data/rotatedCombobox.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (C) 2022 The Qt Company Ltd. | ||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause | ||
|
||
import QtQuick | ||
import QtQuick.Controls | ||
|
||
Window { | ||
width: 400 | ||
height: 400 | ||
|
||
contentItem.rotation: 90 | ||
|
||
ComboBox { | ||
objectName: "first" | ||
x: 100 | ||
y: 320 // is missing space, needs to unroll in the "mirrored" direction | ||
model: ["First", "Second", "Third", "Fourth", "Fifth"] | ||
} | ||
|
||
ComboBox { | ||
objectName: "second" | ||
x: 200 | ||
y: 100 // has enough space to unroll | ||
model: ["A", "B", "C"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters