mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 17:59:00 +08:00
Change LayView Mode button to a dropdown
CURA-4212
This commit is contained in:
parent
750f1ce158
commit
c59bd6cc09
@ -197,23 +197,40 @@ Rectangle
|
|||||||
menu: PrinterMenu { }
|
menu: PrinterMenu { }
|
||||||
}
|
}
|
||||||
|
|
||||||
Button
|
ComboBox
|
||||||
{
|
{
|
||||||
id: viewModeButton
|
id: viewModeButton
|
||||||
|
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
right: parent.right
|
right: parent.right
|
||||||
rightMargin: UM.Theme.getSize("sidebar").width + UM.Theme.getSize("default_margin").width
|
rightMargin: UM.Theme.getSize("sidebar").width + UM.Theme.getSize("default_margin").width
|
||||||
}
|
}
|
||||||
text: catalog.i18nc("@action:button", "View Mode")
|
style: UM.Theme.styles.combobox
|
||||||
iconSource: UM.Theme.getIcon("viewmode")
|
|
||||||
|
|
||||||
style: UM.Theme.styles.tool_button
|
model: UM.ViewModel { }
|
||||||
tooltip: "";
|
textRole: "name"
|
||||||
enabled: !PrintInformation.preSliced
|
onCurrentIndexChanged:
|
||||||
menu: ViewMenu { }
|
{
|
||||||
|
UM.Controller.setActiveView(model.getItem(currentIndex).id);
|
||||||
|
// Update the active flag
|
||||||
|
for (var i = 0; i < model.rowCount; ++i)
|
||||||
|
{
|
||||||
|
const is_active = i == currentIndex;
|
||||||
|
model.getItem(i).active = is_active;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
currentIndex:
|
||||||
|
{
|
||||||
|
for (var i = 0; i < model.rowCount; ++i)
|
||||||
|
{
|
||||||
|
if (model.getItem(i).active)
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader
|
Loader
|
||||||
|
Loading…
x
Reference in New Issue
Block a user