Merge pull request #11336 from Ultimaker/CURA-8684_QtControls_replacement_Buttons,_Actions_&_'Exclusivity'

Cura 8684 qt controls replacement buttons, actions & 'exclusivity'
This commit is contained in:
Jaime van Kessel 2022-01-31 17:33:15 +01:00 committed by GitHub
commit 2294214bcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 691 additions and 1131 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.TooltipArea
{
Layout.fillWidth:true
height: childrenRect.height
text: catalog.i18nc("@info:tooltip","The maximum distance of each pixel from \"Base.\"")
Row
{
width: parent.width
UM.I18nCatalog { id: catalog; name: "cura" }
id: grid
columnSpacing: UM.Theme.getSize("default_margin").width
rowSpacing: UM.Theme.getSize("thin_margin").height
columns: 2
Label
{
Layout.fillWidth: true
text: catalog.i18nc("@action:label", "Height (mm)")
width: 150 * screenScaleFactor
anchors.verticalCenter: parent.verticalCenter
Layout.alignment: Qt.AlignVCenter
MouseArea {
id: peak_height_label
anchors.fill: parent
hoverEnabled: true
}
}
OldControls.TextField
TextField
{
id: peak_height
Layout.fillWidth: true
selectByMouse: true
objectName: "Peak_Height"
validator: RegExpValidator {regExp: /^\d{0,3}([\,|\.]\d*)?$/}
width: 180 * screenScaleFactor
onTextChanged: { manager.onPeakHeightChanged(text) }
}
}
validator: RegExpValidator { regExp: /^\d{0,3}([\,|\.]\d*)?$/ }
onTextChanged: manager.onPeakHeightChanged(text)
}
UM.TooltipArea
Cura.ToolTip
{
Layout.fillWidth:true
height: childrenRect.height
text: catalog.i18nc("@info:tooltip","The base height from the build plate in millimeters.")
Row
{
width: parent.width
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)")
width: 150 * screenScaleFactor
anchors.verticalCenter: parent.verticalCenter
Layout.alignment: Qt.AlignVCenter
MouseArea
{
id: base_height_label
anchors.fill: parent
hoverEnabled: true
}
}
OldControls.TextField
TextField
{
id: base_height
selectByMouse: true
Layout.fillWidth: true
objectName: "Base_Height"
validator: RegExpValidator {regExp: /^\d{0,3}([\,|\.]\d*)?$/}
width: 180 * screenScaleFactor
onTextChanged: { manager.onBaseHeightChanged(text) }
}
}
validator: RegExpValidator { regExp: /^\d{0,3}([\,|\.]\d*)?$/ }
onTextChanged: manager.onBaseHeightChanged(text)
}
UM.TooltipArea
Cura.ToolTip
{
Layout.fillWidth:true
height: childrenRect.height
text: catalog.i18nc("@info:tooltip","The width in millimeters on the build plate.")
Row
{
width: parent.width
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
}
Label
{
Layout.fillWidth: true
text: catalog.i18nc("@action:label", "Width (mm)")
width: 150 * screenScaleFactor
anchors.verticalCenter: parent.verticalCenter
Layout.alignment: Qt.AlignVCenter
MouseArea {
id: width_label
anchors.fill: parent
hoverEnabled: true
}
}
OldControls.TextField
TextField
{
id: width
selectByMouse: true
objectName: "Width"
Layout.fillWidth: true
focus: true
validator: RegExpValidator {regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/}
width: 180 * screenScaleFactor
onTextChanged: { manager.onWidthChanged(text) }
}
}
validator: RegExpValidator { regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ }
onTextChanged: manager.onWidthChanged(text)
}
UM.TooltipArea
Cura.ToolTip
{
Layout.fillWidth:true
height: childrenRect.height
text: catalog.i18nc("@info:tooltip","The depth in millimeters on the build plate")
Row
{
width: parent.width
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)")
width: 150 * screenScaleFactor
anchors.verticalCenter: parent.verticalCenter
Layout.alignment: Qt.AlignVCenter
MouseArea {
id: depth_label
anchors.fill: parent
hoverEnabled: true
}
OldControls.TextField
}
TextField
{
id: depth
Layout.fillWidth: true
selectByMouse: true
objectName: "Depth"
focus: true
validator: RegExpValidator {regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/}
width: 180 * screenScaleFactor
onTextChanged: { manager.onDepthChanged(text) }
}
}
validator: RegExpValidator { regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ }
onTextChanged: manager.onDepthChanged(text)
}
UM.TooltipArea
Cura.ToolTip
{
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
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
}
//Empty label so 2 column layout works.
Label
{
Layout.fillWidth: true
text: ""
width: 150 * screenScaleFactor
anchors.verticalCenter: parent.verticalCenter
Layout.alignment: Qt.AlignVCenter
MouseArea {
id: lighter_is_higher_label
anchors.fill: parent
hoverEnabled: true
}
OldControls.ComboBox
}
ComboBox
{
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") ]
width: 180 * screenScaleFactor
model: [catalog.i18nc("@item:inlistbox", "Darker is higher"), catalog.i18nc("@item:inlistbox", "Lighter is higher")]
onCurrentIndexChanged: { manager.onImageColorInvertChanged(currentIndex) }
}
}
}
UM.TooltipArea
Cura.ToolTip
{
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
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
{
text: "Color Model"
width: 150 * screenScaleFactor
anchors.verticalCenter: parent.verticalCenter
Layout.fillWidth: true
text: catalog.i18nc("@action:label", "Color Model")
Layout.alignment: Qt.AlignVCenter
MouseArea {
id: color_model_label
anchors.fill: parent
hoverEnabled: true
}
OldControls.ComboBox
}
ComboBox
{
id: color_model
Layout.fillWidth: true
objectName: "ColorModel"
model: [ catalog.i18nc("@item:inlistbox","Linear"), catalog.i18nc("@item:inlistbox","Translucency") ]
width: 180 * screenScaleFactor
model: [catalog.i18nc("@item:inlistbox", "Linear"), catalog.i18nc("@item:inlistbox", "Translucency")]
onCurrentIndexChanged: { manager.onColorModelChanged(currentIndex) }
}
}
Layout.preferredHeight: UM.Theme.getSize("toolbox_action_button").height
}
UM.TooltipArea
Cura.ToolTip
{
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
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 (%)")
width: 150 * screenScaleFactor
anchors.verticalCenter: parent.verticalCenter
Layout.alignment: Qt.AlignVCenter
MouseArea {
id: transmittance_label
anchors.fill: parent
hoverEnabled: true
}
OldControls.TextField
}
TextField
{
id: transmittance
Layout.fillWidth: true
selectByMouse: true
objectName: "Transmittance"
focus: true
validator: RegExpValidator {regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/}
width: 180 * screenScaleFactor
onTextChanged: { manager.onTransmittanceChanged(text) }
}
}
validator: RegExpValidator { regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ }
onTextChanged: manager.onTransmittanceChanged(text)
}
UM.TooltipArea
Cura.ToolTip
{
Layout.fillWidth:true
height: childrenRect.height
text: catalog.i18nc("@info:tooltip","The amount of smoothing to apply to the image.")
Row
{
width: parent.width
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
{
text: catalog.i18nc("@action:label", "Smoothing")
width: 150 * screenScaleFactor
anchors.verticalCenter: parent.verticalCenter
}
Item
{
width: 180 * screenScaleFactor
height: 20 * screenScaleFactor
Layout.fillWidth: true
text: catalog.i18nc("@action:label", "Smoothing")
Layout.alignment: Qt.AlignVCenter
MouseArea
{
id: smoothing_label
anchors.fill: parent
hoverEnabled: true
}
}
Slider
{
id: smoothing
Layout.fillWidth: true
objectName: "Smoothing"
from: 0.0
to: 100.0
stepSize: 1.0
width: 180
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()
}
]
}

