How to set focus on tabs button



  • Hi!
    I have to specify order of passage buttons in TabView including its header (buttons on tab bar).
    If I don't use KeyNavigation I can navigate (by Tab key) through my buttons (b11, b12) and header of TabView (tab1, tab2, tab3).
    But, if I use KeyNavigation I can navigate only through buttons (b11, b12).
    How to specify tab bar in KeyNavigation.tab: ??? (I try set 'tab' and 'tabView' - doesn't work.)
    Is there another way to set focus on header of TabView?

    Build with Desktop Qt 5.7.0 MSVC2015 32bit

    import QtQuick 2.7
    import QtQuick.Window 2.2
    import QtQuick.Layouts 1.1
    import QtQuick.Controls 1.4
    import QtQuick.Controls.Styles 1.2
    
    Window {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
    
        TabView {
            id: tabView
            anchors.fill: parent
            Tab {
                id: tab1
                title: 'tab1'
                Row {
                    Button { id: b11; text: 'b11'; KeyNavigation.tab: b12 }
                    Button { id: b12; text: 'b12'; KeyNavigation.tab: tabView /*tab1*/}
                }
            }
            Tab { title: 'tab2'; Button { text: 'b21' } }
            Tab { title: 'tab3'; Button { text: 'b31' } }
        }
    }
    

    Andrew



  • I've found a back door ))
    TabBar is first child of TabView

    KeyNavigation.tab: tabView.children[0] // it works
    

Log in to reply
 

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