"Clicking" MouseArea when State changes
-
Hello, I'm looking for solution of the problem bellow:
mArea5{ onClicked: { if(shuffle_background.color == "#ffffff") { }else{ rect.color = "#005757" rect1.color = "#005757" rect2.color = "#005757" rect3.color = "#005757" rect4.color = "#005757" rect5.color = "white" shuffle_background.color = "#005757" //font_color_change text1.color = "white" text2.color = "white" text3.color = "white" text4.color = "white" text5.color = "white" row_value = 5 } } } states: [ State { name: "f5" PropertyChanges { target: mArea5 ; clicked:(mArea5) } }, State { name: "f4" PropertyChanges { target: mArea4 ; pressed:(true) } } ]I want to select the state "f5" from other qml file, resulting in emulated click of "mArea5", how should I do this?
Thanks in advance! -
Hello, I'm looking for solution of the problem bellow:
mArea5{ onClicked: { if(shuffle_background.color == "#ffffff") { }else{ rect.color = "#005757" rect1.color = "#005757" rect2.color = "#005757" rect3.color = "#005757" rect4.color = "#005757" rect5.color = "white" shuffle_background.color = "#005757" //font_color_change text1.color = "white" text2.color = "white" text3.color = "white" text4.color = "white" text5.color = "white" row_value = 5 } } } states: [ State { name: "f5" PropertyChanges { target: mArea5 ; clicked:(mArea5) } }, State { name: "f4" PropertyChanges { target: mArea4 ; pressed:(true) } } ]I want to select the state "f5" from other qml file, resulting in emulated click of "mArea5", how should I do this?
Thanks in advance! -
Thank you @J.Hilk !
I'm posting the solution:
mArea5{ onClicked: { on_f5_clicked() } } states: [ State { name: "f5" StateChangeScript{ name: "f5Script" script: on_f5_clicked() } ] function on_f5_clicked() { if(shuffle_background.color == "#ffffff") { }else{ rect.color = "white" rect1.color = "#005757" rect2.color = "#005757" rect3.color = "#005757" rect4.color = "#005757" rect5.color = "#005757" shuffle_background.color = "#005757" //font_color_change text1.color = "black" text2.color = "white" text3.color = "white" text4.color = "white" text5.color = "white" row_value = 4 } }