From aeb935489e2654b8d0a7cae504016fb5a0887fa0 Mon Sep 17 00:00:00 2001 From: Tamara Hogenhout Date: Wed, 16 Sep 2015 17:15:21 +0200 Subject: [PATCH] Fixes the tooltip placement for the view mode button Fixes: issue CURA-152 --- resources/qml/Cura.qml | 1 + resources/themes/cura/styles.qml | 31 ++++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 1bcce6301b..5d0db79dd7 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -368,6 +368,7 @@ UM.MainWindow Button { id: viewModeButton + property bool verticalTooltip: true anchors { top: parent.top; diff --git a/resources/themes/cura/styles.qml b/resources/themes/cura/styles.qml index 0c368ecb00..d0aa41d159 100644 --- a/resources/themes/cura/styles.qml +++ b/resources/themes/cura/styles.qml @@ -101,16 +101,29 @@ QtObject { Rectangle { id: tool_button_background - anchors.left: parent.right - anchors.verticalCenter: parent.verticalCenter - //anchors.top: parent.bottom - - //width: label.width > parent.width ? label.width : parent.width - width: control.hovered ? label.width : 0; - height: label.height - Behavior on width { NumberAnimation { duration: 100; } } - + anchors.left: control.verticalTooltip ? parent.left : parent.right + anchors.verticalCenter: control.verticalTooltip ? undefined : parent.verticalCenter + anchors.top: control.verticalTooltip ? parent.bottom : undefined 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; } } Label {