diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-01-22 15:20:04 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-01-23 13:37:12 +0000 |
commit | 3bbd90c753fba9cc43c34ca9c509bcc35858b566 (patch) | |
tree | 2701ecf16fdad2c6131795ede0842f03432a53a0 /src/imports | |
parent | 4d26036772f897c293d8f71d728ed41c720a85e8 (diff) |
Add Popup::parent
The parent defaults to the QML parent object where Popup is declared.
Popup::x/y are relative to the parent, and the popup also automatically
follows the parent as appropriate. QQuickPopupPositioner has been
adapted from Qt Quick Controls 1. It was called QQuickScenePosListener,
and it was implemented for the text selection handle popups.
ComboBox's popup now follows the control eg. when scrolling, but the
below/above positioning feature is temporarily gone missing. It will
be restored in a follow up commit.
Change-Id: I8a6b58cd74e07f33930abc35d0ab9da056685128
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/controls/ComboBox.qml | 6 | ||||
-rw-r--r-- | src/imports/controls/material/ComboBox.qml | 7 | ||||
-rw-r--r-- | src/imports/controls/universal/ComboBox.qml | 5 |
3 files changed, 2 insertions, 16 deletions
diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml index f18140f9..0f8001e2 100644 --- a/src/imports/controls/ComboBox.qml +++ b/src/imports/controls/ComboBox.qml @@ -98,11 +98,7 @@ T.ComboBox { //! [popup] popup: T.Popup { - readonly property var above: popup.visible ? control.mapToItem(null, 0, -height + 1) : Qt.point(0, 0) - readonly property var below: popup.visible ? control.mapToItem(null, 0, control.height - 1) : Qt.point(0, 0) - - x: below.x - y: above.y >= 0 && below.y + height > control.Window.height ? above.y : below.y + y: control.height - 1 width: control.width height: Math.min(200, listview.contentHeight) diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml index c4ceecdd..c3a7d74f 100644 --- a/src/imports/controls/material/ComboBox.qml +++ b/src/imports/controls/material/ComboBox.qml @@ -114,12 +114,7 @@ T.ComboBox { //! [popup] popup: T.Popup { - readonly property var above: popup.visible ? control.mapToItem(null, 0, -height) : Qt.point(0, 0) - readonly property var below: popup.visible ? control.mapToItem(null, 0, control.height) : Qt.point(0, 0) - readonly property bool showAbove: above.y >= 0 && below.y + height > control.Window.height - - x: below.x - y: showAbove ? above.y : below.y + y: control.height width: control.width height: Math.min(200, listview.contentHeight) diff --git a/src/imports/controls/universal/ComboBox.qml b/src/imports/controls/universal/ComboBox.qml index 32e28e53..79973dde 100644 --- a/src/imports/controls/universal/ComboBox.qml +++ b/src/imports/controls/universal/ComboBox.qml @@ -109,11 +109,6 @@ T.ComboBox { //! [popup] popup: T.Popup { - readonly property var above: popup.visible ? control.mapToItem(null, 0, control.height - height) : Qt.point(0, 0) - readonly property var below: popup.visible ? control.mapToItem(null, 0, 0) : Qt.point(0, 0) - - x: below.x - y: above.y >= 0 && below.y + height > control.Window.height ? above.y : below.y width: control.width height: Math.min(200, listview.contentHeight) // TODO: 396 |