qt - Access properties from different qml tabs within same tabbedpane -


i have main.qml contains tabbedpane, in which, has 2 tabs: tab1 , tab2. able change text 1 tab another.

if same navigationpane works not tabs apparently. there way share information between them? i've tried signals in c++ doesn't work either(i guess doesnt know instance ?).

any suggestion appreciated.

main.qml:

tabbedpane { tab {     tab1 {     } } tab {     tab2 {     } } attachedobjects: [     tab1 {         id: tab1     },     tab2 {         id: tab2     }         ] } 

tab1.qml:

page { property alias labeltab1: labeltab1 container {     label {         id: labeltab1         text: "label tab1"     }     button {         id: buttontab1         text: "tab1"         onclicked: {             tab2.labeltab2.text = "this coming tab1"         }     } } } 

tab2.qml:

page { property alias labeltab2: labeltab2 container {     label {         id: labeltab2         text: "label tab2"     }     button {         id: buttontab2         text: "tab2"         onclicked: {             tab1.labeltab1.text = "this coming tab2"         }     } } } 

i guess it's simpler tabs , found own solution.

i noticed momentics cannot detect "thepane" linkable , not suggest name when typing 1 of tab. also, property colon automatically bind value afterit, as: text: thepane.mystring

when clicking on buttons, changes value of mystring changing both labels texts.

main.qml

tabbedpane { id: thepane property string mystring tab {     tab1 {      } } tab {     tab2 {      } } } 

tab1.qml

page { container {     label {         id: labeltab1         text: thepane.mystring     }     button {         id: buttontab1         text: "tab1"         onclicked: {             thepane.mystring = "this coming form tab1"         }     } } } 

tab2.qml

page { container {     label {         id: labeltab2         text: thepane.mystring     }     button {         id: buttontab2         text: "tab2"         onclicked: {             thepane.mystring = "this coming tab2"         }     } } } 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -