diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-08-03 21:03:52 -0600 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-08-03 21:03:52 -0600 |
commit | f70fb14b36c2d6af498f31c36b5fd5d8beb827f4 (patch) | |
tree | 0d8571811fb73f02661c8f4e2c2949529acebc80 | |
parent | 26675cf7af9198941210fd0db664d74dc3401712 (diff) | |
download | kube-f70fb14b36c2d6af498f31c36b5fd5d8beb827f4.tar.gz kube-f70fb14b36c2d6af498f31c36b5fd5d8beb827f4.zip |
auto-close the menu when something has been selected
-rw-r--r-- | framework/qml/ContextMenuOverlay.qml | 8 | ||||
-rw-r--r-- | framework/qml/SelectableLabel.qml | 5 |
2 files changed, 9 insertions, 4 deletions
diff --git a/framework/qml/ContextMenuOverlay.qml b/framework/qml/ContextMenuOverlay.qml index 24ad9701..472b6f4d 100644 --- a/framework/qml/ContextMenuOverlay.qml +++ b/framework/qml/ContextMenuOverlay.qml | |||
@@ -23,11 +23,19 @@ import org.kube.framework 1.0 as Kube | |||
23 | import QtQuick.Layouts 1.3 | 23 | import QtQuick.Layouts 1.3 |
24 | 24 | ||
25 | Item { | 25 | Item { |
26 | id: root | ||
26 | default property alias children: menuLayout.children | 27 | default property alias children: menuLayout.children |
27 | function close() { | 28 | function close() { |
28 | menu.close() | 29 | menu.close() |
29 | } | 30 | } |
30 | 31 | ||
32 | Component.onCompleted: { | ||
33 | for (var i = 0; i < root.children.length; i++) { | ||
34 | var child = root.children[i] | ||
35 | child.clicked.connect(close) | ||
36 | } | ||
37 | } | ||
38 | |||
31 | Rectangle { | 39 | Rectangle { |
32 | anchors.fill: parent | 40 | anchors.fill: parent |
33 | color: "transparent" | 41 | color: "transparent" |
diff --git a/framework/qml/SelectableLabel.qml b/framework/qml/SelectableLabel.qml index 159a717f..4bb4eae9 100644 --- a/framework/qml/SelectableLabel.qml +++ b/framework/qml/SelectableLabel.qml | |||
@@ -30,10 +30,7 @@ Kube.Label { | |||
30 | Kube.TextButton { | 30 | Kube.TextButton { |
31 | id: button | 31 | id: button |
32 | text: qsTr("Copy") | 32 | text: qsTr("Copy") |
33 | onClicked: { | 33 | onClicked: clipboard.text = root.text |
34 | clipboard.text = root.text | ||
35 | menu.close() | ||
36 | } | ||
37 | Kube.Clipboard { | 34 | Kube.Clipboard { |
38 | id: clipboard | 35 | id: clipboard |
39 | } | 36 | } |