TabView removeTab gives: Invalid attempt to destroy() an indestructible object



  • I'm trying to create a tabview in qml which allows the user to open and close tabs. However I'm getting an error message whenever the removeTab() function is called.

    E:/Qt/Qt5.5.0/5.5/msvc2013/qml/QtQuick/Controls/TabView.qml:150: Error: Invalid attempt to destroy() an indestructible object
    

    A minimal example to reproduce is

    import QtQuick 2.3
    import QtQuick.Controls 1.4
    
    Item {
        Action {
            id: closeTabAction
            shortcut: "Ctrl+W"
            onTriggered: {
                tabView.removeTab(tabView.currentIndex);
            }
        }
    
        TabView {
            id: tabView
            anchors.fill: parent
    
            Repeater {
                model: 4
                delegate: Tab {
                    title: 'tab ' + index
                }
            }
        }
    }
    

    Am I doing something wrong?

    Thanks,
    David


Log in to reply
 

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