Call main.qml function from another qml
-
wrote on 29 May 2018, 10:43 last edited by
Hello,
I have a function in my main.qml I would like to know how can I access it from another qml file.
For example :
main.qml contains funct1()
in my foo.qml I want to do something like main.funct1()Is this possible ?
Thank you in advance
-
wrote on 29 May 2018, 11:30 last edited by
Well everything should be "contained" in the main file any way, so each element of the other files should have as parent the main "Window" or "ApplicationWindow", so unless your app has a structure that deviates from the "standard" you could just call
funct1()
as long as you define it at the top of yourmain.qml
. -
wrote on 29 May 2018, 11:33 last edited by
Ok I understand now ! My problem was because I did not put the function at the top of the main.qml
Thanks for your help
1/3