mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 05:59:01 +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 { }
|
||||
}
|
||||
|
||||
Button
|
||||
ComboBox
|
||||
{
|
||||
id: viewModeButton
|
||||
|
||||
anchors
|
||||
{
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
rightMargin: UM.Theme.getSize("sidebar").width + UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
text: catalog.i18nc("@action:button", "View Mode")
|
||||
iconSource: UM.Theme.getIcon("viewmode")
|
||||
style: UM.Theme.styles.combobox
|
||||
|
||||
style: UM.Theme.styles.tool_button
|
||||
tooltip: "";
|
||||
enabled: !PrintInformation.preSliced
|
||||
menu: ViewMenu { }
|
||||
model: UM.ViewModel { }
|
||||
textRole: "name"
|
||||
onCurrentIndexChanged:
|
||||
{
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user