From 234dada3a01c178fc9b1fa1641acbddd38644477 Mon Sep 17 00:00:00 2001 From: Michael Bohlender Date: Tue, 18 Jul 2017 13:36:03 +0200 Subject: initial Kube.ToolTip --- components/kube/contents/ui/Kube.qml | 36 ++++++++++++++++++++++++++++ framework/qml/ToolTip.qml | 46 ++++++++++++++++++++++++++++++++++++ framework/qmldir | 1 + 3 files changed, 83 insertions(+) create mode 100644 framework/qml/ToolTip.qml diff --git a/components/kube/contents/ui/Kube.qml b/components/kube/contents/ui/Kube.qml index 095e51e1..504d45da 100644 --- a/components/kube/contents/ui/Kube.qml +++ b/components/kube/contents/ui/Kube.qml @@ -118,21 +118,42 @@ Controls2.ApplicationWindow { Kube.IconButton { iconName: Kube.Icons.search_inverted onClicked: search.open() + + + Kube.ToolTip { + text: "hjfhd" + visible: parent.hovered + } } Kube.IconButton { iconName: Kube.Icons.edit_inverted onClicked: kubeViews.openComposer(false) + + Kube.ToolTip { + text: "composer" + visible: parent.hovered + } } Kube.IconButton { iconName: Kube.Icons.mail_inverted onClicked: kubeViews.setMailView() + + Kube.ToolTip { + text: "mails" + visible: parent.hovered + } } Kube.IconButton { iconName: Kube.Icons.user_inverted onClicked: kubeViews.setPeopleView() + + Kube.ToolTip { + text: "people" + visible: parent.hovered + } } } Column { @@ -146,16 +167,31 @@ Controls2.ApplicationWindow { Kube.Outbox { height: Kube.Units.gridUnit * 1.5 width: height + + Kube.ToolTip { + text: "outbox" + visible: parent.hovered + } } Kube.IconButton { iconName: Kube.Icons.error_inverted onClicked: kubeViews.setLogView() + + Kube.ToolTip { + text: "logview" + visible: parent.hovered + } } Kube.IconButton { iconName: Kube.Icons.menu_inverted onClicked: kubeViews.setAccountsView() + + Kube.ToolTip { + text: "settings" + visible: parent.hovered + } } } } diff --git a/framework/qml/ToolTip.qml b/framework/qml/ToolTip.qml new file mode 100644 index 00000000..45f50e87 --- /dev/null +++ b/framework/qml/ToolTip.qml @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2017 Michael Bohlender, + * + * 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 + +T.ToolTip { + id: root + + x: parent ? (parent.width - implicitWidth) / 2 : 0 + y: -implicitHeight - Kube.Units.smallSpacing + + implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding + implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding + + padding: Kube.Units.smallSpacing + + closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent + + contentItem: Label { + color: Kube.Colors.viewBackgroundColor + text: root.text + } + + background: Rectangle { + color: Kube.Colors.textColor + border.width: 1 + border.color: Kube.Colors.viewBackgroundColor + } +} diff --git a/framework/qmldir b/framework/qmldir index 874bdf78..1a888068 100644 --- a/framework/qmldir +++ b/framework/qmldir @@ -24,6 +24,7 @@ PositiveButton 1.0 PositiveButton.qml TextField 1.0 TextField.qml TextArea 1.0 TextArea.qml TextEditor 1.0 TextEditor.qml +ToolTip 1.0 ToolTip.qml Label 1.0 Label.qml Heading 1.0 Heading.qml View 1.0 View.qml -- cgit v1.2.3