Add slider to resize the icon

master
kirbylife 2024-04-02 01:16:08 -06:00
parent d9792187fd
commit a17a764f3a
1 changed files with 23 additions and 3 deletions

View File

@ -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
})
})