From 20e2f317de0507ec889baa5dc30cf48277165bdb Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 13 Nov 2018 16:02:45 +0100 Subject: [PATCH] Add background to viewModeSelection CURA-5785 --- plugins/PreviewStage/PreviewMenu.qml | 71 +++++++++++++++------------- 1 file changed, 39 insertions(+), 32 deletions(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index aeef2bf300..f21c13a5bc 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -26,49 +26,56 @@ Item anchors.horizontalCenter: parent.horizontalCenter spacing: UM.Theme.getSize("default_margin").width height: parent.height - ComboBox + + Rectangle { - // 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() + 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++) - { - model.getItem(i).active = (i == currentIndex) - } - } + // 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 - // get the index of the active model item on start - function getActiveIndex() - { - for (var i = 0; i < model.rowCount(); i++) + style: UM.Theme.styles.combobox + anchors.centerIn: parent + model: UM.ViewModel { } + textRole: "name" + + // update the model's active index + function updateItemActiveFlags() { - if (model.getItem(i).active) + currentIndex = getActiveIndex() + for (var i = 0; i < model.rowCount(); i++) { - return i; + model.getItem(i).active = (i == currentIndex) } } - return 0 - } - onCurrentIndexChanged: - { - if (model.getItem(currentIndex).id != undefined) + // get the index of the active model item on start + function getActiveIndex() { - UM.Controller.setActiveView(model.getItem(currentIndex).id) + for (var i = 0; i < model.rowCount(); i++) + { + if (model.getItem(i).active) + { + return i; + } + } + return 0 } + + onCurrentIndexChanged: + { + if (model.getItem(currentIndex).id != undefined) + { + UM.Controller.setActiveView(model.getItem(currentIndex).id) + } + } + currentIndex: getActiveIndex() } - currentIndex: getActiveIndex() } Loader