Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QML - Change a TabView height following its tab child



  • I would like to change a TabView height following its tab child.

    I expect the tabview height is changed to have a height of tab child when currentTab is changed. However, it didn't work with my code below.

    For instance)

    • Tab1 selected: TabView.height: 30 (including tab head and frame)
    • Tab2 selected: TabView.height: 60 (including tab head and frame)

    Could you help me this?

    TabView {
        Tab {
            title: "tab1"
    
            RowLayout {
                Text {
                    text: "Text1"
                }
            }
        }
        Tab {
            title: "tab2"
    
            RowLayout {
                Text {
                    text: "Text1"
                }
                Text {
                    text: "Text2"
                }
                Text {
                    text: "Text3"
                }
            }
        }
    }
    

Log in to reply