PDA

View Full Version : How to connect functions of QML files?



Yonetici
20th July 2012, 19:27
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:



...

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?

wysota
20th July 2012, 19:35
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.

Yonetici
20th July 2012, 19:47
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 :)