Add support for displaying setting tooltips with descriptions

This commit is contained in:
Arjen Hiemstra 2015-04-02 13:21:35 +02:00
parent b67a2bff31
commit 0d5e10219c
3 changed files with 71 additions and 2 deletions

44
qml/SidebarTooltip.qml Normal file
View file

@ -0,0 +1,44 @@
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.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;
opacity: 0;
Behavior on opacity { NumberAnimation { duration: 100; } }
property alias text: label.text;
function show(position) {
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;
}
// horizontalAlignment: Qt.AlignJustify;
wrapMode: Text.Wrap;
}
}