diff --git a/plugins/DigitalLibrary/resources/qml/CreateNewProjectPopup.qml b/plugins/DigitalLibrary/resources/qml/CreateNewProjectPopup.qml index ee40c55356..74bc52b69e 100644 --- a/plugins/DigitalLibrary/resources/qml/CreateNewProjectPopup.qml +++ b/plugins/DigitalLibrary/resources/qml/CreateNewProjectPopup.qml @@ -1,8 +1,8 @@ -// Copyright (C) 2021 Ultimaker B.V. +//Copyright (C) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 import QtQuick.Window 2.2 -import QtQuick.Controls 1.4 as OldControls // TableView doesn't exist in the QtQuick Controls 2.x in 5.10, so use the old one import QtQuick.Controls 2.3 import UM 1.2 as UM diff --git a/plugins/DigitalLibrary/resources/qml/DigitalFactoryOpenDialog.qml b/plugins/DigitalLibrary/resources/qml/DigitalFactoryOpenDialog.qml index 435e8d3f86..11c5d687e8 100644 --- a/plugins/DigitalLibrary/resources/qml/DigitalFactoryOpenDialog.qml +++ b/plugins/DigitalLibrary/resources/qml/DigitalFactoryOpenDialog.qml @@ -1,8 +1,8 @@ -// Copyright (C) 2021 Ultimaker B.V. +//Copyright (C) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 import QtQuick.Window 2.2 -import QtQuick.Controls 1.4 as OldControls // TableView doesn't exist in the QtQuick Controls 2.x in 5.10, so use the old one import QtQuick.Controls 2.3 import UM 1.2 as UM diff --git a/plugins/DigitalLibrary/resources/qml/DigitalFactorySaveDialog.qml b/plugins/DigitalLibrary/resources/qml/DigitalFactorySaveDialog.qml index 5271db3174..56109dbcbe 100644 --- a/plugins/DigitalLibrary/resources/qml/DigitalFactorySaveDialog.qml +++ b/plugins/DigitalLibrary/resources/qml/DigitalFactorySaveDialog.qml @@ -1,8 +1,8 @@ -// Copyright (C) 2021 Ultimaker B.V. +//Copyright (C) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 import QtQuick.Window 2.2 -import QtQuick.Controls 1.4 as OldControls // TableView doesn't exist in the QtQuick Controls 2.x in 5.10, so use the old one import QtQuick.Controls 2.3 import UM 1.2 as UM diff --git a/plugins/DigitalLibrary/resources/qml/SelectProjectPage.qml b/plugins/DigitalLibrary/resources/qml/SelectProjectPage.qml index 25f25e2bbe..1e4b97fb33 100644 --- a/plugins/DigitalLibrary/resources/qml/SelectProjectPage.qml +++ b/plugins/DigitalLibrary/resources/qml/SelectProjectPage.qml @@ -1,9 +1,8 @@ -// Copyright (C) 2021 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. +//Copyright (C) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 import QtQuick.Window 2.2 -import QtQuick.Controls 1.4 as OldControls // TableView doesn't exist in the QtQuick Controls 2.x in 5.10, so use the old one import QtQuick.Controls 2.3 import QtQuick.Layouts 1.1 diff --git a/plugins/ImageReader/ConfigUI.qml b/plugins/ImageReader/ConfigUI.qml index 70a26d17d4..ecfc86fc05 100644 --- a/plugins/ImageReader/ConfigUI.qml +++ b/plugins/ImageReader/ConfigUI.qml @@ -2,273 +2,307 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.1 -import QtQuick.Controls 1.1 as OldControls import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.1 +import QtQuick.Layouts 1.3 import QtQuick.Window 2.1 -import UM 1.1 as UM +import UM 1.5 as UM +import Cura 1.0 as Cura UM.Dialog { - width: minimumWidth; - minimumWidth: 350 * screenScaleFactor; - - height: minimumHeight; - minimumHeight: 250 * screenScaleFactor; - title: catalog.i18nc("@title:window", "Convert Image...") + minimumWidth: grid.width + 2 * UM.Theme.getSize("default_margin").height + minimumHeight: UM.Theme.getSize("modal_window_minimum").height + width: minimumWidth + height: minimumHeight + GridLayout { - UM.I18nCatalog{id: catalog; name: "cura"} - anchors.fill: parent; - Layout.fillWidth: true - columnSpacing: 16 * screenScaleFactor - rowSpacing: 4 * screenScaleFactor - columns: 1 + UM.I18nCatalog { id: catalog; name: "cura" } + id: grid + columnSpacing: UM.Theme.getSize("default_margin").width + rowSpacing: UM.Theme.getSize("thin_margin").height + columns: 2 - UM.TooltipArea + Label { - Layout.fillWidth:true - height: childrenRect.height - text: catalog.i18nc("@info:tooltip","The maximum distance of each pixel from \"Base.\"") - Row - { - width: parent.width + Layout.fillWidth: true + text: catalog.i18nc("@action:label", "Height (mm)") + Layout.alignment: Qt.AlignVCenter - Label - { - text: catalog.i18nc("@action:label", "Height (mm)") - width: 150 * screenScaleFactor - anchors.verticalCenter: parent.verticalCenter - } - - OldControls.TextField - { - id: peak_height - objectName: "Peak_Height" - validator: RegExpValidator {regExp: /^\d{0,3}([\,|\.]\d*)?$/} - width: 180 * screenScaleFactor - onTextChanged: { manager.onPeakHeightChanged(text) } - } + MouseArea { + id: peak_height_label + anchors.fill: parent + hoverEnabled: true } } - UM.TooltipArea + TextField { - Layout.fillWidth:true - height: childrenRect.height - text: catalog.i18nc("@info:tooltip","The base height from the build plate in millimeters.") - Row + id: peak_height + Layout.fillWidth: true + selectByMouse: true + objectName: "Peak_Height" + validator: RegExpValidator { regExp: /^\d{0,3}([\,|\.]\d*)?$/ } + onTextChanged: manager.onPeakHeightChanged(text) + } + + Cura.ToolTip + { + text: catalog.i18nc("@info:tooltip", "The maximum distance of each pixel from \"Base.\"") + visible: peak_height.hovered || peak_height_label.containsMouse + targetPoint: Qt.point(peak_height.x + Math.round(peak_height.width / 2), 0) + y: peak_height.y + peak_height.height + UM.Theme.getSize("default_margin").height + } + + Label + { + Layout.fillWidth: true + text: catalog.i18nc("@action:label", "Base (mm)") + Layout.alignment: Qt.AlignVCenter + + MouseArea { - width: parent.width - - Label - { - text: catalog.i18nc("@action:label", "Base (mm)") - width: 150 * screenScaleFactor - anchors.verticalCenter: parent.verticalCenter - } - - OldControls.TextField - { - id: base_height - objectName: "Base_Height" - validator: RegExpValidator {regExp: /^\d{0,3}([\,|\.]\d*)?$/} - width: 180 * screenScaleFactor - onTextChanged: { manager.onBaseHeightChanged(text) } - } + id: base_height_label + anchors.fill: parent + hoverEnabled: true } } - UM.TooltipArea + TextField { - Layout.fillWidth:true - height: childrenRect.height - text: catalog.i18nc("@info:tooltip","The width in millimeters on the build plate.") - Row - { - width: parent.width + id: base_height + selectByMouse: true + Layout.fillWidth: true + objectName: "Base_Height" + validator: RegExpValidator { regExp: /^\d{0,3}([\,|\.]\d*)?$/ } + onTextChanged: manager.onBaseHeightChanged(text) + } - Label - { - text: catalog.i18nc("@action:label", "Width (mm)") - width: 150 * screenScaleFactor - anchors.verticalCenter: parent.verticalCenter - } + Cura.ToolTip + { + text: catalog.i18nc("@info:tooltip", "The base height from the build plate in millimeters.") + visible: base_height.hovered || base_height_label.containsMouse + targetPoint: Qt.point(base_height.x + Math.round(base_height.width / 2), 0) + y: base_height.y + base_height.height + UM.Theme.getSize("default_margin").height + } - OldControls.TextField - { - id: width - objectName: "Width" - focus: true - validator: RegExpValidator {regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/} - width: 180 * screenScaleFactor - onTextChanged: { manager.onWidthChanged(text) } - } + Label + { + Layout.fillWidth: true + text: catalog.i18nc("@action:label", "Width (mm)") + Layout.alignment: Qt.AlignVCenter + + MouseArea { + id: width_label + anchors.fill: parent + hoverEnabled: true } } - UM.TooltipArea + TextField { - Layout.fillWidth:true - height: childrenRect.height - text: catalog.i18nc("@info:tooltip","The depth in millimeters on the build plate") - Row - { - width: parent.width + id: width + selectByMouse: true + objectName: "Width" + Layout.fillWidth: true + focus: true + validator: RegExpValidator { regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ } + onTextChanged: manager.onWidthChanged(text) + } - Label - { - text: catalog.i18nc("@action:label", "Depth (mm)") - width: 150 * screenScaleFactor - anchors.verticalCenter: parent.verticalCenter - } - OldControls.TextField - { - id: depth - objectName: "Depth" - focus: true - validator: RegExpValidator {regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/} - width: 180 * screenScaleFactor - onTextChanged: { manager.onDepthChanged(text) } - } + Cura.ToolTip + { + text: catalog.i18nc("@info:tooltip", "The width in millimeters on the build plate") + visible: width.hovered || width_label.containsMouse + targetPoint: Qt.point(width.x + Math.round(width.width / 2), 0) + y: width.y + width.height + UM.Theme.getSize("default_margin").height + } + + Label + { + Layout.fillWidth: true + text: catalog.i18nc("@action:label", "Depth (mm)") + Layout.alignment: Qt.AlignVCenter + + MouseArea { + id: depth_label + anchors.fill: parent + hoverEnabled: true } } - UM.TooltipArea + TextField { - Layout.fillWidth:true - height: childrenRect.height - text: catalog.i18nc("@info:tooltip","For lithophanes dark pixels should correspond to thicker locations in order to block more light coming through. For height maps lighter pixels signify higher terrain, so lighter pixels should correspond to thicker locations in the generated 3D model.") - Row - { - width: parent.width + id: depth + Layout.fillWidth: true + selectByMouse: true + objectName: "Depth" + focus: true + validator: RegExpValidator { regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ } + onTextChanged: manager.onDepthChanged(text) + } - //Empty label so 2 column layout works. - Label - { - text: "" - width: 150 * screenScaleFactor - anchors.verticalCenter: parent.verticalCenter - } - OldControls.ComboBox - { - id: lighter_is_higher - objectName: "Lighter_Is_Higher" - model: [ catalog.i18nc("@item:inlistbox","Darker is higher"), catalog.i18nc("@item:inlistbox","Lighter is higher") ] - width: 180 * screenScaleFactor - onCurrentIndexChanged: { manager.onImageColorInvertChanged(currentIndex) } - } + Cura.ToolTip + { + text: catalog.i18nc("@info:tooltip", "The depth in millimeters on the build plate") + visible: depth.hovered || depth_label.containsMouse + targetPoint: Qt.point(depth.x + Math.round(depth.width / 2), 0) + y: depth.y + depth.height + UM.Theme.getSize("default_margin").height + } + + Label + { + Layout.fillWidth: true + text: "" + Layout.alignment: Qt.AlignVCenter + + MouseArea { + id: lighter_is_higher_label + anchors.fill: parent + hoverEnabled: true } } - UM.TooltipArea + ComboBox { - Layout.fillWidth:true - height: childrenRect.height - text: catalog.i18nc("@info:tooltip","For lithophanes a simple logarithmic model for translucency is available. For height maps the pixel values correspond to heights linearly.") - Row - { - width: parent.width + id: lighter_is_higher + Layout.fillWidth: true + Layout.preferredHeight: UM.Theme.getSize("toolbox_action_button").height + objectName: "Lighter_Is_Higher" + model: [catalog.i18nc("@item:inlistbox", "Darker is higher"), catalog.i18nc("@item:inlistbox", "Lighter is higher")] + onCurrentIndexChanged: { manager.onImageColorInvertChanged(currentIndex) } + } - Label - { - text: "Color Model" - width: 150 * screenScaleFactor - anchors.verticalCenter: parent.verticalCenter - } - OldControls.ComboBox - { - id: color_model - objectName: "ColorModel" - model: [ catalog.i18nc("@item:inlistbox","Linear"), catalog.i18nc("@item:inlistbox","Translucency") ] - width: 180 * screenScaleFactor - onCurrentIndexChanged: { manager.onColorModelChanged(currentIndex) } - } + Cura.ToolTip + { + text: catalog.i18nc("@info:tooltip", "For lithophanes dark pixels should correspond to thicker locations in order to block more light coming through. For height maps lighter pixels signify higher terrain, so lighter pixels should correspond to thicker locations in the generated 3D model.") + visible: lighter_is_higher.hovered || lighter_is_higher_label.containsMouse + targetPoint: Qt.point(lighter_is_higher.x + Math.round(lighter_is_higher.width / 2), 0) + y: lighter_is_higher.y + lighter_is_higher.height + UM.Theme.getSize("default_margin").height + } + + Label + { + Layout.fillWidth: true + text: catalog.i18nc("@action:label", "Color Model") + Layout.alignment: Qt.AlignVCenter + + MouseArea { + id: color_model_label + anchors.fill: parent + hoverEnabled: true } } - UM.TooltipArea + ComboBox { - Layout.fillWidth:true - height: childrenRect.height - text: catalog.i18nc("@info:tooltip","The percentage of light penetrating a print with a thickness of 1 millimeter. Lowering this value increases the contrast in dark regions and decreases the contrast in light regions of the image.") - visible: color_model.currentText == catalog.i18nc("@item:inlistbox","Translucency") - Row - { - width: parent.width + id: color_model + Layout.fillWidth: true + objectName: "ColorModel" + model: [catalog.i18nc("@item:inlistbox", "Linear"), catalog.i18nc("@item:inlistbox", "Translucency")] + onCurrentIndexChanged: { manager.onColorModelChanged(currentIndex) } + Layout.preferredHeight: UM.Theme.getSize("toolbox_action_button").height + } - Label - { - text: catalog.i18nc("@action:label", "1mm Transmittance (%)") - width: 150 * screenScaleFactor - anchors.verticalCenter: parent.verticalCenter - } - OldControls.TextField - { - id: transmittance - objectName: "Transmittance" - focus: true - validator: RegExpValidator {regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/} - width: 180 * screenScaleFactor - onTextChanged: { manager.onTransmittanceChanged(text) } - } + Cura.ToolTip + { + text: catalog.i18nc("@info:tooltip", "For lithophanes a simple logarithmic model for translucency is available. For height maps the pixel values correspond to heights linearly.") + visible: color_model.hovered || color_model_label.containsMouse + targetPoint: Qt.point(color_model.x + Math.round(color_model.width / 2), 0) + y: color_model.y + color_model.height + UM.Theme.getSize("default_margin").height + } + + Label + { + Layout.fillWidth: true + text: catalog.i18nc("@action:label", "1mm Transmittance (%)") + Layout.alignment: Qt.AlignVCenter + + MouseArea { + id: transmittance_label + anchors.fill: parent + hoverEnabled: true } } - UM.TooltipArea + TextField { - Layout.fillWidth:true - height: childrenRect.height - text: catalog.i18nc("@info:tooltip","The amount of smoothing to apply to the image.") - Row + id: transmittance + Layout.fillWidth: true + selectByMouse: true + objectName: "Transmittance" + validator: RegExpValidator { regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ } + onTextChanged: manager.onTransmittanceChanged(text) + } + + Cura.ToolTip + { + text: catalog.i18nc("@info:tooltip", "The percentage of light penetrating a print with a thickness of 1 millimeter. Lowering this value increases the contrast in dark regions and decreases the contrast in light regions of the image.") + visible: transmittance.hovered || transmittance_label.containsMouse + targetPoint: Qt.point(transmittance.x + Math.round(transmittance.width / 2), 0) + y: transmittance.y + transmittance.height + UM.Theme.getSize("default_margin").height + } + + Label + { + Layout.fillWidth: true + text: catalog.i18nc("@action:label", "Smoothing") + Layout.alignment: Qt.AlignVCenter + + MouseArea { - width: parent.width - - Label - { - text: catalog.i18nc("@action:label", "Smoothing") - width: 150 * screenScaleFactor - anchors.verticalCenter: parent.verticalCenter - } - - Item - { - width: 180 * screenScaleFactor - height: 20 * screenScaleFactor - Layout.fillWidth: true - - Slider - { - id: smoothing - objectName: "Smoothing" - from: 0.0 - to: 100.0 - stepSize: 1.0 - width: 180 - onValueChanged: { manager.onSmoothingChanged(value) } - } - } + id: smoothing_label + anchors.fill: parent + hoverEnabled: true } } + + Slider + { + id: smoothing + Layout.fillWidth: true + objectName: "Smoothing" + to: 100.0 + stepSize: 1.0 + onValueChanged: { manager.onSmoothingChanged(value) } + } + + Cura.ToolTip + { + text: catalog.i18nc("@info:tooltip", "The amount of smoothing to apply to the image.") + visible: smoothing.hovered || smoothing_label.containsMouse + targetPoint: Qt.point(smoothing.x + Math.round(smoothing.width / 2), 0) + y: smoothing.y + smoothing.height + UM.Theme.getSize("default_margin").height + } } + Item + { + ButtonGroup + { + buttons: [ok_button, cancel_button] + checkedButton: ok_button + } + } + + onAccepted: manager.onOkButtonClicked() + onRejected: manager.onCancelButtonClicked() + rightButtons: [ - OldControls.Button + Button { - id:ok_button - text: catalog.i18nc("@action:button","OK"); - onClicked: { manager.onOkButtonClicked() } - enabled: true + id: ok_button + text: catalog.i18nc("@action:button", "OK") + onClicked: manager.onOkButtonClicked() }, - OldControls.Button + Button { - id:cancel_button - text: catalog.i18nc("@action:button","Cancel"); - onClicked: { manager.onCancelButtonClicked() } - enabled: true + id: cancel_button + text: catalog.i18nc("@action:button", "Cancel") + onClicked: manager.onCancelButtonClicked() } ] } diff --git a/plugins/PerObjectSettingsTool/PerObjectCategory.qml b/plugins/PerObjectSettingsTool/PerObjectCategory.qml index 58192f0acd..d23b0b9458 100644 --- a/plugins/PerObjectSettingsTool/PerObjectCategory.qml +++ b/plugins/PerObjectSettingsTool/PerObjectCategory.qml @@ -1,10 +1,8 @@ -// Copyright (c) 2015 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Uranium is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 -import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.1 import UM 1.1 as UM @@ -13,39 +11,38 @@ import ".." Button { id: base; - style: ButtonStyle { - background: Item { } - label: Row + background: Item { } + + contentItem: Row + { + spacing: UM.Theme.getSize("default_lining").width + + UM.RecolorImage { - spacing: UM.Theme.getSize("default_lining").width - - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - height: (label.height / 2) | 0 - width: height - source: control.checked ? UM.Theme.getIcon("ChevronSingleDown") : UM.Theme.getIcon("ChevronSingleRight"); - color: control.hovered ? palette.highlight : palette.buttonText - } - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - height: label.height - width: height - source: control.iconSource - color: control.hovered ? palette.highlight : palette.buttonText - } - Label - { - id: label - anchors.verticalCenter: parent.verticalCenter - text: control.text - color: control.hovered ? palette.highlight : palette.buttonText - font.bold: true - } - - SystemPalette { id: palette } + anchors.verticalCenter: parent.verticalCenter + height: (label.height / 2) | 0 + width: height + source: base.checked ? UM.Theme.getIcon("ChevronSingleDown") : UM.Theme.getIcon("ChevronSingleRight"); + color: base.hovered ? palette.highlight : palette.buttonText } + UM.RecolorImage + { + anchors.verticalCenter: parent.verticalCenter + height: label.height + width: height + source: UM.Theme.getIcon(definition.icon) + color: base.hovered ? palette.highlight : palette.buttonText + } + Label + { + id: label + anchors.verticalCenter: parent.verticalCenter + text: base.text + color: base.hovered ? palette.highlight : palette.buttonText + font.bold: true + } + + SystemPalette { id: palette } } signal showTooltip(string text); @@ -53,7 +50,6 @@ Button { signal contextMenuRequested() text: definition.label - iconSource: UM.Theme.getIcon(definition.icon) checkable: true checked: definition.expanded diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index 098876e368..8bf39f6804 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -1,10 +1,9 @@ -// Copyright (c) 2022 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. +//Copyright (c) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.2 as OldControls -import QtQuick.Controls.Styles 1.2 import QtQuick.Controls 2.15 +import QtQuick.Controls.Styles 1.2 import UM 1.5 as UM import Cura 1.0 as Cura @@ -77,51 +76,63 @@ Item id: meshTypeButtons spacing: UM.Theme.getSize("default_margin").width - OldControls.Button + Cura.ToolbarButton { id: normalButton text: catalog.i18nc("@label", "Normal model") - iconSource: UM.Theme.getIcon("Infill0"); + toolItem: UM.RecolorImage + { + source: UM.Theme.getIcon("Infill0") + color: UM.Theme.getColor("icon") + } property bool needBorder: true checkable: true onClicked: setMeshType(normalMeshType); - style: UM.Theme.styles.tool_button; z: 4 } - OldControls.Button + Cura.ToolbarButton { id: supportMeshButton text: catalog.i18nc("@label", "Print as support") - iconSource: UM.Theme.getIcon("MeshTypeSupport"); + toolItem: UM.RecolorImage + { + source: UM.Theme.getIcon("MeshTypeSupport") + color: UM.Theme.getColor("icon") + } property bool needBorder: true checkable:true onClicked: setMeshType(supportMeshType) - style: UM.Theme.styles.tool_button; z: 3 } - OldControls.Button + Cura.ToolbarButton { id: overlapMeshButton text: catalog.i18nc("@label", "Modify settings for overlaps") - iconSource: UM.Theme.getIcon("MeshTypeIntersect"); + toolItem: UM.RecolorImage + { + source: UM.Theme.getIcon("MeshTypeIntersect") + color: UM.Theme.getColor("icon") + } property bool needBorder: true checkable:true onClicked: setMeshType(infillMeshType) - style: UM.Theme.styles.tool_button; z: 2 } - OldControls.Button + Cura.ToolbarButton { id: antiOverhangMeshButton text: catalog.i18nc("@label", "Don't support overlaps") - iconSource: UM.Theme.getIcon("BlockSupportOverlaps"); + toolItem: UM.RecolorImage + { + source: UM.Theme.getIcon("BlockSupportOverlaps") + color: UM.Theme.getColor("icon") + } property bool needBorder: true checkable: true onClicked: setMeshType(antiOverhangMeshType) - style: UM.Theme.styles.tool_button; z: 1 } @@ -285,26 +296,23 @@ Item } } - OldControls.Button + Button { width: Math.round(UM.Theme.getSize("setting").height / 2) height: UM.Theme.getSize("setting").height onClicked: addedSettingsModel.setVisible(model.key, false) - style: ButtonStyle + background: Item { - background: Item + UM.RecolorImage { - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - width: parent.width - height: width - sourceSize.height: width - color: control.hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button") - source: UM.Theme.getIcon("Minus") - } + anchors.verticalCenter: parent.verticalCenter + width: parent.width + height: width + sourceSize.height: width + color: parent.hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button") + source: UM.Theme.getIcon("Minus") } } } diff --git a/plugins/PerObjectSettingsTool/SettingPickDialog.qml b/plugins/PerObjectSettingsTool/SettingPickDialog.qml index 16590c68f1..1c79a02c97 100644 --- a/plugins/PerObjectSettingsTool/SettingPickDialog.qml +++ b/plugins/PerObjectSettingsTool/SettingPickDialog.qml @@ -1,5 +1,5 @@ -// Copyright (c) 2022 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. +//Copyright (c) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 import QtQuick.Controls 2.2 @@ -45,6 +45,7 @@ UM.Dialog TextField { id: filterInput + selectByMouse: true anchors { diff --git a/plugins/SimulationView/SimulationSliderLabel.qml b/plugins/SimulationView/SimulationSliderLabel.qml index 850fff7440..1c434ae935 100644 --- a/plugins/SimulationView/SimulationSliderLabel.qml +++ b/plugins/SimulationView/SimulationSliderLabel.qml @@ -1,5 +1,6 @@ -// Copyright (c) 2021 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. + import QtQuick 2.5 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.1 @@ -62,6 +63,7 @@ UM.PointingRectangle font: UM.Theme.getFont("default") renderType: Text.NativeRendering background: Item {} + selectByMouse: true onEditingFinished: { diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index 6addaa6dc5..ba13a75ea7 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -1,10 +1,9 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.4 import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.0 -import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls 2.1 import QtGraphicalEffects 1.0 import UM 1.5 as UM @@ -94,7 +93,8 @@ Cura.ExpandableComponent spacing: UM.Theme.getSize("layerview_row_spacing").height - ListModel // matches SimulationView.py + // matches SimulationView.py + ListModel { id: layerViewTypes } @@ -127,18 +127,17 @@ Cura.ExpandableComponent }) } - ComboBox + Cura.ComboBox { id: layerTypeCombobox + textRole: "text" + valueRole: "type_id" width: parent.width + implicitHeight: UM.Theme.getSize("setting_control").height model: layerViewTypes visible: !UM.SimulationView.compatibilityMode - style: UM.Theme.styles.combobox - onActivated: - { - UM.Preferences.setValue("layerview/layer_view_type", index); - } + onActivated: UM.Preferences.setValue("layerview/layer_view_type", index) Component.onCompleted: { diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 99d78537c3..868f23d242 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -1,10 +1,9 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 2.1 +import QtQuick.Controls 2.4 import QtQuick.Layouts 1.3 -import QtQuick.Controls 1.4 as Controls1 import UM 1.4 as UM import Cura 1.0 as Cura @@ -122,7 +121,9 @@ Column tooltip: catalog.i18nc("@label", "Start the slicing process") enabled: widget.backendState != UM.Backend.Error && !widget.waitingForSliceToStart visible: widget.backendState == UM.Backend.NotStarted || widget.backendState == UM.Backend.Error - onClicked: sliceOrStopSlicing() + onClicked: { + sliceOrStopSlicing() + } } Cura.SecondaryButton @@ -136,7 +137,9 @@ Column text: catalog.i18nc("@button", "Cancel") enabled: sliceButton.enabled visible: !sliceButton.visible - onClicked: sliceOrStopSlicing() + onClicked: { + sliceOrStopSlicing() + } } } @@ -165,7 +168,7 @@ Column } // Shortcut for "slice/stop" - Controls1.Action + Action { shortcut: "Ctrl+P" onTriggered: diff --git a/resources/qml/Dialogs/AskOpenAsProjectOrModelsDialog.qml b/resources/qml/Dialogs/AskOpenAsProjectOrModelsDialog.qml index 4890f79210..725b25e1e1 100644 --- a/resources/qml/Dialogs/AskOpenAsProjectOrModelsDialog.qml +++ b/resources/qml/Dialogs/AskOpenAsProjectOrModelsDialog.qml @@ -1,8 +1,8 @@ -// Copyright (c) 2021 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 +import QtQuick.Controls 2.1 import QtQuick.Layouts 1.1 import QtQuick.Dialogs 1.1 import QtQuick.Window 2.1 @@ -97,29 +97,32 @@ UM.Dialog text: catalog.i18nc("@text:window", "Remember my choice") checked: UM.Preferences.getValue("cura/choice_on_open_project") != "always_ask" } + } - // Buttons - Item { - id: buttonBar - anchors.right: parent.right - anchors.left: parent.left - height: childrenRect.height - - Button { - id: openAsProjectButton - text: catalog.i18nc("@action:button", "Open as project") - anchors.right: importModelsButton.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width - isDefault: true - onClicked: loadProjectFile() - } - - Button { - id: importModelsButton - text: catalog.i18nc("@action:button", "Import models") - anchors.right: parent.right - onClicked: loadModelFiles() - } + Item + { + ButtonGroup + { + buttons: [openAsProjectButton, importModelsButton] + checkedButton: openAsProjectButton } } + + onAccepted: loadProjectFile() + onRejected: loadModelFiles() + + rightButtons: [ + Button + { + id: openAsProjectButton + text: catalog.i18nc("@action:button", "Open as project") + onClicked: loadProjectFile() + }, + Button + { + id: importModelsButton + text: catalog.i18nc("@action:button", "Import models") + onClicked: loadModelFiles() + } + ] } diff --git a/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml b/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml index c6ee4f31e6..506dd85fac 100644 --- a/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml +++ b/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml @@ -3,7 +3,6 @@ import Qt.labs.qmlmodels 1.0 import QtQuick 2.1 -import QtQuick.Controls 1.1 as OldControls import QtQuick.Controls 2.15 import QtQuick.Dialogs 1.2 import QtQuick.Window 2.1 @@ -16,6 +15,9 @@ UM.Dialog id: base title: catalog.i18nc("@title:window", "Discard or Keep changes") + onAccepted: CuraApplication.discardOrKeepProfileChangesClosed("discard") + onRejected: CuraApplication.discardOrKeepProfileChangesClosed("keep") + minimumWidth: UM.Theme.getSize("popup_dialog").width minimumHeight: UM.Theme.getSize("popup_dialog").height width: minimumWidth @@ -47,7 +49,6 @@ UM.Dialog anchors.margins: UM.Theme.getSize("default_margin").width anchors.left: parent.left anchors.right: parent.right - anchors.top: parent.top spacing: UM.Theme.getSize("default_margin").width UM.I18nCatalog @@ -102,7 +103,7 @@ UM.Dialog Item { id: optionRow - anchors.bottom: buttonsRow.top + anchors.bottom: parent.bottom anchors.right: parent.right anchors.left: parent.left anchors.margins: UM.Theme.getSize("default_margin").width @@ -148,37 +149,33 @@ UM.Dialog Item { - id: buttonsRow - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.left: parent.left - anchors.margins: UM.Theme.getSize("default_margin").width - height: childrenRect.height + ButtonGroup + { + buttons: [discardButton, keepButton] + checkedButton: discardButton + } + } - OldControls.Button + rightButtons: [ + Button { id: discardButton text: catalog.i18nc("@action:button", "Discard changes"); - anchors.right: parent.right onClicked: { CuraApplication.discardOrKeepProfileChangesClosed("discard") base.hide() } - isDefault: true - } - - OldControls.Button + }, + Button { id: keepButton text: catalog.i18nc("@action:button", "Keep changes"); - anchors.right: discardButton.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width onClicked: { CuraApplication.discardOrKeepProfileChangesClosed("keep") base.hide() } } - } + ] } diff --git a/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml b/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml index 3f1900c66b..b739ad0436 100644 --- a/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml +++ b/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml @@ -1,9 +1,8 @@ -// Copyright (c) 2021 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls 2.0 import QtQuick.Layouts 1.1 import QtQuick.Dialogs 1.1 import QtQuick.Window 2.1 @@ -69,45 +68,44 @@ UM.Dialog width: height } - // Buttons - Item - { - anchors.right: parent.right - anchors.left: parent.left - height: childrenRect.height - - Button - { - id: cancelButton - text: catalog.i18nc("@action:button", "Cancel"); - anchors.right: importAllAsModelsButton.left - onClicked: - { - // cancel - base.hide(); - } - } - - Button - { - id: importAllAsModelsButton - text: catalog.i18nc("@action:button", "Import all as models"); - anchors.right: parent.right - isDefault: true - onClicked: - { - // load models from all selected file - loadModelFiles(base.fileUrls); - - base.hide(); - } - } - } - UM.I18nCatalog { id: catalog name: "cura" } + + ButtonGroup + { + buttons: [cancelButton, importAllAsModelsButton] + checkedButton: importAllAsModelsButton + } } + + onAccepted: loadModelFiles(base.fileUrls) + + // Buttons + rightButtons: + [ + Button + { + id: cancelButton + text: catalog.i18nc("@action:button", "Cancel"); + onClicked: + { + // cancel + base.hide(); + } + }, + Button + { + id: importAllAsModelsButton + text: catalog.i18nc("@action:button", "Import all as models"); + onClicked: + { + // load models from all selected file + loadModelFiles(base.fileUrls); + base.hide(); + } + } + ] } \ No newline at end of file diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 4069341f25..8a637f3870 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -3,11 +3,13 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -import QtQuick.Controls 1.1 as OldControls import Cura 1.0 as Cura import UM 1.5 as UM +// Simple button for displaying text and changes appearance for various states: enabled, valueError, valueWarning +// - and hovered. Mainly used in CustomConfiguration.qml + Item { UM.I18nCatalog @@ -263,7 +265,7 @@ Item width: selectors.textWidth } - OldControls.ToolButton + Cura.PrintSetupHeaderButton { id: materialSelection @@ -277,18 +279,15 @@ Item width: selectors.controlWidth height: parent.height - style: UM.Theme.styles.print_setup_header_button - activeFocusOnPress: true + focusPolicy: Qt.ClickFocus + Cura.MaterialMenu { id: materialsMenu extruderIndex: Cura.ExtruderManager.activeExtruderIndex updateModels: materialSelection.visible } - onClicked: - { - materialsMenu.popup(); - } + onClicked: materialsMenu.popup() } Item { @@ -325,15 +324,14 @@ Item width: selectors.textWidth } - OldControls.ToolButton + Cura.PrintSetupHeaderButton { id: variantSelection text: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.variant.name : "" tooltip: text height: parent.height width: selectors.controlWidth - style: UM.Theme.styles.print_setup_header_button - activeFocusOnPress: true + focusPolicy: Qt.ClickFocus enabled: enabledCheckbox.checked Cura.NozzleMenu @@ -341,10 +339,7 @@ Item id: nozzlesMenu extruderIndex: Cura.ExtruderManager.activeExtruderIndex } - onClicked: - { - nozzlesMenu.popup(); - } + onClicked: nozzlesMenu.popup() } } diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index 40da10dc46..db10b2b2bc 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -266,7 +266,7 @@ Item } } - Button + Cura.SecondaryButton { id: pauseResumeButton @@ -309,11 +309,9 @@ Item activePrintJob.setState("pause"); } } - - style: UM.Theme.styles.print_setup_action_button } - Button + Cura.SecondaryButton { id: abortButton @@ -325,8 +323,6 @@ Item text: catalog.i18nc("@label", "Abort Print") onClicked: confirmationDialog.visible = true - - style: UM.Theme.styles.print_setup_action_button } MessageDialog diff --git a/resources/qml/ObjectItemButton.qml b/resources/qml/ObjectItemButton.qml index 00fe88dd7e..73295b2e69 100644 --- a/resources/qml/ObjectItemButton.qml +++ b/resources/qml/ObjectItemButton.qml @@ -82,7 +82,7 @@ Button right: parent.right rightMargin: 0 } - width: contentItem.width + width: meshTypeIcon.width + perObjectSettingsCountLabel.width + UM.Theme.getSize("narrow_margin").width height: parent.height padding: 0 leftPadding: UM.Theme.getSize("thin_margin").width @@ -131,7 +131,7 @@ Button contentItem: Item { height: parent.height - width: meshTypeIcon.width + perObjectSettingsCountLabel.width + UM.Theme.getSize("narrow_margin").width + width: perObjectSettingsInfo.width Cura.NotificationIcon { diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index aed31b510b..b2461aad30 100644 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -2,7 +2,6 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 -import QtQuick.Controls 1.1 as OldControls import QtQuick.Controls 2.15 import QtQuick.Layouts 1.1 @@ -243,6 +242,7 @@ UM.PreferencesPage TextField { id: currencyField + selectByMouse: true text: UM.Preferences.getValue("cura/currency") onTextChanged: UM.Preferences.setValue("cura/currency", text) } @@ -869,7 +869,12 @@ UM.PreferencesPage } } - OldControls.ExclusiveGroup { id: curaUpdatesGroup } + ButtonGroup + { + id: curaUpdatesGroup + buttons: [checkUpdatesOptionBeta, checkUpdatesOptionStable] + } + UM.TooltipArea { width: childrenRect.width @@ -877,10 +882,10 @@ UM.PreferencesPage text: catalog.i18nc("@info:tooltip", "When checking for updates, only check for stable releases.") anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width - OldControls.RadioButton + RadioButton { + id: checkUpdatesOptionStable text: catalog.i18nc("@option:radio", "Stable releases only") - exclusiveGroup: curaUpdatesGroup enabled: checkUpdatesCheckbox.checked checked: UM.Preferences.getValue("info/latest_update_source") == "stable" onClicked: UM.Preferences.setValue("info/latest_update_source", "stable") @@ -893,10 +898,10 @@ UM.PreferencesPage text: catalog.i18nc("@info:tooltip", "When checking for updates, check for both stable and for beta releases.") anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width - OldControls.RadioButton + RadioButton { + id: checkUpdatesOptionBeta text: catalog.i18nc("@option:radio", "Stable and Beta releases") - exclusiveGroup: curaUpdatesGroup enabled: checkUpdatesCheckbox.checked checked: UM.Preferences.getValue("info/latest_update_source") == "beta" onClicked: UM.Preferences.setValue("info/latest_update_source", "beta") diff --git a/resources/qml/Preferences/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml index a6acfa0566..166e6c4346 100644 --- a/resources/qml/Preferences/MachinesPage.qml +++ b/resources/qml/Preferences/MachinesPage.qml @@ -1,8 +1,8 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.1 import QtQuick.Window 2.1 import UM 1.5 as UM @@ -38,7 +38,7 @@ UM.ManagementPage { id: activateMenuButton text: catalog.i18nc("@action:button", "Activate"); - iconName: "list-activate"; + icon.name: "list-activate" enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMachine.id onClicked: Cura.MachineManager.setActiveMachine(base.currentItem.id) }, @@ -46,14 +46,14 @@ UM.ManagementPage { id: addMenuButton text: catalog.i18nc("@action:button", "Add"); - iconName: "list-add"; + icon.name: "list-add" onClicked: Cura.Actions.addMachine.trigger() }, Button { id: removeMenuButton text: catalog.i18nc("@action:button", "Remove"); - iconName: "list-remove"; + icon.name: "list-remove" enabled: base.currentItem != null && model.count > 1 onClicked: confirmDialog.open(); }, @@ -61,7 +61,7 @@ UM.ManagementPage { id: renameMenuButton text: catalog.i18nc("@action:button", "Rename"); - iconName: "edit-rename"; + icon.name: "edit-rename" enabled: base.currentItem != null && base.currentItem.metadata.group_name == null onClicked: renameDialog.open(); } @@ -125,7 +125,7 @@ UM.ManagementPage rightButtons: Button { text: catalog.i18nc("@action:button", "Close") - iconName: "dialog-close" + icon.name: "dialog-close" onClicked: actionDialog.reject() } } diff --git a/resources/qml/Preferences/Materials/MaterialsPage.qml b/resources/qml/Preferences/Materials/MaterialsPage.qml index 549e0cc00d..819e3a4f8c 100644 --- a/resources/qml/Preferences/Materials/MaterialsPage.qml +++ b/resources/qml/Preferences/Materials/MaterialsPage.qml @@ -3,7 +3,6 @@ import QtQuick 2.7 import QtQuick.Controls 2.15 -import QtQuick.Controls 1.4 as OldControls import QtQuick.Layouts 1.3 import QtQuick.Dialogs 1.2 @@ -103,11 +102,11 @@ Item height: childrenRect.height // Activate button - OldControls.Button + Button { id: activateMenuButton text: catalog.i18nc("@action:button", "Activate") - iconName: "list-activate" + icon.name: "list-activate" enabled: !isCurrentItemActivated && Cura.MachineManager.activeMachine.hasMaterials onClicked: { @@ -121,11 +120,11 @@ Item } // Create button - OldControls.Button + Button { id: createMenuButton text: catalog.i18nc("@action:button", "Create") - iconName: "list-add" + icon.name: "list-add" enabled: Cura.MachineManager.activeMachine.hasMaterials onClicked: { @@ -136,11 +135,11 @@ Item } // Duplicate button - OldControls.Button + Button { id: duplicateMenuButton text: catalog.i18nc("@action:button", "Duplicate"); - iconName: "list-add" + icon.name: "list-add" enabled: base.hasCurrentItem onClicked: { @@ -151,11 +150,11 @@ Item } // Remove button - OldControls.Button + Button { id: removeMenuButton text: catalog.i18nc("@action:button", "Remove") - iconName: "list-remove" + icon.name: "list-remove" enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated && base.materialManagementModel.canMaterialBeRemoved(base.currentItem.container_node) onClicked: @@ -166,11 +165,11 @@ Item } // Import button - OldControls.Button + Button { id: importMenuButton text: catalog.i18nc("@action:button", "Import") - iconName: "document-import" + icon.name: "document-import" onClicked: { forceActiveFocus(); @@ -180,11 +179,11 @@ Item } // Export button - OldControls.Button + Button { id: exportMenuButton text: catalog.i18nc("@action:button", "Export") - iconName: "document-export" + icon.name: "document-export" onClicked: { forceActiveFocus(); @@ -194,11 +193,11 @@ Item } //Sync button. - OldControls.Button + Button { id: syncMaterialsButton text: catalog.i18nc("@action:button Sending materials to printers", "Sync with Printers") - iconName: "sync-synchronizing" + icon.name: "sync-synchronizing" onClicked: { forceActiveFocus(); diff --git a/resources/qml/Preferences/Materials/MaterialsSlot.qml b/resources/qml/Preferences/Materials/MaterialsSlot.qml index c80d2f2093..52728181b6 100644 --- a/resources/qml/Preferences/Materials/MaterialsSlot.qml +++ b/resources/qml/Preferences/Materials/MaterialsSlot.qml @@ -1,8 +1,8 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.1 import QtQuick.Layouts 1.3 import QtQuick.Dialogs 1.2 diff --git a/resources/qml/Preferences/Materials/MaterialsView.qml b/resources/qml/Preferences/Materials/MaterialsView.qml index 8de4d03241..d1ea251ab8 100644 --- a/resources/qml/Preferences/Materials/MaterialsView.qml +++ b/resources/qml/Preferences/Materials/MaterialsView.qml @@ -3,7 +3,6 @@ import QtQuick 2.7 import QtQuick.Controls 2.15 -import QtQuick.Controls 1.4 as OldControls import QtQuick.Dialogs 1.2 import UM 1.5 as UM @@ -284,32 +283,69 @@ Item } Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament Cost") } - OldControls.SpinBox + SpinBox { id: spoolCostSpinBox width: informationPage.columnWidth value: base.getMaterialPreferenceValue(properties.guid, "spool_cost") - prefix: base.currency + " " - decimals: 2 - maximumValue: 100000000 + to: 100000000 + editable: true + + contentItem: TextField + { + text: spoolCostSpinBox.textFromValue(spoolCostSpinBox.value, spoolCostSpinBox.locale) + selectByMouse: true + background: Item {} + validator: RegExpValidator { regExp: new RegExp("^" + base.currency + " ([0-9]+[.]?[0-9]*)?$") } + } + + property int decimals: 2 + + valueFromText: function(text) { + // remove all non-number tokens from input string so value can be parsed correctly + var value = Number(text.replace(",", ".").replace(/[^0-9.]+/g, "")); + var precision = Math.pow(10, spoolCostSpinBox.decimals); + return Math.round(value * precision) / precision; + } + + textFromValue: function(value) { + return base.currency + " " + value.toFixed(spoolCostSpinBox.decimals) + } onValueChanged: { - base.setMaterialPreferenceValue(properties.guid, "spool_cost", parseFloat(value)) + base.setMaterialPreferenceValue(properties.guid, "spool_cost", parseFloat(value, decimals)) updateCostPerMeter() } } Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament weight") } - OldControls.SpinBox + SpinBox { id: spoolWeightSpinBox width: informationPage.columnWidth value: base.getMaterialPreferenceValue(properties.guid, "spool_weight", Cura.ContainerManager.getContainerMetaDataEntry(properties.container_id, "properties/weight")) - suffix: " g" stepSize: 100 - decimals: 0 - maximumValue: 10000 + to: 10000 + editable: true + + contentItem: TextField + { + text: spoolWeightSpinBox.textFromValue(spoolWeightSpinBox.value, spoolWeightSpinBox.locale) + selectByMouse: true + background: Item {} + validator: RegExpValidator { regExp: new RegExp("^([0-9]+[.]?[0-9]*)? g$") } + } + + valueFromText: function(text, locale) { + // remove all non-number tokens from input string so value can be parsed correctly + var value = Number(text.replace(",", ".").replace(/[^0-9.]+/g, "")); + return Math.round(value); + } + + textFromValue: function(value, locale) { + return value + " g" + } onValueChanged: { @@ -345,7 +381,7 @@ Item wrapMode: Text.WordWrap visible: unlinkMaterialButton.visible } - OldControls.Button + Button { id: unlinkMaterialButton text: catalog.i18nc("@label", "Unlink Material") diff --git a/resources/qml/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index af81d97e6c..3d7ceeda5e 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -3,7 +3,6 @@ import QtQuick 2.7 import QtQuick.Controls 2.15 -import QtQuick.Controls 1.4 as OldControls import QtQuick.Layouts 1.3 import QtQuick.Dialogs 1.2 @@ -79,11 +78,11 @@ Item height: childrenRect.height // Activate button - OldControls.Button + Button { id: activateMenuButton text: catalog.i18nc("@action:button", "Activate") - iconName: "list-activate" + icon.name: "list-activate" enabled: !isCurrentItemActivated && base.currentItem onClicked: { @@ -99,11 +98,11 @@ Item } // Create button - OldControls.Button + Button { id: createMenuButton text: catalog.i18nc("@label", "Create") - iconName: "list-add" + icon.name: "list-add" enabled: base.canCreateProfile && !Cura.MachineManager.stacksHaveErrors visible: base.canCreateProfile @@ -116,11 +115,11 @@ Item } // Duplicate button - OldControls.Button + Button { id: duplicateMenuButton text: catalog.i18nc("@label", "Duplicate") - iconName: "list-add" + icon.name: "list-add" enabled: !base.canCreateProfile visible: !base.canCreateProfile @@ -133,11 +132,11 @@ Item } // Remove button - OldControls.Button + Button { id: removeMenuButton text: catalog.i18nc("@action:button", "Remove") - iconName: "list-remove" + icon.name: "list-remove" enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated onClicked: { @@ -147,11 +146,11 @@ Item } // Rename button - OldControls.Button + Button { id: renameMenuButton text: catalog.i18nc("@action:button", "Rename") - iconName: "edit-rename" + icon.name: "edit-rename" enabled: base.hasCurrentItem && !base.currentItem.is_read_only onClicked: { @@ -162,11 +161,11 @@ Item } // Import button - OldControls.Button + Button { id: importMenuButton text: catalog.i18nc("@action:button", "Import") - iconName: "document-import" + icon.name: "document-import" onClicked: { importDialog.open(); @@ -174,11 +173,11 @@ Item } // Export button - OldControls.Button + Button { id: exportMenuButton text: catalog.i18nc("@action:button", "Export") - iconName: "document-export" + icon.name: "document-export" enabled: base.hasCurrentItem && !base.currentItem.is_read_only onClicked: { diff --git a/resources/qml/PrintSetupHeaderButton.qml b/resources/qml/PrintSetupHeaderButton.qml new file mode 100644 index 0000000000..2583c6b84e --- /dev/null +++ b/resources/qml/PrintSetupHeaderButton.qml @@ -0,0 +1,122 @@ +// Copyright (c) 2022 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +// Button with a label-like appearance that displays different states (these can be displayed by setting the +// `valueError` or `valueWarning` properties). Mainly used within the `CustomConfiguration` component. + +import QtQuick 2.1 +import QtQuick.Controls 2.1 + +import Cura 1.0 as Cura +import UM 1.5 as UM + +ToolButton +{ + id: base + + property alias tooltip: tooltip.text + + property bool valueError: false; + property bool valueWarning: false; + + Cura.ToolTip + { + id: tooltip + visible: base.hovered + targetPoint: Qt.point(parent.x, Math.round(parent.y + parent.height / 2)) + } + + states: + [ + State + { + name: "disabled" + when: !base.enabled; + PropertyChanges + { + target: background + color: UM.Theme.getColor("setting_control_disabled") + border.color: UM.Theme.getColor("setting_control_disabled_border") + } + }, + State + { + name: "value_error" + when: base.enabled && base.valueError + PropertyChanges + { + target: background + color: UM.Theme.getColor("setting_validation_error_background") + border.color: UM.Theme.getColor("setting_validation_error") + } + }, + State + { + name: "value_warning" + when: base.enabled && base.valueWarning + PropertyChanges + { + target: background + color: UM.Theme.getColor("setting_validation_warning_background") + border.color: UM.Theme.getColor("setting_validation_warning") + } + }, + State + { + name: "highlight" + when: base.enabled && base.hovered + PropertyChanges + { + target: background + color: UM.Theme.getColor("setting_control") + border.color: UM.Theme.getColor("setting_control_border_highlight") + } + }, + State + { + name: "neutral" + when: base.enabled && !base.hovered && !base.valueWarning && !base.valueError + PropertyChanges + { + target: background + color: UM.Theme.getColor("setting_control") + border.color: UM.Theme.getColor("setting_control_border") + } + } + ] + + background: Rectangle + { + id: background + + radius: UM.Theme.getSize("setting_control_radius").width + border.width: UM.Theme.getSize("default_lining").width + color: UM.Theme.getColor("setting_control") + border.color: UM.Theme.getColor("setting_control_border") + + UM.RecolorImage + { + id: downArrow + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height + sourceSize.height: width + color: base.enabled ? UM.Theme.getColor("setting_control_button") : UM.Theme.getColor("setting_category_disabled_text") + source: UM.Theme.getIcon("ChevronSingleDown") + } + } + + contentItem: UM.Label + { + id: printSetupComboBoxLabel + text: base.text + elide: Text.ElideRight; + anchors.left: parent.left; + anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width + anchors.right: downArrow.lef + anchors.rightMargin: base.rightMargin + anchors.verticalCenter: parent.verticalCenter + } +} diff --git a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml index 2925a10f17..94d55d563d 100644 --- a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml @@ -3,7 +3,6 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import QtQuick.Controls 1.4 as OldControls import QtQuick.Layouts 1.3 import UM 1.5 as UM diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml index 4d23561bf0..49be0fae1c 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml @@ -2,7 +2,6 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 -import QtQuick.Controls 1.4 as OldControls import QtQuick.Controls 2.3 import UM 1.5 as UM diff --git a/resources/qml/PrinterOutput/ExtruderBox.qml b/resources/qml/PrinterOutput/ExtruderBox.qml index 63927cd98d..7ccab941b8 100644 --- a/resources/qml/PrinterOutput/ExtruderBox.qml +++ b/resources/qml/PrinterOutput/ExtruderBox.qml @@ -223,7 +223,7 @@ Item } } - Button //The pre-heat button. + Cura.SecondaryButton { id: preheatButton height: UM.Theme.getSize("setting_control").height @@ -255,96 +255,19 @@ Item anchors.right: parent.right anchors.bottom: parent.bottom anchors.margins: UM.Theme.getSize("default_margin").width - style: ButtonStyle { - background: Rectangle - { - border.width: UM.Theme.getSize("default_lining").width - implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2) - border.color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_border"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_border"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_border"); - } - else - { - return UM.Theme.getColor("action_button_border"); - } - } - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered"); - } - else - { - return UM.Theme.getColor("action_button"); - } - } - Behavior on color - { - ColorAnimation - { - duration: 50 - } - } - Label - { - id: actualLabel - anchors.centerIn: parent - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_text"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_text"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_text"); - } - else - { - return UM.Theme.getColor("action_button_text"); - } - } - font: UM.Theme.getFont("medium") - text: - { - if(extruderModel == null) - { - return "" - } - if(extruderModel.isPreheating ) - { - return catalog.i18nc("@button Cancel pre-heating", "Cancel") - } else - { - return catalog.i18nc("@button", "Pre-heat") - } - } - } + text: + { + if(extruderModel == null) + { + return "" + } + if(extruderModel.isPreheating ) + { + return catalog.i18nc("@button Cancel pre-heating", "Cancel") + } else + { + return catalog.i18nc("@button", "Pre-heat") } } diff --git a/resources/qml/PrinterOutput/HeatedBedBox.qml b/resources/qml/PrinterOutput/HeatedBedBox.qml index 2e3e319c89..12e24024c2 100644 --- a/resources/qml/PrinterOutput/HeatedBedBox.qml +++ b/resources/qml/PrinterOutput/HeatedBedBox.qml @@ -214,7 +214,7 @@ Item } } - Button // The pre-heat button. + Cura.SecondaryButton // The pre-heat button. { id: preheatButton height: UM.Theme.getSize("setting_control").height @@ -246,96 +246,19 @@ Item anchors.right: parent.right anchors.bottom: parent.bottom anchors.margins: UM.Theme.getSize("default_margin").width - style: ButtonStyle { - background: Rectangle - { - border.width: UM.Theme.getSize("default_lining").width - implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2) - border.color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_border"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_border"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_border"); - } - else - { - return UM.Theme.getColor("action_button_border"); - } - } - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered"); - } - else - { - return UM.Theme.getColor("action_button"); - } - } - Behavior on color - { - ColorAnimation - { - duration: 50 - } - } - Label - { - id: actualLabel - anchors.centerIn: parent - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_text"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_text"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_text"); - } - else - { - return UM.Theme.getColor("action_button_text"); - } - } - font: UM.Theme.getFont("medium") - text: - { - if(printerModel == null) - { - return "" - } - if(printerModel.isPreheating ) - { - return catalog.i18nc("@button Cancel pre-heating", "Cancel") - } else - { - return catalog.i18nc("@button", "Pre-heat") - } - } - } + text: + { + if(printerModel == null) + { + return "" + } + if(printerModel.isPreheating ) + { + return catalog.i18nc("@button Cancel pre-heating", "Cancel") + } else + { + return catalog.i18nc("@button", "Pre-heat") } } diff --git a/resources/qml/PrinterOutput/ManualPrinterControl.qml b/resources/qml/PrinterOutput/ManualPrinterControl.qml index 57e1b26e72..33717ad76c 100644 --- a/resources/qml/PrinterOutput/ManualPrinterControl.qml +++ b/resources/qml/PrinterOutput/ManualPrinterControl.qml @@ -1,9 +1,8 @@ -// Copyright (c) 2019 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 +import QtQuick.Controls 2.1 import QtQuick.Layouts 1.3 import UM 1.5 as UM @@ -92,14 +91,13 @@ Item Layout.preferredHeight: height } - Button + Cura.SecondaryButton { Layout.row: 1 Layout.column: 1 Layout.preferredWidth: width Layout.preferredHeight: height iconSource: UM.Theme.getIcon("ChevronSingleUp"); - style: UM.Theme.styles.monitor_button_style width: height height: UM.Theme.getSize("setting_control").height @@ -109,14 +107,13 @@ Item } } - Button + Cura.SecondaryButton { Layout.row: 2 Layout.column: 0 Layout.preferredWidth: width Layout.preferredHeight: height iconSource: UM.Theme.getIcon("ChevronSingleLeft"); - style: UM.Theme.styles.monitor_button_style width: height height: UM.Theme.getSize("setting_control").height @@ -126,14 +123,13 @@ Item } } - Button + Cura.SecondaryButton { Layout.row: 2 Layout.column: 2 Layout.preferredWidth: width Layout.preferredHeight: height iconSource: UM.Theme.getIcon("ChevronSingleRight"); - style: UM.Theme.styles.monitor_button_style width: height height: UM.Theme.getSize("setting_control").height @@ -143,14 +139,13 @@ Item } } - Button + Cura.SecondaryButton { Layout.row: 3 Layout.column: 1 Layout.preferredWidth: width Layout.preferredHeight: height iconSource: UM.Theme.getIcon("ChevronSingleDown"); - style: UM.Theme.styles.monitor_button_style width: height height: UM.Theme.getSize("setting_control").height @@ -160,14 +155,13 @@ Item } } - Button + Cura.SecondaryButton { Layout.row: 2 Layout.column: 1 Layout.preferredWidth: width Layout.preferredHeight: height iconSource: UM.Theme.getIcon("House"); - style: UM.Theme.styles.monitor_button_style width: height height: UM.Theme.getSize("setting_control").height @@ -192,10 +186,9 @@ Item horizontalAlignment: Text.AlignHCenter } - Button + Cura.SecondaryButton { iconSource: UM.Theme.getIcon("ChevronSingleUp"); - style: UM.Theme.styles.monitor_button_style width: height height: UM.Theme.getSize("setting_control").height @@ -205,10 +198,9 @@ Item } } - Button + Cura.SecondaryButton { iconSource: UM.Theme.getIcon("House"); - style: UM.Theme.styles.monitor_button_style width: height height: UM.Theme.getSize("setting_control").height @@ -218,10 +210,9 @@ Item } } - Button + Cura.SecondaryButton { iconSource: UM.Theme.getIcon("ChevronSingleDown"); - style: UM.Theme.styles.monitor_button_style width: height height: UM.Theme.getSize("setting_control").height @@ -266,12 +257,10 @@ Item width: height + UM.Theme.getSize("default_margin").width text: model.label - exclusiveGroup: distanceGroup + ButtonGroup.group: distanceGroup checkable: true checked: distancesRow.currentDistance == model.value onClicked: distancesRow.currentDistance = model.value - - style: UM.Theme.styles.monitor_checkable_button_style } } } @@ -400,6 +389,6 @@ Item ListElement { label: "10"; value: 10 } ListElement { label: "100"; value: 100 } } - ExclusiveGroup { id: distanceGroup } + ButtonGroup { id: distanceGroup } } } diff --git a/resources/qml/ProfileOverview.qml b/resources/qml/ProfileOverview.qml index ebca4ff22e..d3aa07ed06 100644 --- a/resources/qml/ProfileOverview.qml +++ b/resources/qml/ProfileOverview.qml @@ -3,7 +3,6 @@ import Qt.labs.qmlmodels 1.0 import QtQuick 2.7 -import QtQuick.Controls 1.4 as OldControls import QtQuick.Controls 2.15 import UM 1.5 as UM diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 857f066c39..11dd2a70eb 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -9,186 +9,6 @@ import UM 1.1 as UM QtObject { - property Component print_setup_header_button: Component - { - ButtonStyle - { - background: Rectangle - { - color: - { - if(control.enabled) - { - if(control.valueError) - { - return UM.Theme.getColor("setting_validation_error_background"); - } - else if(control.valueWarning) - { - return UM.Theme.getColor("setting_validation_warning_background"); - } - else - { - return UM.Theme.getColor("setting_control"); - } - } - else - { - return UM.Theme.getColor("setting_control_disabled"); - } - } - - radius: UM.Theme.getSize("setting_control_radius").width - border.width: UM.Theme.getSize("default_lining").width - border.color: - { - if (control.enabled) - { - if (control.valueError) - { - return UM.Theme.getColor("setting_validation_error"); - } - else if (control.valueWarning) - { - return UM.Theme.getColor("setting_validation_warning"); - } - else if (control.hovered) - { - return UM.Theme.getColor("setting_control_border_highlight"); - } - else - { - return UM.Theme.getColor("setting_control_border"); - } - } - else - { - return UM.Theme.getColor("setting_control_disabled_border"); - } - } - UM.RecolorImage - { - id: downArrow - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height - sourceSize.height: width - color: control.enabled ? UM.Theme.getColor("setting_control_button") : UM.Theme.getColor("setting_category_disabled_text") - source: UM.Theme.getIcon("ChevronSingleDown") - } - Label - { - id: printSetupComboBoxLabel - color: control.enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") - text: control.text; - elide: Text.ElideRight; - anchors.left: parent.left; - anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width - anchors.right: downArrow.left; - anchors.rightMargin: control.rightMargin; - anchors.verticalCenter: parent.verticalCenter; - font: UM.Theme.getFont("default") - } - } - label: Label{} - } - } - - property Component tool_button: Component - { - ButtonStyle - { - background: Item - { - implicitWidth: UM.Theme.getSize("button").width - implicitHeight: UM.Theme.getSize("button").height - - UM.PointingRectangle - { - id: button_tooltip - - anchors.left: parent.right - anchors.leftMargin: UM.Theme.getSize("button_tooltip_arrow").width * 2 - anchors.verticalCenter: parent.verticalCenter - - target: Qt.point(parent.x, y + Math.round(height/2)) - arrowSize: UM.Theme.getSize("button_tooltip_arrow").width - color: UM.Theme.getColor("button_tooltip") - opacity: control.hovered ? 1.0 : 0.0; - visible: control.text != "" - - width: control.hovered ? button_tip.width + UM.Theme.getSize("button_tooltip").width : 0 - height: UM.Theme.getSize("button_tooltip").height - - Behavior on width { NumberAnimation { duration: 100; } } - Behavior on opacity { NumberAnimation { duration: 100; } } - - Label - { - id: button_tip - - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - - text: control.text - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("tooltip_text") - } - } - - Rectangle - { - id: buttonFace - - anchors.fill: parent - property bool down: control.pressed || (control.checkable && control.checked) - - color: - { - if(control.customColor !== undefined && control.customColor !== null) - { - return control.customColor - } - else if(control.checkable && control.checked && control.hovered) - { - return UM.Theme.getColor("toolbar_button_active_hover") - } - else if(control.pressed || (control.checkable && control.checked)) - { - return UM.Theme.getColor("toolbar_button_active") - } - else if(control.hovered) - { - return UM.Theme.getColor("toolbar_button_hover") - } - return UM.Theme.getColor("toolbar_background") - } - Behavior on color { ColorAnimation { duration: 50; } } - - border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? UM.Theme.getSize("default_lining").width : 0 - border.color: control.checked ? UM.Theme.getColor("icon") : UM.Theme.getColor("lining") - } - } - - label: Item - { - UM.RecolorImage - { - anchors.centerIn: parent - opacity: control.enabled ? 1.0 : 0.2 - source: control.iconSource - width: UM.Theme.getSize("medium_button_icon").width - height: UM.Theme.getSize("medium_button_icon").height - color: UM.Theme.getColor("icon") - - sourceSize: UM.Theme.getSize("medium_button_icon") - } - } - } - } - property Component progressbar: Component { ProgressBarStyle @@ -268,61 +88,6 @@ QtObject } } - property Component combobox: Component - { - ComboBoxStyle - { - - background: Rectangle - { - implicitHeight: UM.Theme.getSize("setting_control").height; - implicitWidth: UM.Theme.getSize("setting_control").width; - - color: control.hovered ? UM.Theme.getColor("setting_control_highlight") : UM.Theme.getColor("setting_control") - Behavior on color { ColorAnimation { duration: 50; } } - - border.width: UM.Theme.getSize("default_lining").width; - border.color: control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border"); - radius: UM.Theme.getSize("setting_control_radius").width - } - - label: Item - { - Label - { - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_lining").width - anchors.right: downArrow.left - anchors.rightMargin: UM.Theme.getSize("default_lining").width - anchors.verticalCenter: parent.verticalCenter - - text: control.currentText - font: UM.Theme.getFont("default"); - color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text") - - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - } - - UM.RecolorImage - { - id: downArrow - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2 - anchors.verticalCenter: parent.verticalCenter - - source: UM.Theme.getIcon("ChevronSingleDown") - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height - sourceSize.width: width + 5 * screenScaleFactor - sourceSize.height: width + 5 * screenScaleFactor - - color: UM.Theme.getColor("setting_control_button"); - } - } - } - } - property Component partially_checkbox: Component { CheckBoxStyle @@ -372,233 +137,4 @@ QtObject } } } - - property Component print_setup_action_button: Component - { - ButtonStyle - { - background: Rectangle - { - border.width: UM.Theme.getSize("default_lining").width - border.color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_border"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_border"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_border"); - } - else - { - return UM.Theme.getColor("action_button_border"); - } - } - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered"); - } - else - { - return UM.Theme.getColor("action_button"); - } - } - Behavior on color { ColorAnimation { duration: 50 } } - - implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("thick_margin").width * 2) - - Label - { - id: actualLabel - anchors.centerIn: parent - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_text"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_text"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_text"); - } - else - { - return UM.Theme.getColor("action_button_text"); - } - } - font: UM.Theme.getFont("medium") - text: control.text - } - } - label: Item { } - } - } - - property Component monitor_button_style: Component - { - ButtonStyle - { - background: Rectangle - { - border.width: UM.Theme.getSize("default_lining").width - border.color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_border"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_border"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_border"); - } - return UM.Theme.getColor("action_button_border"); - } - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered"); - } - return UM.Theme.getColor("action_button"); - } - Behavior on color - { - ColorAnimation - { - duration: 50 - } - } - } - - label: Item - { - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - width: Math.floor(control.width / 2) - height: Math.floor(control.height / 2) - sourceSize.height: width - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_text"); - } - else 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"); - } - source: control.iconSource - } - } - } - } - - property Component monitor_checkable_button_style: Component - { - ButtonStyle { - background: Rectangle { - border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width - border.color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_border"); - } - else if (control.checked || control.pressed) - { - return UM.Theme.getColor("action_button_active_border"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_border"); - } - return UM.Theme.getColor("action_button_border"); - } - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled"); - } - else if (control.checked || control.pressed) - { - return UM.Theme.getColor("action_button_active"); - } - else if (control.hovered) - { - return UM.Theme.getColor("action_button_hovered"); - } - return UM.Theme.getColor("action_button"); - } - Behavior on color { ColorAnimation { duration: 50; } } - Label { - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: UM.Theme.getSize("default_lining").width * 2 - anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2 - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_text"); - } - else if (control.checked || 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"); - } - font: UM.Theme.getFont("default") - text: control.text - horizontalAlignment: Text.AlignHCenter - elide: Text.ElideMiddle - } - } - label: Item { } - } - } }