Skip to content

Commit 9db20da

Browse files
committed
Add color swatch
Fixes #34
1 parent 744a13a commit 9db20da

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

resources/qml/MaterialBrandMenu.qml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ Cura.MenuItem
320320

321321
color: materialColorButton.containsMouse ? UM.Theme.getColor("background_2") : UM.Theme.getColor("background_1")
322322

323-
property int contentWidth: checkmark.width + colorLabel.width + UM.Theme.getSize("default_margin").width
323+
property int contentWidth: checkmark.width + swatch.width + colorLabel.width + 2 * UM.Theme.getSize("default_margin").width
324324

325325
Item
326326
{
@@ -341,12 +341,24 @@ Cura.MenuItem
341341
color: UM.Theme.getColor("setting_control_text")
342342
}
343343

344+
Rectangle
345+
{
346+
id: swatch
347+
color: model.color_code
348+
width: UM.Theme.getSize("icon_indicator").width
349+
height: UM.Theme.getSize("icon_indicator").height
350+
radius: width / 2
351+
anchors.left: parent.left
352+
anchors.leftMargin: UM.Theme.getSize("default_margin").width + UM.Theme.getSize("narrow_margin").width + UM.Theme.getSize("default_arrow").height
353+
anchors.verticalCenter: parent.verticalCenter
354+
}
355+
344356
UM.Label
345357
{
346358
id: colorLabel
347359
text: model.name
348-
anchors.left: parent.left
349-
anchors.leftMargin: UM.Theme.getSize("default_margin").width + UM.Theme.getSize("default_arrow").height
360+
anchors.left: swatch.right
361+
anchors.leftMargin: UM.Theme.getSize("narrow_margin").width
350362
anchors.verticalCenter: parent.verticalCenter
351363

352364
elide: Label.ElideRight

0 commit comments

Comments
 (0)