From 428dfeaed751a07cdeba69930c3a02c2671c0fbc Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 24 Jan 2018 16:08:56 +0100 Subject: [PATCH 1/5] Add combobox popup styling --- resources/qml/Settings/SettingComboBox.qml | 31 ++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/resources/qml/Settings/SettingComboBox.qml b/resources/qml/Settings/SettingComboBox.qml index 63d13ae514..e6ded2c788 100644 --- a/resources/qml/Settings/SettingComboBox.qml +++ b/resources/qml/Settings/SettingComboBox.qml @@ -86,13 +86,34 @@ SettingItem verticalAlignment: Text.AlignVCenter } + popup: Popup { + y: control.height - UM.Theme.getSize("default_lining").height + width: control.width + implicitHeight: contentItem.implicitHeight + padding: UM.Theme.getSize("default_lining").width + + contentItem: ListView { + clip: true + implicitHeight: contentHeight + model: control.popup.visible ? control.delegateModel : null + currentIndex: control.highlightedIndex + + ScrollIndicator.vertical: ScrollIndicator { } + } + + background: Rectangle { + color: UM.Theme.getColor("setting_control") + border.color: UM.Theme.getColor("setting_control_border") + } + } + delegate: ItemDelegate { - width: control.width + width: control.width - 2 * UM.Theme.getSize("default_lining").width height: control.height highlighted: control.highlightedIndex == index - contentItem: Text + contentItem: Label { text: modelData.value color: control.contentItem.color @@ -100,6 +121,12 @@ SettingItem elide: Text.ElideRight verticalAlignment: Text.AlignVCenter } + + background: Rectangle + { + color: parent.highlighted ? UM.Theme.getColor("setting_control_highlight") : "transparent" + border.color: parent.highlighted ? UM.Theme.getColor("setting_control_border_highlight") : "transparent" + } } onActivated: From 19e74a2d45e29493c8d10eee6840c069bb67b18d Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 24 Jan 2018 16:29:36 +0100 Subject: [PATCH 2/5] Add extruder combobox popup styling --- resources/qml/Settings/SettingExtruder.qml | 61 +++++++++++++++------- 1 file changed, 42 insertions(+), 19 deletions(-) diff --git a/resources/qml/Settings/SettingExtruder.qml b/resources/qml/Settings/SettingExtruder.qml index b754c3fd74..9d968664ea 100644 --- a/resources/qml/Settings/SettingExtruder.qml +++ b/resources/qml/Settings/SettingExtruder.qml @@ -108,33 +108,28 @@ SettingItem } } - contentItem: Item + contentItem: Label { - Label - { - id: extruderText + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width + anchors.right: downArrow.left + rightPadding: swatch.width + UM.Theme.getSize("setting_unit_margin").width - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width - anchors.right: swatch.left + text: control.currentText + font: UM.Theme.getFont("default") + color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") - text: control.currentText - font: UM.Theme.getFont("default") - color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") + elide: Text.ElideLeft + verticalAlignment: Text.AlignVCenter - elide: Text.ElideLeft - verticalAlignment: Text.AlignVCenter - } - - Rectangle + background: Rectangle { id: swatch height: UM.Theme.getSize("setting_control").height / 2 width: height anchors.right: parent.right - anchors.rightMargin: downArrow.width + UM.Theme.getSize("setting_unit_margin").width anchors.verticalCenter: parent.verticalCenter anchors.margins: UM.Theme.getSize("default_margin").width / 4 @@ -146,13 +141,35 @@ SettingItem } } + + popup: Popup { + y: control.height - UM.Theme.getSize("default_lining").height + width: control.width + implicitHeight: contentItem.implicitHeight + padding: UM.Theme.getSize("default_lining").width + + contentItem: ListView { + clip: true + implicitHeight: contentHeight + model: control.popup.visible ? control.delegateModel : null + currentIndex: control.highlightedIndex + + ScrollIndicator.vertical: ScrollIndicator { } + } + + background: Rectangle { + color: UM.Theme.getColor("setting_control") + border.color: UM.Theme.getColor("setting_control_border") + } + } + delegate: ItemDelegate { - width: control.width + width: control.width - 2 * UM.Theme.getSize("default_lining").width height: control.height highlighted: control.highlightedIndex == index - contentItem: Text + contentItem: Label { text: model.name color: UM.Theme.getColor("setting_control_text") @@ -160,6 +177,12 @@ SettingItem elide: Text.ElideRight verticalAlignment: Text.AlignVCenter } + + background: Rectangle + { + color: parent.highlighted ? UM.Theme.getColor("setting_control_highlight") : "transparent" + border.color: parent.highlighted ? UM.Theme.getColor("setting_control_border_highlight") : "transparent" + } } } } From 6480926869e214544cabe32f312e8764a9381d91 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 24 Jan 2018 16:44:15 +0100 Subject: [PATCH 3/5] Add swatches in extruder dropdown --- resources/qml/Settings/SettingExtruder.qml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/resources/qml/Settings/SettingExtruder.qml b/resources/qml/Settings/SettingExtruder.qml index 9d968664ea..b86a69b087 100644 --- a/resources/qml/Settings/SettingExtruder.qml +++ b/resources/qml/Settings/SettingExtruder.qml @@ -141,7 +141,6 @@ SettingItem } } - popup: Popup { y: control.height - UM.Theme.getSize("default_lining").height width: control.width @@ -176,6 +175,24 @@ SettingItem font: UM.Theme.getFont("default") elide: Text.ElideRight verticalAlignment: Text.AlignVCenter + rightPadding: swatch.width + UM.Theme.getSize("setting_unit_margin").width + + background: Rectangle + { + id: swatch + height: UM.Theme.getSize("setting_control").height / 2 + width: height + + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.margins: UM.Theme.getSize("default_margin").width / 4 + + border.width: UM.Theme.getSize("default_lining").width + border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border") + radius: width / 2 + + color: control.model.getItem(index).color + } } background: Rectangle From 1a56eae1869d833c2cc1d162d959c64014978b56 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 24 Jan 2018 16:46:53 +0100 Subject: [PATCH 4/5] Bring SettingOptionalExtruder up to speed --- .../qml/Settings/SettingOptionalExtruder.qml | 78 ++++++++++++++----- 1 file changed, 59 insertions(+), 19 deletions(-) diff --git a/resources/qml/Settings/SettingOptionalExtruder.qml b/resources/qml/Settings/SettingOptionalExtruder.qml index 3bb2a2f1e0..aaec906b76 100644 --- a/resources/qml/Settings/SettingOptionalExtruder.qml +++ b/resources/qml/Settings/SettingOptionalExtruder.qml @@ -127,33 +127,28 @@ SettingItem } } - contentItem: Item + contentItem: Label { - Label - { - id: extruderText + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width + anchors.right: downArrow.left + rightPadding: swatch.width + UM.Theme.getSize("setting_unit_margin").width - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width - anchors.right: swatch.left + text: control.currentText + font: UM.Theme.getFont("default") + color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") - text: control.currentText - font: UM.Theme.getFont("default") - color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - } - - Rectangle + background: Rectangle { id: swatch height: UM.Theme.getSize("setting_control").height / 2 width: height anchors.right: parent.right - anchors.rightMargin: downArrow.width + UM.Theme.getSize("setting_unit_margin").width anchors.verticalCenter: parent.verticalCenter anchors.margins: UM.Theme.getSize("default_margin").width / 4 @@ -165,19 +160,64 @@ SettingItem } } + popup: Popup { + y: control.height - UM.Theme.getSize("default_lining").height + width: control.width + implicitHeight: contentItem.implicitHeight + padding: UM.Theme.getSize("default_lining").width + + contentItem: ListView { + clip: true + implicitHeight: contentHeight + model: control.popup.visible ? control.delegateModel : null + currentIndex: control.highlightedIndex + + ScrollIndicator.vertical: ScrollIndicator { } + } + + background: Rectangle { + color: UM.Theme.getColor("setting_control") + border.color: UM.Theme.getColor("setting_control_border") + } + } + delegate: ItemDelegate { - width: control.width + width: control.width - 2 * UM.Theme.getSize("default_lining").width height: control.height highlighted: control.highlightedIndex == index - contentItem: Text + contentItem: Label { text: model.name color: UM.Theme.getColor("setting_control_text") font: UM.Theme.getFont("default") elide: Text.ElideRight verticalAlignment: Text.AlignVCenter + rightPadding: swatch.width + UM.Theme.getSize("setting_unit_margin").width + + background: Rectangle + { + id: swatch + height: UM.Theme.getSize("setting_control").height / 2 + width: height + + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.margins: UM.Theme.getSize("default_margin").width / 4 + + border.width: UM.Theme.getSize("default_lining").width + border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border") + radius: width / 2 + + color: control.model.getItem(index).color + } + } + + background: Rectangle + { + color: parent.highlighted ? UM.Theme.getColor("setting_control_highlight") : "transparent" + border.color: parent.highlighted ? UM.Theme.getColor("setting_control_border_highlight") : "transparent" } } } From a1adce298e76a8c130fcd10a24aee51b4f051744 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 24 Jan 2018 16:56:53 +0100 Subject: [PATCH 5/5] Add color to "recommended"/"custom" button texts --- resources/qml/Sidebar.qml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index d12515c004..a16894a33f 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -214,6 +214,18 @@ Rectangle horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight + color: + { + if(control.pressed) + { + return UM.Theme.getColor("action_button_active_text"); + } + else if(control.hovered) + { + return UM.Theme.getColor("action_button_hovered_text"); + } + return UM.Theme.getColor("action_button_text"); + } } } }