Updated setting items & sidebar to qtQuick controls 2.0

This commit is contained in:
Jaime van Kessel 2017-10-11 21:02:27 +02:00
parent eaa7b75f0e
commit 799d1a5b0c
9 changed files with 342 additions and 254 deletions

View file

@ -2,8 +2,7 @@
// Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.1
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Controls 2.0
import UM 1.1 as UM
import Cura 1.0 as Cura
@ -65,83 +64,78 @@ SettingItem
value: control.currentText != "" ? control.model.getItem(control.currentIndex).color : ""
}
style: ComboBoxStyle
indicator: UM.RecolorImage
{
background: Rectangle
id: downArrow
x: control.width - width - control.rightPadding
y: control.topPadding + (control.availableHeight - height) / 2
source: UM.Theme.getIcon("arrow_bottom")
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_text");
}
background: Rectangle
{
color:
{
color:
if(!enabled)
{
if(!enabled)
{
return UM.Theme.getColor("setting_control_disabled");
}
if(control.hovered || base.activeFocus)
{
return UM.Theme.getColor("setting_control_highlight");
}
return UM.Theme.getColor("setting_control");
return UM.Theme.getColor("setting_control_disabled");
}
border.width: UM.Theme.getSize("default_lining").width
border.color:
if(control.hovered || base.activeFocus)
{
if(!enabled)
{
return UM.Theme.getColor("setting_control_disabled_border")
}
if(control.hovered || control.activeFocus)
{
return UM.Theme.getColor("setting_control_border_highlight")
}
return UM.Theme.getColor("setting_control_border")
return UM.Theme.getColor("setting_control_highlight");
}
return UM.Theme.getColor("setting_control");
}
label: Item
border.width: UM.Theme.getSize("default_lining").width
border.color:
{
Label
if(!enabled)
{
id: extruderText
anchors.verticalCenter: parent.verticalCenter
text: control.currentText
font: UM.Theme.getFont("default")
color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
elide: Text.ElideLeft
verticalAlignment: Text.AlignVCenter
return UM.Theme.getColor("setting_control_disabled_border")
}
Rectangle
if(control.hovered || control.activeFocus)
{
id: swatch
height: UM.Theme.getSize("setting_control").height / 2
width: height
anchors
{
right: arrow.left
verticalCenter: parent.verticalCenter
margins: UM.Theme.getSize("default_margin").width / 4
}
border.width: UM.Theme.getSize("default_lining").width * 2
border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
radius: width / 2
color: control.color
return UM.Theme.getColor("setting_control_border_highlight")
}
UM.RecolorImage
{
id: arrow
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
return UM.Theme.getColor("setting_control_border")
}
}
contentItem: Item
{
Label
{
id: extruderText
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.right: swatch.left
text: control.currentText
font: UM.Theme.getFont("default")
color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
source: UM.Theme.getIcon("arrow_bottom")
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 * screenScaleFactor
elide: Text.ElideLeft
verticalAlignment: Text.AlignVCenter
}
Rectangle
{
id: swatch
height: UM.Theme.getSize("setting_control").height / 2
width: height
color: UM.Theme.getColor("setting_control_text")
}
anchors.right: parent.right
anchors.rightMargin: control.indicator.width + control.spacing
border.width: UM.Theme.getSize("default_lining").width * 2
border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
radius: width / 2
color: control.color
}
}
}