WIP: Add CheckBox and fix styles

This commit is contained in:
Lipu Fei 2019-03-18 08:53:41 +01:00
parent cf0e3effc7
commit 0fb9ee6c9a
5 changed files with 103 additions and 5 deletions

View file

@ -24,11 +24,15 @@ UM.TooltipArea
width: childrenRect.width
text: tooltipText
property int controlWidth: UM.Theme.getSize("setting_control").width
property int controlHeight: UM.Theme.getSize("setting_control").height
property alias containerStackId: propertyProvider.containerStackId
property alias settingKey: propertyProvider.key
property alias settingStoreIndex: propertyProvider.storeIndex
property alias labelText: fieldLabel.text
property alias labelFont: fieldLabel.font
property alias labelWidth: fieldLabel.width
property string tooltipText: propertyProvider.properties.description
@ -55,7 +59,8 @@ UM.TooltipArea
id: fieldLabel
anchors.verticalCenter: comboBox.verticalCenter
visible: text != ""
elide: Text.ElideRight
font: UM.Theme.getFont("medium")
renderType: Text.NativeRendering
}
ListModel
@ -80,8 +85,8 @@ UM.TooltipArea
CuraComboBox
{
id: comboBox
width: 100
height: UM.Theme.getSize("action_button").height
width: comboBoxWithOptions.controlWidth
height: comboBoxWithOptions.controlHeight
model: optionsModel
textRole: "text"

View file

@ -31,6 +31,7 @@ UM.TooltipArea
property alias settingStoreIndex: propertyProvider.storeIndex
property alias labelText: fieldLabel.text
property alias labelFont: fieldLabel.font
property alias labelWidth: fieldLabel.width
property alias unitText: unitLabel.text
@ -64,7 +65,7 @@ UM.TooltipArea
id: fieldLabel
anchors.verticalCenter: textFieldWithUnit.verticalCenter
visible: text != ""
elide: Text.ElideRight
font: UM.Theme.getFont("medium")
renderType: Text.NativeRendering
}

View file

@ -8,14 +8,20 @@ import QtQuick.Layouts 1.3
import UM 1.3 as UM
import Cura 1.1 as Cura
import "../Widgets"
//
// CheckBox widget for the on/off or true/false settings in the Machine Settings Dialog.
//
UM.TooltipArea
{
id: simpleCheckBox
UM.I18nCatalog { id: catalog; name: "cura"; }
property int controlHeight: UM.Theme.getSize("setting_control").height
height: childrenRect.height
width: childrenRect.width
text: tooltip
@ -25,6 +31,7 @@ UM.TooltipArea
property alias settingStoreIndex: propertyProvider.storeIndex
property alias labelText: checkBox.text
property alias labelFont: checkBox.font
property string tooltip: propertyProvider.properties.description
@ -40,10 +47,12 @@ UM.TooltipArea
watchedProperties: [ "value", "description" ]
}
CheckBox
CuraCheckBox
{
id: checkBox
checked: String(propertyProvider.properties.value).toLowerCase() != 'false'
height: simpleCheckBox.controlHeight
font: UM.Theme.getFont("medium")
onClicked:
{
propertyProvider.setPropertyValue("value", checked)