summaryrefslogtreecommitdiffstats
path: root/framework/qml/ToolTip.qml
diff options
context:
space:
mode:
authorMichael Bohlender <michael.bohlender@kdemail.net>2017-07-18 13:36:03 +0200
committerMichael Bohlender <michael.bohlender@kdemail.net>2017-07-18 13:36:03 +0200
commit234dada3a01c178fc9b1fa1641acbddd38644477 (patch)
tree4da7ee3d562d1e839babd81636b151fc4cff1c0f /framework/qml/ToolTip.qml
parent39a2a9dab5244bc9114eb006a71d04c43ca4be53 (diff)
downloadkube-234dada3a01c178fc9b1fa1641acbddd38644477.tar.gz
kube-234dada3a01c178fc9b1fa1641acbddd38644477.zip
initial Kube.ToolTip
Diffstat (limited to 'framework/qml/ToolTip.qml')
-rw-r--r--framework/qml/ToolTip.qml46
1 files changed, 46 insertions, 0 deletions
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 @@
1/*
2 * Copyright (C) 2017 Michael Bohlender, <bohlender@kolabsys.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19import QtQuick 2.7
20import QtQuick.Templates 2.0 as T
21import org.kube.framework 1.0 as Kube
22
23T.ToolTip {
24 id: root
25
26 x: parent ? (parent.width - implicitWidth) / 2 : 0
27 y: -implicitHeight - Kube.Units.smallSpacing
28
29 implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding
30 implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
31
32 padding: Kube.Units.smallSpacing
33
34 closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent
35
36 contentItem: Label {
37 color: Kube.Colors.viewBackgroundColor
38 text: root.text
39 }
40
41 background: Rectangle {
42 color: Kube.Colors.textColor
43 border.width: 1
44 border.color: Kube.Colors.viewBackgroundColor
45 }
46}