mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Updated setting items & sidebar to qtQuick controls 2.0
This commit is contained in:
parent
eaa7b75f0e
commit
799d1a5b0c
9 changed files with 342 additions and 254 deletions
|
|
@ -2,17 +2,57 @@
|
|||
// 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.0
|
||||
|
||||
import UM 1.1 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Button {
|
||||
Button
|
||||
{
|
||||
id: base;
|
||||
|
||||
style: UM.Theme.styles.sidebar_category;
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
|
||||
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width
|
||||
background: Rectangle
|
||||
{
|
||||
implicitHeight: UM.Theme.getSize("section").height;
|
||||
color: {
|
||||
if(base.color) {
|
||||
return base.color;
|
||||
} else if(!base.enabled) {
|
||||
return UM.Theme.getColor("setting_category_disabled");
|
||||
} else if(base.hovered && base.checkable && base.checked) {
|
||||
return UM.Theme.getColor("setting_category_active_hover");
|
||||
} else if(base.pressed || (base.checkable && base.checked)) {
|
||||
return UM.Theme.getColor("setting_category_active");
|
||||
} else if(base.hovered) {
|
||||
return UM.Theme.getColor("setting_category_hover");
|
||||
} else {
|
||||
return UM.Theme.getColor("setting_category");
|
||||
}
|
||||
}
|
||||
Behavior on color { ColorAnimation { duration: 50; } }
|
||||
Rectangle
|
||||
{
|
||||
height: UM.Theme.getSize("default_lining").height
|
||||
width: parent.width
|
||||
anchors.bottom: parent.bottom
|
||||
color: {
|
||||
if(!base.enabled) {
|
||||
return UM.Theme.getColor("setting_category_disabled_border");
|
||||
} else if((base.hovered || base.activeFocus) && base.checkable && base.checked) {
|
||||
return UM.Theme.getColor("setting_category_active_hover_border");
|
||||
} else if(base.pressed || (base.checkable && base.checked)) {
|
||||
return UM.Theme.getColor("setting_category_active_border");
|
||||
} else if(base.hovered || base.activeFocus) {
|
||||
return UM.Theme.getColor("setting_category_hover_border");
|
||||
} else {
|
||||
return UM.Theme.getColor("setting_category_border");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signal showTooltip(string text)
|
||||
signal hideTooltip()
|
||||
|
|
@ -23,8 +63,121 @@ Button {
|
|||
|
||||
property var focusItem: base
|
||||
|
||||
text: definition.label
|
||||
iconSource: UM.Theme.getIcon(definition.icon)
|
||||
//text: definition.label
|
||||
|
||||
contentItem: Item {
|
||||
anchors.fill: parent;
|
||||
anchors.left: parent.left
|
||||
|
||||
Label {
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
leftMargin: 2 * UM.Theme.getSize("default_margin").width + UM.Theme.getSize("section_icon").width
|
||||
right: parent.right;
|
||||
verticalCenter: parent.verticalCenter;
|
||||
}
|
||||
text: definition.label
|
||||
font: UM.Theme.getFont("setting_category");
|
||||
color:
|
||||
{
|
||||
if(!base.enabled)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_disabled_text");
|
||||
}
|
||||
else if((base.hovered || base.activeFocus) && base.checkable && base.checked)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_active_hover_text");
|
||||
}
|
||||
else if(base.pressed || (base.checkable && base.checked))
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_active_text");
|
||||
}
|
||||
else if(base.hovered || base.activeFocus)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_hover_text");
|
||||
}
|
||||
else
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_text");
|
||||
}
|
||||
}
|
||||
fontSizeMode: Text.HorizontalFit;
|
||||
minimumPointSize: 8
|
||||
}
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: category_arrow
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width * 3 - width / 2
|
||||
width: UM.Theme.getSize("standard_arrow").width
|
||||
height: UM.Theme.getSize("standard_arrow").height
|
||||
sourceSize.width: width
|
||||
sourceSize.height: width
|
||||
color:
|
||||
{
|
||||
if(!base.enabled)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_disabled_text");
|
||||
}
|
||||
else if((base.hovered || base.activeFocus) && base.checkable && base.checked)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_active_hover_text");
|
||||
}
|
||||
else if(base.pressed || (base.checkable && base.checked))
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_active_text");
|
||||
}
|
||||
else if(base.hovered || base.activeFocus)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_hover_text");
|
||||
}
|
||||
else
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_text");
|
||||
}
|
||||
}
|
||||
source: base.checked ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
|
||||
}
|
||||
}
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: icon
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
color:
|
||||
{
|
||||
if(!base.enabled)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_disabled_text");
|
||||
}
|
||||
else if((base.hovered || base.activeFocus) && base.checkable && base.checked)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_active_hover_text");
|
||||
}
|
||||
else if(base.pressed || (base.checkable && base.checked))
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_active_text");
|
||||
}
|
||||
else if(base.hovered || base.activeFocus)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_hover_text");
|
||||
}
|
||||
else
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_text");
|
||||
}
|
||||
}
|
||||
source: UM.Theme.getIcon(definition.icon)
|
||||
width: UM.Theme.getSize("section_icon").width;
|
||||
height: UM.Theme.getSize("section_icon").height;
|
||||
sourceSize.width: width + 15 * screenScaleFactor
|
||||
sourceSize.height: width + 15 * screenScaleFactor
|
||||
}
|
||||
|
||||
|
||||
checkable: true
|
||||
checked: definition.expanded
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue