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 @@
// 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 UM 1.2 as UM
@ -110,7 +109,7 @@ Rectangle
UM.Preferences.setValue("cura/active_mode", currentModeIndex);
if(modesListModel.count > base.currentModeIndex)
{
sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "replace": true });
sidebarContents.push(modesListModel.get(base.currentModeIndex).item, {"replace": true });
}
}
@ -156,7 +155,7 @@ Rectangle
anchors.verticalCenter: parent.verticalCenter
width: Math.floor(0.5 * parent.width)
text: model.text
exclusiveGroup: modeMenuGroup;
ButtonGroup.group: modeMenuGroup;
checkable: true;
checked: base.currentModeIndex == index
onClicked: base.currentModeIndex = index
@ -175,36 +174,9 @@ Rectangle
}
}
style: ButtonStyle {
background: Rectangle {
border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width
border.color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") :
control.hovered ? UM.Theme.getColor("action_button_hovered_border") :
UM.Theme.getColor("action_button_border")
color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active") :
control.hovered ? UM.Theme.getColor("action_button_hovered") :
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: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_text") :
control.hovered ? UM.Theme.getColor("action_button_hovered_text") :
UM.Theme.getColor("action_button_text")
font: UM.Theme.getFont("default")
text: control.text
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideMiddle
}
}
label: Item { }
}
}
}
ExclusiveGroup { id: modeMenuGroup; }
ButtonGroup { id: modeMenuGroup; }
ListView
{
@ -229,31 +201,21 @@ Rectangle
anchors.right: base.right
visible: !monitoringPrint && !hideSettings
delegate: StackViewDelegate
{
function transitionFinished(properties)
{
properties.exitItem.opacity = 1
pushEnter:Transition {
PropertyAnimation {
property: "opacity"
from: 0
to:1
duration: 100
}
}
pushTransition: StackViewTransition
{
PropertyAnimation
{
target: enterItem
property: "opacity"
from: 0
to: 1
duration: 100
}
PropertyAnimation
{
target: exitItem
property: "opacity"
from: 1
to: 0
duration: 100
}
pushExit: Transition {
PropertyAnimation {
property: "opacity"
from: 1
to:0
duration: 100
}
}
}
@ -488,7 +450,7 @@ Rectangle
tooltipText: catalog.i18nc("@tooltip", "<b>Custom Print Setup</b><br/><br/>Print with finegrained control over every last bit of the slicing process."),
item: sidebarAdvanced
})
sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "immediate": true });
sidebarContents.push( modesListModel.get(base.currentModeIndex).item, {"immediate": true });
var index = Math.floor(UM.Preferences.getValue("cura/active_mode"))
if(index)