2017-07-06 8 views
0

Wie kann ich Tabs in TabView in Qt Schnell QML ändern ist mein Codeändern Tab programmatisch in TabView Qt QML

TabView { 
     id: main_tab 
     width: 799 
     height: 560 
     tabsVisible: false 

     Tab { 
      id: home_tab 
      source: "Home.qml" 
      title: "Home" 
     } 
     Tab { 
      id: led_tab 
      source: "Led.qml" 
      title: "Led" 
     } 
} 

Ich habe versucht, neue Reiter main_tab.getTab(1).active = true zu setzen, aber es war kein Erfolg.

Antwort

2

Sie haben die currentIndex Eigenschaft Ihres TabView zu ändern:

main_tab.currentIndex = 0 // Will show home_tab 
main_tab.currentIndex = 1 // Will show led_tab