From c092d555bd6d3e93a11625bfe76bb59b2e64e994 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sat, 29 Jul 2017 16:42:52 -0600 Subject: SelectableLabel to support copying individual labels --- framework/qml/Icons.qml | 1 + framework/qml/SelectableLabel.qml | 45 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 framework/qml/SelectableLabel.qml (limited to 'framework/qml') diff --git a/framework/qml/Icons.qml b/framework/qml/Icons.qml index 3126c797..d9612013 100644 --- a/framework/qml/Icons.qml +++ b/framework/qml/Icons.qml @@ -42,6 +42,7 @@ Item { property string replyToSender: "mail-reply-sender" property string outbox: "mail-folder-outbox" property string outbox_inverted: "mail-folder-outbox-inverted" + property string copy: "edit-copy" property string menu_inverted: "application-menu-inverted" property string user: "im-user" diff --git a/framework/qml/SelectableLabel.qml b/framework/qml/SelectableLabel.qml new file mode 100644 index 00000000..920f5c7a --- /dev/null +++ b/framework/qml/SelectableLabel.qml @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2017 Michael Bohlender, + * Copyright (C) 2017 Christian Mollekopf, + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import QtQuick 2.7 +import QtQuick.Templates 2.0 as T +import org.kube.framework 1.0 as Kube + +Kube.Label { + id: root + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + z: 1 + } + Kube.IconButton { + anchors { + left: parent.right + verticalCenter: parent.verticalCenter + } + iconName: Kube.Icons.copy + visible: mouseArea.containsMouse || hovered + color: Kube.Colors.backgroundColor + onClicked: clipboard.text = root.text + Kube.Clipboard { + id: clipboard + } + } +} -- cgit v1.2.3