Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Dynamic tab
Qt 6.11 is out! See what's new in the release blog

Dynamic tab

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Matahari
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved