Browse Source

Add background to viewModeSelection

CURA-5785
Jaime van Kessel 6 years ago
parent
commit
20e2f317de
1 changed files with 37 additions and 30 deletions
  1. 37 30
      plugins/PreviewStage/PreviewMenu.qml

+ 37 - 30
plugins/PreviewStage/PreviewMenu.qml

@@ -26,49 +26,56 @@ Item
         anchors.horizontalCenter: parent.horizontalCenter
         spacing: UM.Theme.getSize("default_margin").width
         height: parent.height
-        ComboBox
-        {
-            // This item contains the views selector, a combobox that is dynamically created from
-            // the list of available Views (packages that create different visualizations of the
-            // scene).
-            id: viewModeButton
-
-            style: UM.Theme.styles.combobox
 
-            model: UM.ViewModel { }
-            textRole: "name"
-
-            // update the model's active index
-            function updateItemActiveFlags()
+        Rectangle
+        {
+            color: UM.Theme.getColor("tool_panel_background")
+            width: viewModeButton.width + 2 * UM.Theme.getSize("default_margin").width
+            height: parent.height
+            ComboBox
             {
-                currentIndex = getActiveIndex()
-                for (var i = 0; i < model.rowCount(); i++)
+                // This item contains the views selector, a combobox that is dynamically created from
+                // the list of available Views (packages that create different visualizations of the
+                // scene).
+                id: viewModeButton
+
+                style: UM.Theme.styles.combobox
+                anchors.centerIn: parent
+                model: UM.ViewModel { }
+                textRole: "name"
+
+                // update the model's active index
+                function updateItemActiveFlags()
                 {
-                    model.getItem(i).active = (i == currentIndex)
+                    currentIndex = getActiveIndex()
+                    for (var i = 0; i < model.rowCount(); i++)
+                    {
+                        model.getItem(i).active = (i == currentIndex)
+                    }
                 }
-            }
 
-            // get the index of the active model item on start
-            function getActiveIndex()
-            {
-                for (var i = 0; i < model.rowCount(); i++)
+                // get the index of the active model item on start
+                function getActiveIndex()
                 {
-                    if (model.getItem(i).active)
+                    for (var i = 0; i < model.rowCount(); i++)
                     {
-                        return i;
+                        if (model.getItem(i).active)
+                        {
+                            return i;
+                        }
                     }
+                    return 0
                 }
-                return 0
-            }
 
-            onCurrentIndexChanged:
-            {
-                if (model.getItem(currentIndex).id != undefined)
+                onCurrentIndexChanged:
                 {
-                    UM.Controller.setActiveView(model.getItem(currentIndex).id)
+                    if (model.getItem(currentIndex).id != undefined)
+                    {
+                        UM.Controller.setActiveView(model.getItem(currentIndex).id)
+                    }
                 }
+                currentIndex: getActiveIndex()
             }
-            currentIndex: getActiveIndex()
         }
 
         Loader