Add extruder button bar that shows icons for each extruder in a horizontal row 💪

Make ExtruderButton more generic by moving functionality out.

Remove background color from ToolbarButton and add that background color to the Toolbar.qml.

Fix Toolbar border being created by overlapping rectangles instead of using border

Add scaling options for ToolBarButtons icon

CURA-9793
This commit is contained in:
Joey de l'Arago 2022-11-28 15:55:55 +01:00
parent 30d886cfcd
commit 631d6a15b0
6 changed files with 70 additions and 18 deletions

View file

@ -5,7 +5,7 @@ import QtQuick 2.2
import QtQuick.Controls 2.3
import UM 1.5 as UM
import Cura 1.0 as Cura
import Cura 1.7 as Cura
Item
{
@ -29,13 +29,13 @@ Item
anchors
{
fill: toolButtons
leftMargin: -radius - border.width
rightMargin: -border.width
topMargin: -border.width
bottomMargin: -border.width
leftMargin: -radius - border.width // Removes border on left side
}
radius: UM.Theme.getSize("default_radius").width
color: UM.Theme.getColor("lining")
color: UM.Theme.getColor("toolbar_background")
border.color: UM.Theme.getColor("lining")
border.width: UM.Theme.getSize("default_lining").width
}
Column
@ -111,13 +111,12 @@ Item
anchors
{
fill: extruderButtons
leftMargin: -radius - border.width
rightMargin: -border.width
topMargin: -border.width
bottomMargin: -border.width
leftMargin: -radius - border.width // Removes border on left side
}
radius: UM.Theme.getSize("default_radius").width
color: UM.Theme.getColor("lining")
color: UM.Theme.getColor("toolbar_background")
border.color: UM.Theme.getColor("lining")
border.width: UM.Theme.getSize("default_lining").width
visible: extrudersModel.items.length > 1
}
@ -135,11 +134,20 @@ Item
height: childrenRect.height
model: extrudersModel.items.length > 1 ? extrudersModel : 0
delegate: ExtruderButton
delegate: Cura.ExtruderButton
{
extruder: model
isTopElement: extrudersModel.getItem(0).id == model.id
isBottomElement: extrudersModel.getItem(extrudersModel.rowCount() - 1).id == model.id
text: catalog.i18ncp("@label %1 is filled in with the name of an extruder", "Print Selected Model with %1", "Print Selected Models with %1", UM.Selection.selectionCount).arg(extruder.name)
checked: Cura.ExtruderManager.selectedObjectExtruders.indexOf(extruder.id) != -1
enabled: UM.Selection.hasSelection && extruder.stack.isEnabled
onClicked:
{
forceActiveFocus() //First grab focus, so all the text fields are updated
CuraActions.setExtruderForSelection(extruder.id)
}
}
}
}