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 /examples | |
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 'examples')
-rw-r--r-- | examples/controls/gallery/gallery.qml | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/examples/controls/gallery/gallery.qml b/examples/controls/gallery/gallery.qml index 7001057d..be9ff5df 100644 --- a/examples/controls/gallery/gallery.qml +++ b/examples/controls/gallery/gallery.qml @@ -86,6 +86,20 @@ ApplicationWindow { source: "qrc:/images/menu.png" } onClicked: optionsMenu.open() + + Menu { + id: optionsMenu + x: parent.width - width + + MenuItem { + text: "Settings" + onTriggered: settingsPopup.open() + } + MenuItem { + text: "About" + onTriggered: aboutDialog.open() + } + } } } } @@ -305,18 +319,4 @@ ApplicationWindow { } } } - - Menu { - id: optionsMenu - x: window.width - width - - MenuItem { - text: "Settings" - onTriggered: settingsPopup.open() - } - MenuItem { - text: "About" - onTriggered: aboutDialog.open() - } - } } |