From a17a764f3acbe44ebb943ed0f2ac9ba7fac9fa72 Mon Sep 17 00:00:00 2001 From: kirbylife Date: Tue, 2 Apr 2024 01:16:08 -0600 Subject: [PATCH] Add slider to resize the icon --- qml/Icon.qml | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/qml/Icon.qml b/qml/Icon.qml index e87ec16..92a9540 100644 --- a/qml/Icon.qml +++ b/qml/Icon.qml @@ -47,7 +47,7 @@ Page { activated = !activated iconEditor.corners[idCell] = activated py.importModule("main", function(){ - py.call("main.sailify", [(iconEditor.attrs.old_icon || iconEditor.attrs.Icon).toString(), iconEditor.corners], function(result){ + py.call("main.sailify", [(iconEditor.attrs.old_icon || iconEditor.attrs.Icon).toString(), iconEditor.corners, size.value], function(result){ icon.source = result }) }) @@ -62,10 +62,30 @@ Page { height: width } - Button { + Slider { + id: size anchors.top: icon.bottom anchors.horizontalCenter: parent.horizontalCenter anchors.topMargin: 10 + label: "Size:" + width: parent.width + minimumValue: 0 + maximumValue: 100 + stepSize: 10 + value: 100 + onReleased: { + py.importModule("main", function(){ + py.call("main.sailify", [(iconEditor.attrs.old_icon || iconEditor.attrs.Icon).toString(), iconEditor.corners, size.value], function(result){ + icon.source = result + }) + }) + } + } + + Button { + anchors.top: size.bottom + anchors.horizontalCenter: parent.horizontalCenter + anchors.topMargin: 20 text: "Save" onClicked: { if(iconEditor.attrs.old_icon === undefined) { @@ -89,7 +109,7 @@ Page { Component.onCompleted: { py.addImportPath(Qt.resolvedUrl("../src")); py.importModule("main", function(){ - py.call("main.sailify", [(iconEditor.attrs.old_icon || iconEditor.attrs.Icon).toString(), [1, 1, 1, 1]], function(result){ + py.call("main.sailify", [(iconEditor.attrs.old_icon || iconEditor.attrs.Icon).toString(), [1, 1, 1, 1], size.value], function(result){ icon.source = result }) })