mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-09 07:56:22 -06:00
Update Printer application to the new style GUI
This commit is contained in:
parent
8e1e37e2eb
commit
1c1371489b
5 changed files with 571 additions and 13 deletions
76
FilePane.qml
Normal file
76
FilePane.qml
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
import QtQuick 2.2
|
||||||
|
import QtQuick.Controls 1.1
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
|
||||||
|
import UM 1.0 as UM
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: base;
|
||||||
|
|
||||||
|
signal requestOpenFile();
|
||||||
|
signal openFile(url file);
|
||||||
|
|
||||||
|
function setDirectory(file)
|
||||||
|
{
|
||||||
|
UM.Models.directoryListModel.directory = file
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
anchors.fill: parent;
|
||||||
|
anchors.margins: UM.Theme.defaultMargin;
|
||||||
|
|
||||||
|
Button { text: "Open File"; iconSource: UM.Resources.getIcon("open.png"); Layout.fillWidth: true; onClicked: base.requestOpenFile(); }
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true;
|
||||||
|
Layout.fillHeight: true;
|
||||||
|
border.width: 1;
|
||||||
|
border.color: "#aaa";
|
||||||
|
|
||||||
|
ScrollView {
|
||||||
|
anchors.fill: parent;
|
||||||
|
anchors.margins: 1;
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: listView;
|
||||||
|
model: UM.Models.directoryListModel;
|
||||||
|
delegate: listDelegate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolButton {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter;
|
||||||
|
iconSource: UM.Resources.getIcon('expand.png');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: listDelegate;
|
||||||
|
Rectangle {
|
||||||
|
id: item;
|
||||||
|
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
|
||||||
|
height: 40;
|
||||||
|
|
||||||
|
color: mouseArea.pressed ? "#f00" : index % 2 ? "#eee" : "#fff";
|
||||||
|
|
||||||
|
Label {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: UM.Theme.defaultMargin;
|
||||||
|
|
||||||
|
text: model.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: mouseArea;
|
||||||
|
anchors.fill: parent;
|
||||||
|
|
||||||
|
onClicked: base.openFile(model.url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
45
OutputGCodeButton.qml
Normal file
45
OutputGCodeButton.qml
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
import QtQuick 2.2
|
||||||
|
import QtQuick.Controls 1.1
|
||||||
|
import QtQuick.Controls.Styles 1.1
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
|
||||||
|
import UM 1.0 as UM
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: saveButton;
|
||||||
|
|
||||||
|
text: "Save";
|
||||||
|
|
||||||
|
iconSource: UM.Resources.getIcon('save.png');
|
||||||
|
|
||||||
|
onClicked: saveDialog.open();
|
||||||
|
|
||||||
|
style: ButtonStyle {
|
||||||
|
background: Rectangle {
|
||||||
|
color: UM.Theme.primaryColor;
|
||||||
|
border.width: 1;
|
||||||
|
border.color: UM.Theme.borderColor;
|
||||||
|
}
|
||||||
|
label: Item {
|
||||||
|
Label {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.right: icon.left;
|
||||||
|
text: control.text;
|
||||||
|
horizontalAlignment: Text.AlignHCenter;
|
||||||
|
font.pointSize: UM.Theme.largeTextSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: icon;
|
||||||
|
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.verticalCenter: parent.verticalCenter;
|
||||||
|
|
||||||
|
width: control.height;
|
||||||
|
height: control.height;
|
||||||
|
UM.RecolorImage { anchors.centerIn: parent; source: control.iconSource; color: "#f00"; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
294
Printer.qml
294
Printer.qml
|
@ -1,29 +1,305 @@
|
||||||
import QtQuick 2.1
|
import QtQuick 2.2
|
||||||
import QtQuick.Controls 1.1
|
import QtQuick.Controls 1.1
|
||||||
|
import QtQuick.Controls.Styles 1.1
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
import QtQuick.Dialogs 1.1
|
import QtQuick.Dialogs 1.1
|
||||||
|
|
||||||
import UM 1.0 as UM
|
import UM 1.0 as UM
|
||||||
|
|
||||||
UM.DefaultWindow {
|
UM.MainWindow {
|
||||||
title: "Cura"
|
id: base
|
||||||
|
visible: true
|
||||||
|
|
||||||
function saveClicked() {
|
width: 1280
|
||||||
saveDialog.open();
|
height: 720
|
||||||
|
|
||||||
|
title: "Cura";
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: backgroundItem;
|
||||||
|
anchors.fill: parent;
|
||||||
|
|
||||||
|
UM.ApplicationMenu {
|
||||||
|
id: menu
|
||||||
|
window: base
|
||||||
|
|
||||||
|
Menu {
|
||||||
|
title: '&File';
|
||||||
|
|
||||||
|
MenuItem { action: loadFileAction; }
|
||||||
|
MenuItem { action: saveFileAction; }
|
||||||
|
|
||||||
|
MenuSeparator { }
|
||||||
|
|
||||||
|
MenuItem { action: quitAction; }
|
||||||
|
}
|
||||||
|
|
||||||
|
Menu {
|
||||||
|
title: '&Edit';
|
||||||
|
|
||||||
|
MenuItem { action: undoAction; }
|
||||||
|
MenuItem { action: redoAction; }
|
||||||
|
MenuSeparator { }
|
||||||
|
MenuItem { action: deleteAction; }
|
||||||
|
MenuItem { action: deleteAllAction; }
|
||||||
|
}
|
||||||
|
|
||||||
|
Menu {
|
||||||
|
id: machineMenu;
|
||||||
|
title: "&Machine";
|
||||||
|
|
||||||
|
Instantiator {
|
||||||
|
model: UM.Models.machinesModel
|
||||||
|
MenuItem {
|
||||||
|
text: model.name;
|
||||||
|
checkable: true;
|
||||||
|
exclusiveGroup: machineMenuGroup;
|
||||||
|
}
|
||||||
|
onObjectAdded: machineMenu.insertItem(index, object)
|
||||||
|
onObjectRemoved: machineMenu.removeItem(object)
|
||||||
|
}
|
||||||
|
|
||||||
|
ExclusiveGroup { id: machineMenuGroup; }
|
||||||
|
MenuSeparator { }
|
||||||
|
MenuItem { text: "Add new machine..."; enabled: false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
Menu {
|
||||||
|
title: 'E&xtensions';
|
||||||
|
|
||||||
|
MenuItem { text: "No extensions loaded"; enabled: false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
Menu {
|
||||||
|
title: '&Settings';
|
||||||
|
|
||||||
|
MenuItem { action: preferencesAction; }
|
||||||
|
}
|
||||||
|
|
||||||
|
Menu {
|
||||||
|
title: '&Help';
|
||||||
|
|
||||||
|
MenuItem { action: helpAction; enabled: false; }
|
||||||
|
MenuItem { action: aboutAction; enabled: false; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: contentItem;
|
||||||
|
|
||||||
|
y: menu.height
|
||||||
|
width: parent.width;
|
||||||
|
height: parent.height - menu.height;
|
||||||
|
|
||||||
|
Keys.forwardTo: menu
|
||||||
|
|
||||||
|
DropArea {
|
||||||
|
anchors.fill: parent;
|
||||||
|
onDropped: {
|
||||||
|
if(drop.urls.length > 0) {
|
||||||
|
for(var i in drop.urls) {
|
||||||
|
UM.Controller.addMesh(drop.urls[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UM.Toolbar {
|
||||||
|
id: toolbar;
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
left: parent.left;
|
||||||
|
right: parent.right;
|
||||||
|
top: parent.top;
|
||||||
|
}
|
||||||
|
|
||||||
|
undo: undoAction;
|
||||||
|
redo: redoAction;
|
||||||
|
settings: settingsAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
FilePane {
|
||||||
|
id: files;
|
||||||
|
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: UM.Theme.windowLeftMargin;
|
||||||
|
anchors.top: toolbar.bottom;
|
||||||
|
anchors.topMargin: -1;
|
||||||
|
|
||||||
|
border.width: 1;
|
||||||
|
border.color: UM.Theme.borderColor;
|
||||||
|
|
||||||
|
width: UM.Theme.panelWidth;
|
||||||
|
height: base.height / 2 - UM.Theme.toolbarHeight;
|
||||||
|
|
||||||
|
onRequestOpenFile: openDialog.open();
|
||||||
|
onOpenFile: UM.Controller.addMesh(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsPane {
|
||||||
|
id: settings;
|
||||||
|
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: UM.Theme.windowRightMargin;
|
||||||
|
anchors.top: toolbar.bottom;
|
||||||
|
anchors.topMargin: -1;
|
||||||
|
|
||||||
|
border.width: 1;
|
||||||
|
border.color: UM.Theme.borderColor;
|
||||||
|
|
||||||
|
width: UM.Theme.panelWidth;
|
||||||
|
|
||||||
|
expandedHeight: base.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
OutputGCodeButton {
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: UM.Theme.windowRightMargin;
|
||||||
|
|
||||||
|
anchors.bottom: parent.bottom;
|
||||||
|
anchors.bottomMargin: -1;
|
||||||
|
|
||||||
|
width: UM.Theme.panelWidth;
|
||||||
|
height: 40;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UM.JobList { anchors.left: parent.left; anchors.bottom: parent.bottom; width: parent.width / 10; height: parent.height / 5; }
|
||||||
|
|
||||||
|
// ProgressBar {
|
||||||
|
// id: progressBar;
|
||||||
|
//
|
||||||
|
// anchors {
|
||||||
|
// left: parent.left;
|
||||||
|
// bottom: parent.bottom;
|
||||||
|
// right: parent.right;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// minimumValue: 0;
|
||||||
|
// maximumValue: 1;
|
||||||
|
//
|
||||||
|
// Connections {
|
||||||
|
// target: UM.Backend;
|
||||||
|
// onProcessingProgress: progressBar.value = amount;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UM.PreferencesDialog { id: preferences }
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: undoAction;
|
||||||
|
text: "Undo";
|
||||||
|
iconName: "edit-undo";
|
||||||
|
shortcut: StandardKey.Undo;
|
||||||
|
onTriggered: UM.OperationStack.undo();
|
||||||
|
enabled: UM.OperationStack.canUndo;
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: redoAction;
|
||||||
|
text: "Redo";
|
||||||
|
iconName: "edit-redo";
|
||||||
|
shortcut: StandardKey.Redo;
|
||||||
|
onTriggered: UM.OperationStack.redo();
|
||||||
|
enabled: UM.OperationStack.canRedo;
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: quitAction;
|
||||||
|
text: "Quit";
|
||||||
|
iconName: "application-exit";
|
||||||
|
shortcut: StandardKey.Quit;
|
||||||
|
onTriggered: Qt.quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: preferencesAction;
|
||||||
|
text: "Preferences";
|
||||||
|
iconName: "configure";
|
||||||
|
onTriggered: preferences.visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: settingsAction;
|
||||||
|
text: "Configure Printers";
|
||||||
|
iconSource: UM.Resources.getIcon("settings.png");
|
||||||
|
onTriggered: preferences.visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: helpAction;
|
||||||
|
text: "Show Manual";
|
||||||
|
iconName: "help-contents";
|
||||||
|
shortcut: StandardKey.Help;
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: aboutAction;
|
||||||
|
text: "About...";
|
||||||
|
iconName: "help-about";
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: deleteAction;
|
||||||
|
text: "Delete Selection";
|
||||||
|
iconName: "edit-delete";
|
||||||
|
shortcut: StandardKey.Delete;
|
||||||
|
onTriggered: UM.Controller.removeSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: deleteAllAction;
|
||||||
|
text: "Clear Build Platform";
|
||||||
|
iconName: "edit-clear";
|
||||||
|
enabled: false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: loadFileAction;
|
||||||
|
text: "Open...";
|
||||||
|
iconName: "document-open";
|
||||||
|
shortcut: StandardKey.Open;
|
||||||
|
onTriggered: openDialog.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: saveFileAction;
|
||||||
|
text: "Save...";
|
||||||
|
iconName: "document-save";
|
||||||
|
shortcut: StandardKey.Save;
|
||||||
|
enabled: false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Menu {
|
||||||
|
id: contextMenu;
|
||||||
|
|
||||||
|
MenuItem { action: deleteAction; }
|
||||||
}
|
}
|
||||||
|
|
||||||
FileDialog {
|
FileDialog {
|
||||||
id: saveDialog
|
id: openDialog;
|
||||||
|
|
||||||
title: "Choose Filename"
|
title: "Choose files"
|
||||||
|
modality: Qt.NonModal
|
||||||
|
//TODO: Support multiple file selection, workaround bug in KDE file dialog
|
||||||
|
//selectMultiple: true
|
||||||
|
|
||||||
modality: Qt.NonModal;
|
onAccepted:
|
||||||
|
{
|
||||||
|
UM.Controller.addMesh(fileUrl)
|
||||||
|
files.setDirectory(fileUrl)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FileDialog {
|
||||||
|
id: saveDialog;
|
||||||
|
title: "Choose Filename";
|
||||||
selectExisting: false;
|
selectExisting: false;
|
||||||
|
|
||||||
onAccepted:
|
onAccepted:
|
||||||
{
|
{
|
||||||
Printer.saveGCode(fileUrl)
|
Printer.saveGCode(fileUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,8 @@ class PrinterApplication(QtApplication):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.setApplicationName('printer')
|
self.setApplicationName('printer')
|
||||||
self._machine_settings.loadSettingsFromFile(Resources.getPath(Resources.SettingsLocation, "ultimaker2.json"))
|
self._machine_settings.loadSettingsFromFile(Resources.getPath(Resources.SettingsLocation, "ultimaker_original+.json"))
|
||||||
|
self.setRequiredPlugins(['CuraEngineBackend', 'MeshView', 'LayerView', 'STLReader','SelectionTool','CameraTool'])
|
||||||
self._physics = None
|
self._physics = None
|
||||||
|
|
||||||
def _loadPlugins(self):
|
def _loadPlugins(self):
|
||||||
|
@ -33,8 +34,6 @@ class PrinterApplication(QtApplication):
|
||||||
self._plugin_registry.loadPlugin('CuraEngineBackend')
|
self._plugin_registry.loadPlugin('CuraEngineBackend')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
|
|
||||||
controller = self.getController()
|
controller = self.getController()
|
||||||
|
|
||||||
controller.setActiveView("MeshView")
|
controller.setActiveView("MeshView")
|
||||||
|
@ -66,7 +65,7 @@ class PrinterApplication(QtApplication):
|
||||||
camera = Camera('3d', root)
|
camera = Camera('3d', root)
|
||||||
camera.translate(Vector(0, 150, 150))
|
camera.translate(Vector(0, 150, 150))
|
||||||
proj = Matrix()
|
proj = Matrix()
|
||||||
proj.setPerspective(45, 640/480, 1, 500)
|
proj.setPerspective(85, 640/480, 1, 500)
|
||||||
camera.setProjectionMatrix(proj)
|
camera.setProjectionMatrix(proj)
|
||||||
camera.setPerspective(True)
|
camera.setPerspective(True)
|
||||||
camera.lookAt(Vector(0, 0, 0), Vector(0, 1, 0))
|
camera.lookAt(Vector(0, 0, 0), Vector(0, 1, 0))
|
||||||
|
|
162
SettingsPane.qml
Normal file
162
SettingsPane.qml
Normal file
|
@ -0,0 +1,162 @@
|
||||||
|
import QtQuick 2.2
|
||||||
|
import QtQuick.Controls 1.1
|
||||||
|
import QtQuick.Controls.Styles 1.1
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
|
||||||
|
import UM 1.0 as UM
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: base;
|
||||||
|
|
||||||
|
height: childrenRect.height;
|
||||||
|
|
||||||
|
property real expandedHeight: 500;
|
||||||
|
|
||||||
|
property bool collapsed: true;
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
height: contents.height;
|
||||||
|
|
||||||
|
acceptedButtons: Qt.AllButtons;
|
||||||
|
|
||||||
|
onWheel: {
|
||||||
|
wheel.accepted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: contents;
|
||||||
|
spacing: UM.Theme.defaultMargin;
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
left: parent.left;
|
||||||
|
leftMargin: UM.Theme.defaultMargin;
|
||||||
|
right: parent.right;
|
||||||
|
rightMargin: UM.Theme.defaultMargin;
|
||||||
|
}
|
||||||
|
|
||||||
|
Label { text: "Print Settings"; width: parent.width; }
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: parent.width;
|
||||||
|
height: childrenRect.height;
|
||||||
|
|
||||||
|
Label { anchors.right: parent.horizontalCenter; text: "Material"; width: parent.width / 2; }
|
||||||
|
ComboBox {
|
||||||
|
anchors.left: parent.horizontalCenter;
|
||||||
|
width: parent.width / 2;
|
||||||
|
model: ListModel {
|
||||||
|
ListElement { text: "PLA"; }
|
||||||
|
ListElement { text: "ABS"; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: parent.width;
|
||||||
|
height: childrenRect.height;
|
||||||
|
|
||||||
|
Label { anchors.right: parent.horizontalCenter; text: "Time"; width: parent.width / 2; }
|
||||||
|
Label { anchors.left: parent.horizontalCenter; text: "10:10"; width: parent.width / 2; }
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle { color: "black"; height: 1; width: parent.width; }
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: speedSlider;
|
||||||
|
|
||||||
|
width: parent.width;
|
||||||
|
height: 60;
|
||||||
|
|
||||||
|
Slider {
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
height: 20;
|
||||||
|
|
||||||
|
style: SliderStyle {
|
||||||
|
groove: Rectangle {
|
||||||
|
height: 1;
|
||||||
|
color: "black";
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.verticalCenter: parent.verticalCenter;
|
||||||
|
width: 1;
|
||||||
|
height: control.height;
|
||||||
|
color: "black";
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.verticalCenter: parent.verticalCenter;
|
||||||
|
width: 1;
|
||||||
|
height: control.height;
|
||||||
|
color: "black";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handle: Rectangle { width: 5; height: control.height; color: UM.Theme.primaryColor; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.bottom: parent.bottom;
|
||||||
|
text: "0:00\nLow Quality";
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.bottom: parent.bottom;
|
||||||
|
horizontalAlignment: Text.AlignRight;
|
||||||
|
text: "10:00\nHigh Quality";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UM.SettingsView { id: settingsView; width: parent.width; height: 0; opacity: 0; visible: false; verticalScrollBarPolicy: Qt.ScrollBarAlwaysOff }
|
||||||
|
|
||||||
|
Rectangle { color: "black"; height: 1; width: parent.width; }
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.columnSpan: 2;
|
||||||
|
height: childrenRect.height;
|
||||||
|
width: parent.width;
|
||||||
|
|
||||||
|
ToolButton {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter;
|
||||||
|
iconSource: UM.Resources.getIcon('expand.png');
|
||||||
|
onClicked: base.collapsed = !base.collapsed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: 'expanded';
|
||||||
|
when: !base.collapsed;
|
||||||
|
|
||||||
|
PropertyChanges { target: speedSlider; opacity: 0; height: 0; visible: false; }
|
||||||
|
PropertyChanges {
|
||||||
|
target: settingsView;
|
||||||
|
opacity: 1;
|
||||||
|
height: Math.min(settingsView.listHeight, base.expandedHeight * 0.6);
|
||||||
|
visible: true;
|
||||||
|
verticalScrollBarPolicy: Qt.ScrollBarAsNeeded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
transitions: [
|
||||||
|
Transition {
|
||||||
|
to: 'expanded';
|
||||||
|
reversible: true;
|
||||||
|
SequentialAnimation {
|
||||||
|
NumberAnimation { target: speedSlider; property: 'opacity'; duration: 100; }
|
||||||
|
PropertyAction { target: settingsView; property: 'visible'; }
|
||||||
|
NumberAnimation { property: 'height'; duration: 200; }
|
||||||
|
PropertyAction { target: speedSlider; property: 'visible'; }
|
||||||
|
NumberAnimation { target: settingsView; property: 'opacity'; duration: 100; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue