forked from nallath/PostProcessingPlugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTooltip.qml
More file actions
56 lines (50 loc) · 1.35 KB
/
Tooltip.qml
File metadata and controls
56 lines (50 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright (c) 2015 Jaime van Kessel, Ultimaker B.V.
// The PostProcessingPlugin is released under the terms of the AGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.1
import QtQuick.Window 2.1
import UM 1.0 as UM
Rectangle
{
id: base;
width: UM.Theme.sizes.tooltip.width;
height: label.height + UM.Theme.sizes.tooltip_margins.height * 2;
color: UM.Theme.colors.tooltip_background;
opacity: 0;
Behavior on opacity { NumberAnimation { duration: 100; } }
property alias text: label.text;
function show(position)
{
if(position.y + base.height > parent.height)
{
x = position.x;
y = parent.height - base.height;
} else
{
x = position.x;
y = position.y;
}
base.opacity = 1;
}
function hide()
{
base.opacity = 0;
}
Label
{
id: label;
anchors
{
top: parent.top;
topMargin: UM.Theme.sizes.tooltip_margins.height;
left: parent.left;
leftMargin: UM.Theme.sizes.tooltip_margins.width;
right: parent.right;
rightMargin: UM.Theme.sizes.tooltip_margins.width;
}
wrapMode: Text.Wrap;
font: UM.Theme.fonts.default;
}
}