Browse Source

Use the MouseArea trick to assure that the binding still works for the
checked property of the button.

Contributes to CURA-6028.

Diego Prado Gesto 6 years ago
parent
commit
012ee0c02a
2 changed files with 7 additions and 4 deletions
  1. 7 1
      resources/qml/MainWindow/MainWindowHeader.qml
  2. 0 3
      resources/qml/ViewsSelector.qml

+ 7 - 1
resources/qml/MainWindow/MainWindowHeader.qml

@@ -60,11 +60,17 @@ Item
                 exclusiveGroup: mainWindowHeaderMenuGroup
                 style: UM.Theme.styles.main_window_header_tab
                 height: UM.Theme.getSize("main_window_header_button").height
-                onClicked: UM.Controller.setActiveStage(model.id)
                 iconSource: model.stage.iconSource
 
                 property color overlayColor: "transparent"
                 property string overlayIconSource: ""
+
+                // This is a trick to assure the activeStage is correctly changed. It doesn't work propertly if done in the onClicked (see CURA-6028)
+                MouseArea
+                {
+                    anchors.fill: parent
+                    onClicked: UM.Controller.setActiveStage(model.id)
+                }
             }
         }
 

+ 0 - 3
resources/qml/ViewsSelector.qml

@@ -19,14 +19,12 @@ Cura.ExpandablePopup
         onDataChanged: updateActiveView()
     }
 
-
     property var activeView: null
 
     function updateActiveView()
     {
         for (var index in viewModel.items)
         {
-
             if (viewModel.items[index].active)
             {
                 activeView = viewModel.items[index]
@@ -38,7 +36,6 @@ Cura.ExpandablePopup
 
     Component.onCompleted:
     {
-        updateActiveView()
         if (activeView == null)
         {
             UM.Controller.setActiveView(viewModel.getItem(0).id)