From 28a14c0a3b6eac0096551732ed73eb33514d5907 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Sat, 20 Apr 2019 00:15:42 +0200 Subject: [PATCH 01/13] Make expandable component dragable. --- resources/qml/ExpandableComponent.qml | 27 +++++++++++++++++++++ resources/qml/ExpandableComponentHeader.qml | 1 + 2 files changed, 28 insertions(+) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 025c63d754..595fe779b8 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -225,6 +225,33 @@ Item left: parent.left } + MouseArea + { + id: dragRegion + anchors + { + top: parent.top + bottom: parent.bottom + left: parent.left + right: contentHeader.xPosCloseButton + } + property variant clickPos: Qt.point(0, 0) + + onPressed: + { + clickPos = Qt.point(mouse.x, mouse.y); + } + + onPositionChanged: + { + var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y); + if (delta.x != 0 || delta.y != 0) + { + contentContainer.x += delta.x; + contentContainer.y += delta.y; + } + } + } } Control diff --git a/resources/qml/ExpandableComponentHeader.qml b/resources/qml/ExpandableComponentHeader.qml index 94066340e3..cd6ccfb825 100644 --- a/resources/qml/ExpandableComponentHeader.qml +++ b/resources/qml/ExpandableComponentHeader.qml @@ -13,6 +13,7 @@ Cura.RoundedRectangle id: header property alias headerTitle: headerLabel.text + property alias xPosCloseButton: closeButton.left height: UM.Theme.getSize("expandable_component_content_header").height color: UM.Theme.getColor("secondary") From 37fddaee5c0f31302e3acb377116731192e14f6b Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Mon, 22 Apr 2019 23:23:34 +0200 Subject: [PATCH 02/13] Limit draggable component to the main window. --- cura/CuraApplication.py | 10 ++++++++++ resources/qml/ExpandableComponent.qml | 12 +++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 9dd1168135..224ad81c32 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1782,3 +1782,13 @@ class CuraApplication(QtApplication): # Only show the what's new dialog if there's no machine and we have just upgraded show_whatsnew_only = has_active_machine and has_app_just_upgraded return show_whatsnew_only + + @pyqtSlot(result = int) + def appWidth(self) -> int: + main_window = cast(UM.Qt.Bindings.MainWindow, QtApplication.getInstance().getMainWindow()) + return main_window.width() + + @pyqtSlot(result = int) + def appHeight(self) -> int: + main_window = cast(UM.Qt.Bindings.MainWindow, QtApplication.getInstance().getMainWindow()) + return main_window.height() diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 595fe779b8..662dd1d6c4 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -245,10 +245,16 @@ Item onPositionChanged: { var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y); - if (delta.x != 0 || delta.y != 0) + if (delta.x !== 0 || delta.y !== 0) { - contentContainer.x += delta.x; - contentContainer.y += delta.y; + var minPt = base.mapFromItem(null, 0, 0); + var maxPt = base.mapFromItem(null, + CuraApplication.appWidth() - contentContainer.width, + CuraApplication.appHeight() - contentContainer.height); + var initialY = background.height + base.shadowOffset + base.contentSpacingY; + + contentContainer.x = Math.min(maxPt.x, Math.max(minPt.x, contentContainer.x + delta.x)); + contentContainer.y = Math.min(maxPt.y, Math.max(initialY, contentContainer.y + delta.y)); } } } From 78f15d8fcb0b95f0e5532cb58be02162b19b1140 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Mon, 22 Apr 2019 23:35:58 +0200 Subject: [PATCH 03/13] Margins to main window for draggable component. --- resources/qml/ExpandableComponent.qml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 662dd1d6c4..b30ef70189 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -247,11 +247,12 @@ Item var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y); if (delta.x !== 0 || delta.y !== 0) { - var minPt = base.mapFromItem(null, 0, 0); + var margin = UM.Theme.getSize("narrow_margin"); + var minPt = base.mapFromItem(null, margin.width, margin.height); var maxPt = base.mapFromItem(null, - CuraApplication.appWidth() - contentContainer.width, - CuraApplication.appHeight() - contentContainer.height); - var initialY = background.height + base.shadowOffset + base.contentSpacingY; + CuraApplication.appWidth() - (contentContainer.width + margin.width), + CuraApplication.appHeight() - (contentContainer.height + margin.width)); + var initialY = background.height + base.shadowOffset + margin.height; contentContainer.x = Math.min(maxPt.x, Math.max(minPt.x, contentContainer.x + delta.x)); contentContainer.y = Math.min(maxPt.y, Math.max(initialY, contentContainer.y + delta.y)); From 7382798b6a20a47a1edf18a1c37fd3e264ad5d3c Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Tue, 23 Apr 2019 14:33:42 +0200 Subject: [PATCH 04/13] Move setting the dragged-to position to its own function. [CURA-6478] --- resources/qml/ExpandableComponent.qml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index b30ef70189..0f2f30fe39 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -214,6 +214,19 @@ Item border.color: UM.Theme.getColor("lining") radius: UM.Theme.getSize("default_radius").width + function trySetPosition(posNewX, posNewY) + { + var margin = UM.Theme.getSize("narrow_margin"); + var minPt = base.mapFromItem(null, margin.width, margin.height); + var maxPt = base.mapFromItem(null, + CuraApplication.appWidth() - (contentContainer.width + margin.width), + CuraApplication.appHeight() - (contentContainer.height + margin.height)); + var initialY = background.height + base.shadowOffset + margin.height; + + contentContainer.x = Math.min(maxPt.x, Math.max(minPt.x, posNewX)); + contentContainer.y = Math.min(maxPt.y, Math.max(initialY, posNewY)); + } + ExpandableComponentHeader { id: contentHeader @@ -247,15 +260,7 @@ Item var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y); if (delta.x !== 0 || delta.y !== 0) { - var margin = UM.Theme.getSize("narrow_margin"); - var minPt = base.mapFromItem(null, margin.width, margin.height); - var maxPt = base.mapFromItem(null, - CuraApplication.appWidth() - (contentContainer.width + margin.width), - CuraApplication.appHeight() - (contentContainer.height + margin.width)); - var initialY = background.height + base.shadowOffset + margin.height; - - contentContainer.x = Math.min(maxPt.x, Math.max(minPt.x, contentContainer.x + delta.x)); - contentContainer.y = Math.min(maxPt.y, Math.max(initialY, contentContainer.y + delta.y)); + contentContainer.trySetPosition(contentContainer.x + delta.x, contentContainer.y + delta.y); } } } From 9283c3d32186ae205e06c424a57ea14bd9162a7d Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 25 Apr 2019 11:08:13 +0200 Subject: [PATCH 05/13] Add window-size handling to draggable component. [CURA-6478] --- resources/qml/ExpandableComponent.qml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 0f2f30fe39..ff40a80cab 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -263,6 +263,24 @@ Item contentContainer.trySetPosition(contentContainer.x + delta.x, contentContainer.y + delta.y); } } + + Connections + { + target: UM.Preferences + onPreferenceChanged: + { + if + ( + preference !== "general/window_height" && + preference !== "general/window_width" && + preference !== "general/window_state" + ) + { + return; + } + contentContainer.trySetPosition(contentContainer.x, contentContainer.y); + } + } } } From baac2d1a0fe737e93750f0d7e68461a329a43616 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 25 Apr 2019 13:33:31 +0200 Subject: [PATCH 06/13] Fix various expandable/dragable/window interactions. [CURA-6478] --- resources/qml/ExpandableComponent.qml | 14 ++++++++++---- .../PrintSetupSelectorContents.qml | 6 +++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index ff40a80cab..936b2e0b22 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -83,6 +83,11 @@ Item contentContainer.visible = !expanded } + function updateDragPosition() + { + contentContainer.trySetPosition(contentContainer.x, contentContainer.y); + } + // Add this binding since the background color is not updated otherwise Binding { @@ -102,7 +107,8 @@ Item { if (!base.enabled && expanded) { - toggleContent() + toggleContent(); + updateDragPosition(); } } } @@ -223,8 +229,8 @@ Item CuraApplication.appHeight() - (contentContainer.height + margin.height)); var initialY = background.height + base.shadowOffset + margin.height; - contentContainer.x = Math.min(maxPt.x, Math.max(minPt.x, posNewX)); - contentContainer.y = Math.min(maxPt.y, Math.max(initialY, posNewY)); + contentContainer.x = Math.max(minPt.x, Math.min(maxPt.x, posNewX)); + contentContainer.y = Math.max(initialY, Math.min(maxPt.y, posNewY)); } ExpandableComponentHeader @@ -248,7 +254,7 @@ Item left: parent.left right: contentHeader.xPosCloseButton } - property variant clickPos: Qt.point(0, 0) + property var clickPos: Qt.point(0, 0) onPressed: { diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index 7da0e92bb9..99dca6764b 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -143,7 +143,11 @@ Item iconSource: UM.Theme.getIcon("arrow_right") isIconOnRightSide: true visible: currentModeIndex == PrintSetupSelectorContents.Mode.Recommended - onClicked: currentModeIndex = PrintSetupSelectorContents.Mode.Custom + onClicked: + { + currentModeIndex = PrintSetupSelectorContents.Mode.Custom + updateDragPosition(); + } } //Invisible area at the bottom with which you can resize the panel. From 194f01f8408e62f65cba1845528e493fdbe3d03d Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 25 Apr 2019 14:50:29 +0200 Subject: [PATCH 07/13] Add preferences for draggable/expandable-component. [CURA-6478] --- cura/CuraApplication.py | 4 ++++ .../SimulationViewMenuComponent.qml | 2 ++ resources/qml/ExpandableComponent.qml | 20 +++++++++++++++++-- .../PrintSetupSelector/PrintSetupSelector.qml | 2 ++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 224ad81c32..4b945c2523 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -522,6 +522,10 @@ class CuraApplication(QtApplication): preferences.addPreference("cura/use_multi_build_plate", False) preferences.addPreference("view/settings_list_height", 400) preferences.addPreference("view/settings_visible", False) + preferences.addPreference("view/settings_xpos", 0) + preferences.addPreference("view/settings_ypos", 56) + preferences.addPreference("view/colorscheme_xpos", 0) + preferences.addPreference("view/colorscheme_ypos", 56) preferences.addPreference("cura/currency", "€") preferences.addPreference("cura/material_settings", "{}") diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index 6a035cc624..b94cf029f0 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -15,6 +15,8 @@ Cura.ExpandableComponent { id: base + dragPreferencesNamePrefix: "view/colorscheme" + contentHeaderTitle: catalog.i18nc("@label", "Color scheme") Connections diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 936b2e0b22..0eb27b97b2 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -78,6 +78,9 @@ Item property int shadowOffset: 2 + // Prefix used for the dragged position preferences. Preferences not used if empty. Don't translate! + property var dragPreferencesNamePrefix: "" + function toggleContent() { contentContainer.visible = !expanded @@ -202,17 +205,19 @@ Item Cura.RoundedRectangle { id: contentContainer + property string dragPreferencesNameX: "_xpos" + property string dragPreferencesNameY: "_ypos" visible: false width: childrenRect.width height: childrenRect.height // Ensure that the content is located directly below the headerItem - y: background.height + base.shadowOffset + base.contentSpacingY + y: dragPreferencesNamePrefix === "" ? (background.height + base.shadowOffset + base.contentSpacingY) : UM.Preferences.getValue(dragPreferencesNamePrefix + dragPreferencesNameY) // Make the content aligned with the rest, using the property contentAlignment to decide whether is right or left. // In case of right alignment, the 3x padding is due to left, right and padding between the button & text. - x: contentAlignment == ExpandableComponent.ContentAlignment.AlignRight ? -width + collapseButton.width + headerItemLoader.width + 3 * background.padding : 0 + x: dragPreferencesNamePrefix === "" ? (contentAlignment == ExpandableComponent.ContentAlignment.AlignRight ? -width + collapseButton.width + headerItemLoader.width + 3 * background.padding : 0) : UM.Preferences.getValue(dragPreferencesNamePrefix + dragPreferencesNameX) cornerSide: Cura.RoundedRectangle.Direction.All color: contentBackgroundColor @@ -231,6 +236,12 @@ Item contentContainer.x = Math.max(minPt.x, Math.min(maxPt.x, posNewX)); contentContainer.y = Math.max(initialY, Math.min(maxPt.y, posNewY)); + + if (dragPreferencesNamePrefix !== "") + { + UM.Preferences.setValue(dragPreferencesNamePrefix + dragPreferencesNameX, contentContainer.x); + UM.Preferences.setValue(dragPreferencesNamePrefix + dragPreferencesNameY, contentContainer.y); + } } ExpandableComponentHeader @@ -309,6 +320,11 @@ Item } } + Component.onCompleted: + { + updateDragPosition(); + } + // DO NOT MOVE UP IN THE CODE: This connection has to be here, after the definition of the content item. // Apparently the order in which these are handled matters and so the height is correctly updated if this is here. Connections diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml index 48b6d191c2..1a9bd9f109 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml @@ -11,6 +11,8 @@ Cura.ExpandableComponent { id: printSetupSelector + dragPreferencesNamePrefix: "view/settings" + property bool preSlicedData: PrintInformation.preSliced contentPadding: UM.Theme.getSize("default_lining").width From bd262ca6c41a09210ca1ad0767d55733a3cea939 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 25 Apr 2019 15:37:52 +0200 Subject: [PATCH 08/13] Set min.-height and 'stage-awareness' for print-setup-UI. [CURA-6478] --- resources/qml/ExpandableComponent.qml | 17 ++++++++++++++++- .../PrintSetupSelector/PrintSetupSelector.qml | 1 + .../PrintSetupSelectorContents.qml | 14 +++++++++++--- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 0eb27b97b2..b22d19d3e1 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -79,7 +79,10 @@ Item property int shadowOffset: 2 // Prefix used for the dragged position preferences. Preferences not used if empty. Don't translate! - property var dragPreferencesNamePrefix: "" + property string dragPreferencesNamePrefix: "" + + // Whether this component can remain when switchin from one stage to the other (for ex. 'Prepare' to 'Preview') + property bool isMultiStage: false function toggleContent() { @@ -325,6 +328,18 @@ Item updateDragPosition(); } + Connections + { + target: UM.Controller + onActiveStageChanged: + { + if (isMultiStage) + { + updateDragPosition(); + } + } + } + // DO NOT MOVE UP IN THE CODE: This connection has to be here, after the definition of the content item. // Apparently the order in which these are handled matters and so the height is correctly updated if this is here. Connections diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml index 1a9bd9f109..5b22ed3393 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml @@ -12,6 +12,7 @@ Cura.ExpandableComponent id: printSetupSelector dragPreferencesNamePrefix: "view/settings" + isMultiStage: true property bool preSlicedData: PrintInformation.preSliced diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index 99dca6764b..3b090f7476 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -14,6 +14,8 @@ Item { id: content + property int absoluteMinimumHeight: 200 * screenScaleFactor + width: UM.Theme.getSize("print_setup_widget").width - 2 * UM.Theme.getSize("default_margin").width height: contents.height + buttonRow.height @@ -86,8 +88,14 @@ Item Math.min ( UM.Preferences.getValue("view/settings_list_height"), - base.height - (customPrintSetup.mapToItem(null, 0, 0).y + buttonRow.height + UM.Theme.getSize("default_margin").height) + Math.max + ( + absoluteMinimumHeight, + base.height - (customPrintSetup.mapToItem(null, 0, 0).y + buttonRow.height + UM.Theme.getSize("default_margin").height) + ) ); + + updateDragPosition(); } } visible: currentModeIndex == PrintSetupSelectorContents.Mode.Custom @@ -175,9 +183,9 @@ Item // position of mouse relative to dropdown align vertical centre of mouse area to cursor // v------------------------------v v------------v var h = mouseY + buttonRow.y + content.y - height / 2 | 0; - if(h < 200 * screenScaleFactor) //Enforce a minimum size. + if(h < absoluteMinimumHeight) //Enforce a minimum size. { - h = 200 * screenScaleFactor; + h = absoluteMinimumHeight; } //Absolute mouse Y position in the window, to prevent it from going outside the window. From c4265c1f670cc8076e78268720066e946b2439d6 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 25 Apr 2019 21:50:24 +0200 Subject: [PATCH 09/13] Scale instead of center for preview/prepare-menus. [CURA-6478] --- plugins/PrepareStage/PrepareMenu.qml | 12 ++++++++-- plugins/PreviewStage/PreviewMenu.qml | 23 +++++++++++++------ resources/qml/ExpandableComponent.qml | 15 ------------ .../PrintSetupSelector/PrintSetupSelector.qml | 1 - 4 files changed, 26 insertions(+), 25 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index d8953d7661..87d7c5f35c 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -20,11 +20,19 @@ Item name: "cura" } + anchors + { + left: parent.left + right: parent.right + leftMargin: UM.Theme.getSize("wide_margin").width + rightMargin: UM.Theme.getSize("wide_margin").width + } + // Item to ensure that all of the buttons are nicely centered. Item { anchors.horizontalCenter: parent.horizontalCenter - width: openFileButton.width + itemRow.width + UM.Theme.getSize("default_margin").width + width: parent.width - 2 * UM.Theme.getSize("wide_margin").width height: parent.height RowLayout @@ -32,9 +40,9 @@ Item id: itemRow anchors.left: openFileButton.right + anchors.right: parent.right anchors.leftMargin: UM.Theme.getSize("default_margin").width - width: Math.round(0.9 * prepareMenu.width) height: parent.height spacing: 0 diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index 62f814aac9..1a8be9815b 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -20,15 +20,24 @@ Item name: "cura" } + anchors + { + left: parent.left + right: parent.right + leftMargin: UM.Theme.getSize("wide_margin").width + rightMargin: UM.Theme.getSize("wide_margin").width + } + Row { id: stageMenuRow - anchors.centerIn: parent - height: parent.height - width: childrenRect.width - // We want this row to have a preferred with equals to the 85% of the parent - property int preferredWidth: Math.round(0.85 * previewMenu.width) + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width - 2 * UM.Theme.getSize("wide_margin").width + height: parent.height + + // // We want this row to have a preferred with up to the 85% of the parent + // property int preferredWidth: Math.round(0.85 * previewMenu.width) Cura.ViewsSelector { @@ -49,12 +58,12 @@ Item color: UM.Theme.getColor("lining") } - // This component will grow freely up to complete the preferredWidth of the row. + // This component will grow freely up to complete the width of the row. Loader { id: viewPanel height: parent.height - width: source != "" ? (stageMenuRow.preferredWidth - viewsSelector.width - printSetupSelectorItem.width - 2 * UM.Theme.getSize("default_lining").width) : 0 + width: source != "" ? (previewMenu.width - viewsSelector.width - printSetupSelectorItem.width - 2 * (UM.Theme.getSize("wide_margin").width + UM.Theme.getSize("default_lining").width)) : 0 source: UM.Controller.activeView != null && UM.Controller.activeView.stageMenuComponent != null ? UM.Controller.activeView.stageMenuComponent : "" } diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index b22d19d3e1..4bb1b51a83 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -81,9 +81,6 @@ Item // Prefix used for the dragged position preferences. Preferences not used if empty. Don't translate! property string dragPreferencesNamePrefix: "" - // Whether this component can remain when switchin from one stage to the other (for ex. 'Prepare' to 'Preview') - property bool isMultiStage: false - function toggleContent() { contentContainer.visible = !expanded @@ -328,18 +325,6 @@ Item updateDragPosition(); } - Connections - { - target: UM.Controller - onActiveStageChanged: - { - if (isMultiStage) - { - updateDragPosition(); - } - } - } - // DO NOT MOVE UP IN THE CODE: This connection has to be here, after the definition of the content item. // Apparently the order in which these are handled matters and so the height is correctly updated if this is here. Connections diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml index 5b22ed3393..1a9bd9f109 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml @@ -12,7 +12,6 @@ Cura.ExpandableComponent id: printSetupSelector dragPreferencesNamePrefix: "view/settings" - isMultiStage: true property bool preSlicedData: PrintInformation.preSliced From ac67e1a3a976cd45e20ab402993375bb40e1e27c Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 25 Apr 2019 22:08:25 +0200 Subject: [PATCH 10/13] Make expandable component preferences load again. [CURA-6478] --- resources/qml/ExpandableComponent.qml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 4bb1b51a83..d5c1736cd5 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -320,11 +320,6 @@ Item } } - Component.onCompleted: - { - updateDragPosition(); - } - // DO NOT MOVE UP IN THE CODE: This connection has to be here, after the definition of the content item. // Apparently the order in which these are handled matters and so the height is correctly updated if this is here. Connections From 77d8095208cf425fb83773d44e477a7f3b506965 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 25 Apr 2019 22:26:51 +0200 Subject: [PATCH 11/13] Home/dock expandable-draggable on double-click. [CURA-6478] --- resources/qml/ExpandableComponent.qml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index d5c1736cd5..53f9f85341 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -281,6 +281,11 @@ Item } } + onDoubleClicked: + { + contentContainer.trySetPosition(0, 0); + } + Connections { target: UM.Preferences From c3a9ceaa18e3b8d08ec5129af77c6616a8d4a826 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 25 Apr 2019 22:42:52 +0200 Subject: [PATCH 12/13] Remove a line of commented-out code. [CURA-6478] --- plugins/PreviewStage/PreviewMenu.qml | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index 1a8be9815b..ff1ccff75f 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -36,9 +36,6 @@ Item width: parent.width - 2 * UM.Theme.getSize("wide_margin").width height: parent.height - // // We want this row to have a preferred with up to the 85% of the parent - // property int preferredWidth: Math.round(0.85 * previewMenu.width) - Cura.ViewsSelector { id: viewsSelector From ad9fc62ff548edb2d59f02f8793d1c5b4ece33eb Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 25 Apr 2019 23:05:52 +0200 Subject: [PATCH 13/13] Fix typing. [CURA-6478] --- cura/CuraApplication.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 4b945c2523..ebe97bb0f2 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -23,6 +23,7 @@ from UM.Platform import Platform from UM.PluginError import PluginNotFoundError from UM.Resources import Resources from UM.Preferences import Preferences +from UM.Qt.Bindings import MainWindow from UM.Qt.QtApplication import QtApplication # The class we're inheriting from. import UM.Util from UM.View.SelectionPass import SelectionPass # For typing. @@ -1789,10 +1790,16 @@ class CuraApplication(QtApplication): @pyqtSlot(result = int) def appWidth(self) -> int: - main_window = cast(UM.Qt.Bindings.MainWindow, QtApplication.getInstance().getMainWindow()) - return main_window.width() + main_window = QtApplication.getInstance().getMainWindow() + if main_window: + return main_window.width() + else: + return 0 @pyqtSlot(result = int) def appHeight(self) -> int: - main_window = cast(UM.Qt.Bindings.MainWindow, QtApplication.getInstance().getMainWindow()) - return main_window.height() + main_window = QtApplication.getInstance().getMainWindow() + if main_window: + return main_window.height() + else: + return 0