How to connect functions of QML files?
Hello guys,
I have 4 different QML files (Item1.qml ; Item2.qml ; Item3.qml ; Item4.qml) and a MainPage.qml file. I use them like this:
Code:
...
Item1 {
id: item1
...
}
Item2 {
id: item2
...
}
Item3 {
id: item3
...
}
Item4 {
id: item4
...
}
...
I added this code to my main file, MainPage.qml, and it works perfectly with my animations. However I have a problem: 4 different Item file has same function and I want to use these functions together (for example if it is a calculation function, then, I want to add my main file total calculation).
How can I connect them? Any idea?
Re: How to connect functions of QML files?
Put the functions in a separate javascript file, add ".pragma library" at the beginning of the file and import that file into each of the files.
Re: How to connect functions of QML files?
Quote:
Originally Posted by
wysota
Put the functions in a separate javascript file, add ".pragma library" at the beginning of the file and import that file into each of the files.
ok, I will do :)