mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 06:28:59 +08:00
Add background to viewModeSelection
CURA-5785
This commit is contained in:
parent
c9389dd9ab
commit
20e2f317de
@ -26,49 +26,56 @@ Item
|
|||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
spacing: UM.Theme.getSize("default_margin").width
|
spacing: UM.Theme.getSize("default_margin").width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
ComboBox
|
|
||||||
|
Rectangle
|
||||||
{
|
{
|
||||||
// This item contains the views selector, a combobox that is dynamically created from
|
color: UM.Theme.getColor("tool_panel_background")
|
||||||
// the list of available Views (packages that create different visualizations of the
|
width: viewModeButton.width + 2 * UM.Theme.getSize("default_margin").width
|
||||||
// scene).
|
height: parent.height
|
||||||
id: viewModeButton
|
ComboBox
|
||||||
|
|
||||||
style: UM.Theme.styles.combobox
|
|
||||||
|
|
||||||
model: UM.ViewModel { }
|
|
||||||
textRole: "name"
|
|
||||||
|
|
||||||
// update the model's active index
|
|
||||||
function updateItemActiveFlags()
|
|
||||||
{
|
{
|
||||||
currentIndex = getActiveIndex()
|
// This item contains the views selector, a combobox that is dynamically created from
|
||||||
for (var i = 0; i < model.rowCount(); i++)
|
// the list of available Views (packages that create different visualizations of the
|
||||||
{
|
// scene).
|
||||||
model.getItem(i).active = (i == currentIndex)
|
id: viewModeButton
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the index of the active model item on start
|
style: UM.Theme.styles.combobox
|
||||||
function getActiveIndex()
|
anchors.centerIn: parent
|
||||||
{
|
model: UM.ViewModel { }
|
||||||
for (var i = 0; i < model.rowCount(); i++)
|
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:
|
// get the index of the active model item on start
|
||||||
{
|
function getActiveIndex()
|
||||||
if (model.getItem(currentIndex).id != undefined)
|
|
||||||
{
|
{
|
||||||
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
|
Loader
|
||||||
|
Loading…
x
Reference in New Issue
Block a user