Fixes the tooltip placement for the view mode button

Fixes: issue CURA-152
This commit is contained in:
Tamara Hogenhout 2015-09-16 17:15:21 +02:00
parent bb961ad1b1
commit aeb935489e
2 changed files with 23 additions and 9 deletions

View File

@ -368,6 +368,7 @@ UM.MainWindow
Button Button
{ {
id: viewModeButton id: viewModeButton
property bool verticalTooltip: true
anchors anchors
{ {
top: parent.top; top: parent.top;

View File

@ -101,16 +101,29 @@ QtObject {
Rectangle { Rectangle {
id: tool_button_background id: tool_button_background
anchors.left: parent.right anchors.left: control.verticalTooltip ? parent.left : parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: control.verticalTooltip ? undefined : parent.verticalCenter
//anchors.top: parent.bottom anchors.top: control.verticalTooltip ? parent.bottom : undefined
//width: label.width > parent.width ? label.width : parent.width
width: control.hovered ? label.width : 0;
height: label.height
Behavior on width { NumberAnimation { duration: 100; } }
opacity: control.hovered ? 1.0 : 0.0; opacity: control.hovered ? 1.0 : 0.0;
width: {
if (control.verticalTooltip == true){
if (label.width > parent.width)
return label.width
else
return parent.width
}
else {
if (control.hovered)
return label.width
else
return 0
}
}
height: !control.verticalTooltip ? label.height : control.hovered ? label.height: 0
Behavior on width { NumberAnimation { duration: 100; } }
Behavior on height { NumberAnimation { duration: 100; } }
Behavior on opacity { NumberAnimation { duration: 100; } } Behavior on opacity { NumberAnimation { duration: 100; } }
Label { Label {