Dynamic tab



  • Hi,

    I've been trying to add dynamically tabs but I can't make it work. Here what have write for now.

    @import Qt 4.7

    Rectangle{
    id:window
    width: 360
    height: 360
    color: "transparent"

    TabWidget{
    id: tabs
    anchors.fill:parent

    Rectangle {color: "red"; width: 20; height: 20}
    }

    function addImage()
    {
    try {
    var newObject = Qt.createQmlObject('import QtQuick 1.0; Rectangle {color: "red"; width: 20; height: 20}',tabs, "tab");
    } catch(err) {
    console.log('Error on line ' + err.qmlErrors[0].lineNumber + '\n' + err.qmlErrors[0].message);
    }
    }

    MouseArea {
    anchors.fill: parent
    onClicked: {
    window.addImage();
    }
    }
    }@

    With TabWidget taken from the example.
    If someone know how to make it work..
    Thanks.


Log in to reply
 

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