diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-07-31 17:30:41 -0600 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-07-31 17:32:54 -0600 |
commit | 804466dba970174ed00289b1cde3d8862b111042 (patch) | |
tree | ca93f039c5235ff7660e01ddf3954d3351c2ee1b /framework/qml/SelectableLabel.qml | |
parent | 36b2ee162ffd57c70d21c27ff25801f894886569 (diff) | |
download | kube-804466dba970174ed00289b1cde3d8862b111042.tar.gz kube-804466dba970174ed00289b1cde3d8862b111042.zip |
SelectableLabel with same mechanism as SelectableItem.
Note that we can not easily integrate it with Label due to recursive use
of Kube.Label via the Button component. (Would be doable via dynamic
loading, but that stuff is a PITA to do).
Diffstat (limited to 'framework/qml/SelectableLabel.qml')
-rw-r--r-- | framework/qml/SelectableLabel.qml | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/framework/qml/SelectableLabel.qml b/framework/qml/SelectableLabel.qml index 920f5c7a..308bf3d6 100644 --- a/framework/qml/SelectableLabel.qml +++ b/framework/qml/SelectableLabel.qml | |||
@@ -23,23 +23,19 @@ import org.kube.framework 1.0 as Kube | |||
23 | 23 | ||
24 | Kube.Label { | 24 | Kube.Label { |
25 | id: root | 25 | id: root |
26 | MouseArea { | 26 | Kube.ContextMenuOverlay { |
27 | id: mouseArea | 27 | id: menu |
28 | anchors.fill: parent | 28 | anchors.fill: parent |
29 | hoverEnabled: true | 29 | Kube.TextButton { |
30 | z: 1 | 30 | id: button |
31 | } | 31 | text: qsTr("Copy") |
32 | Kube.IconButton { | 32 | onClicked: { |
33 | anchors { | 33 | clipboard.text = root.text |
34 | left: parent.right | 34 | menu.close() |
35 | verticalCenter: parent.verticalCenter | 35 | } |
36 | } | 36 | Kube.Clipboard { |
37 | iconName: Kube.Icons.copy | 37 | id: clipboard |
38 | visible: mouseArea.containsMouse || hovered | 38 | } |
39 | color: Kube.Colors.backgroundColor | ||
40 | onClicked: clipboard.text = root.text | ||
41 | Kube.Clipboard { | ||
42 | id: clipboard | ||
43 | } | 39 | } |
44 | } | 40 | } |
45 | } | 41 | } |