From 7ef8038145529ad7bf65ce1bf21dd98ebf4ea898 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Fri, 17 Apr 2015 13:51:41 +0200 Subject: [PATCH 1/4] Fix showing tooltips on control hover --- qml/Sidebar.qml | 18 ++++++++++-------- qml/SidebarAdvanced.qml | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/qml/Sidebar.qml b/qml/Sidebar.qml index cc724ee270..f56c69fe4e 100644 --- a/qml/Sidebar.qml +++ b/qml/Sidebar.qml @@ -15,7 +15,6 @@ UM.AngledCornerRectangle { cornerSize: UM.Theme.sizes.default_margin.width; function showTooltip(item, position, text) { - print("omg zomg") tooltip.text = text; position = item.mapToItem(base, position.x, position.y); tooltip.show(position); @@ -72,16 +71,19 @@ UM.AngledCornerRectangle { onLoaded: { - if(item) item.configureSettings = base.configureMachinesAction; - if(typeof(item.onShowTooltip) != 'undefined') + if(item) { - item.showTooltip.connect(base.showTooltip) + item.configureSettings = base.configureMachinesAction; + if(item.onShowTooltip != undefined) + { + item.showTooltip.connect(base.showTooltip) + } + if(item.onHideTooltip != undefined) + { + item.hideTooltip.connect(base.hideTooltip) + } } - } - - //onShowTooltip: base.showTooltip(item,position,text) - //onHideTooltip: base.hideTooltip() } SaveButton { diff --git a/qml/SidebarAdvanced.qml b/qml/SidebarAdvanced.qml index ba7bd8ed87..bdd91fd2f9 100644 --- a/qml/SidebarAdvanced.qml +++ b/qml/SidebarAdvanced.qml @@ -1,3 +1,3 @@ import UM 1.0 as UM -UM.SettingView{} \ No newline at end of file +UM.SettingView { } From 029fabc7918fcec477b6724368098556f28977c8 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Fri, 17 Apr 2015 15:44:44 +0200 Subject: [PATCH 2/4] Fix Cura sidebar to use Print Setup in header --- qml/SidebarHeader.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qml/SidebarHeader.qml b/qml/SidebarHeader.qml index 085fce6e77..9d4a103637 100644 --- a/qml/SidebarHeader.qml +++ b/qml/SidebarHeader.qml @@ -110,7 +110,7 @@ Column { height: UM.Theme.sizes.section.height; iconSource: UM.Theme.icons.printsetup; - text: qsTr("Setup"); + text: qsTr("Print Setup"); enabled: false; color: UM.Theme.colors.primary; From a751a137d9b8ddc84194affc2e4330e6c8f2f015 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Fri, 17 Apr 2015 18:30:22 +0200 Subject: [PATCH 3/4] Move the button text from PrinterButton to the style in Theme --- qml/PrinterButton.qml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/qml/PrinterButton.qml b/qml/PrinterButton.qml index 3c01a050f7..dfbbbe2984 100644 --- a/qml/PrinterButton.qml +++ b/qml/PrinterButton.qml @@ -8,22 +8,4 @@ import UM 1.0 as UM Button { id: base; style: UM.Theme.styles.tool_button; - - Rectangle { - anchors.bottom: parent.top; - - width: parent.width; - height: base.hovered ? label.height : 0; - Behavior on height { NumberAnimation { duration: 75; } } - - opacity: base.hovered ? 1.0 : 0.0; - Behavior on opacity { NumberAnimation { duration: 75; } } - - Label { - id: label - anchors.horizontalCenter: parent.horizontalCenter; - text: base.text; - font: UM.Theme.fonts.button_tooltip; - } - } } From da0d71fd94ca16865f04c9d54553822459368b39 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Fri, 17 Apr 2015 18:32:28 +0200 Subject: [PATCH 4/4] Add support for loading a custom QML panel to tools and PrinterToolbar This allows us to provide custom actions dependant on the active tool, like reset rotation or scale to max. --- qml/PrinterToolbar.qml | 55 ++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/qml/PrinterToolbar.qml b/qml/PrinterToolbar.qml index 04fbda0bf7..09af10b132 100644 --- a/qml/PrinterToolbar.qml +++ b/qml/PrinterToolbar.qml @@ -5,30 +5,53 @@ import QtQuick.Layouts 1.1 import UM 1.0 as UM -RowLayout { +Item { id: base; - spacing: UM.Theme.sizes.default_margin.width * 2; + width: buttons.width; + height: buttons.height + panel.height; - Repeater { - id: repeat + RowLayout { + id: buttons; - model: UM.Models.toolModel + anchors.bottom: parent.bottom; + anchors.left: parent.left; - PrinterButton { - text: model.name; - iconSource: UM.Theme.icons[model.icon]; - tooltip: model.description; + spacing: UM.Theme.sizes.default_margin.width * 2; - checkable: true; - checked: model.active; + Repeater { + id: repeat - //Workaround since using ToolButton's onClicked would break the binding of the checked property, instead - //just catch the click so we do not trigger that behaviour. - MouseArea { - anchors.fill: parent; - onClicked: parent.checked ? UM.Controller.setActiveTool(null) : UM.Controller.setActiveTool(model.id); + model: UM.Models.toolModel + + PrinterButton { + text: model.name; + iconSource: UM.Theme.icons[model.icon]; + tooltip: model.description; + + checkable: true; + checked: model.active; + + //Workaround since using ToolButton's onClicked would break the binding of the checked property, instead + //just catch the click so we do not trigger that behaviour. + MouseArea { + anchors.fill: parent; + onClicked: parent.checked ? UM.Controller.setActiveTool(null) : UM.Controller.setActiveTool(model.id); + } } } } + + Loader { + id: panel + + anchors.left: parent.left; + anchors.right: parent.right; + anchors.bottom: buttons.top; + anchors.bottomMargin: UM.Theme.sizes.default_margin.height; + + height: childrenRect.height; + + source: UM.ActiveTool.valid ? UM.ActiveTool.activeToolPanel : ""; + } }