summaryrefslogtreecommitdiffstats
path: root/framework
diff options
context:
space:
mode:
Diffstat (limited to 'framework')
-rw-r--r--framework/qml/ToolTip.qml46
-rw-r--r--framework/qmldir1
2 files changed, 47 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}
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
24TextField 1.0 TextField.qml 24TextField 1.0 TextField.qml
25TextArea 1.0 TextArea.qml 25TextArea 1.0 TextArea.qml
26TextEditor 1.0 TextEditor.qml 26TextEditor 1.0 TextEditor.qml
27ToolTip 1.0 ToolTip.qml
27Label 1.0 Label.qml 28Label 1.0 Label.qml
28Heading 1.0 Heading.qml 29Heading 1.0 Heading.qml
29View 1.0 View.qml 30View 1.0 View.qml