qt - QML: Communicating with great grandparents through signals -


i'm in process of learning qt cross platform development, , i'm trying using qml. know there lots of ways solve problem using c++, want stay true model , use qml.

here is: if using loader display qml files seen in following code, how communicate main.qml secondpage.qml?

i assumed through signals, upon further reading seems actions on signal within class sent ( using connected method). here resource on this: http://qt-project.org/doc/qt-4.8/qmlevents.html#connecting-signals-to-methods-and-signals

alternatively, may wrong design qml application. i'm trying break away using single source file before things out of hand...

main.qml:

rectangle {     id: background     ...     item{         id: item1         loader {           ....             id:pageloader;             source : "secondpage.qml"             focus:true;          } } 

in secondpage.qml have access background element directly because children have access of parents in hierarchy.

another possibility declare signal in secondpage component, , connect signal component signal in great-grandparent in onloaded handler of loader. makes easier , cleaner if want component re-usable multiple times in app without assu,ing parent is.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -