QML set tab property from outside



  • I need to set tabview tab item property from outside tab, but below giving me the error. where CustomItem is a custom qml component.

    Rectangle {
            id: main_background
    
       TabView {
                id: setting_tab
      
                Tab {
                      CustomItem{
                         id: customId
                          indexofitem: -1
                      }
                }
    }
    
    //this function call from another qml
     function changeIndex(idx){
           customId.indexofitem = idx
     }
    }
    

  • Moderators

    @haris123 If CustomItem is the only child inside Tab then a simple way:

    setting_tab.getTab(0).children[0].indexofitem
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.