View File

@ -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,9 +11,9 @@ import ".."
Button {
id: base;
style: ButtonStyle {
background: Item { }
label: Row
contentItem: Row
{
spacing: UM.Theme.getSize("default_lining").width
@ -24,36 +22,34 @@ Button {
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
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: control.iconSource
color: control.hovered ? palette.highlight : palette.buttonText
source: UM.Theme.getIcon(definition.icon)
color: base.hovered ? palette.highlight : palette.buttonText
}
Label
{
id: label
anchors.verticalCenter: parent.verticalCenter
text: control.text
color: control.hovered ? palette.highlight : palette.buttonText
text: base.text
color: base.hovered ? palette.highlight : palette.buttonText
font.bold: true
}
SystemPalette { id: palette }
}
}
signal showTooltip(string text);
signal hideTooltip();
signal contextMenuRequested()
text: definition.label
iconSource: UM.Theme.getIcon(definition.icon)
checkable: true
checked: definition.expanded

View File

@ -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,15 +296,13 @@ 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
{
UM.RecolorImage
@ -302,12 +311,11 @@ Item
width: parent.width
height: width
sourceSize.height: width
color: control.hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button")
color: parent.hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button")
source: UM.Theme.getIcon("Minus")
}
}
}
}
// Specialty provider that only watches global_inherits (we can't filter on what property changed we get events
// so we bypass that to make a dedicated provider).

View File

@ -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
{

View File

@ -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: {

View File

@ -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:
{

View File

@ -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:

View File

@ -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
Item
{
ButtonGroup
{
buttons: [openAsProjectButton, importModelsButton]
checkedButton: openAsProjectButton
}
}
Button {
onAccepted: loadProjectFile()
onRejected: loadModelFiles()
rightButtons: [
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 {
},
Button
{
id: importModelsButton
text: catalog.i18nc("@action:button", "Import models")
anchors.right: parent.right
onClicked: loadModelFiles()
}
}
}
]
}

View File

@ -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()
}
}
}
]
}

View File

@ -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();
}
}
]
}

View File

@ -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()
}
}

View File

@ -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

View File

@ -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
{

View File

@ -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")

View File

@ -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()
}
}

View File

@ -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();

View File

@ -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

View File

@ -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")

View File

@ -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:
{

View File

@ -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
}
}

View File

@ -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

View File

@ -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

View File

@ -223,7 +223,7 @@ Item
}
}
Button //The pre-heat button.
Cura.SecondaryButton
{
id: preheatButton
height: UM.Theme.getSize("setting_control").height
@ -255,81 +255,7 @@ 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)
@ -344,9 +270,6 @@ Item
return catalog.i18nc("@button", "Pre-heat")
}
}
}
}
}
onClicked:
{

View File

@ -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,81 +246,7 @@ 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)
@ -335,9 +261,6 @@ Item
return catalog.i18nc("@button", "Pre-heat")
}
}
}
}
}
onClicked:
{

View File

@ -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 }
}
}

View File

@ -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

View File

@ -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 { }
}
}
}