← Back to team overview

ubuntu-touch-coreapps team mailing list archive

[Ubuntu-tool-kit] dynamic Tab creation in Tabs

 

Hi Geeks,

I'm a member in RSS reader team.

What I am doing now is creating dynamic Tabs for different topics.
*Solution 1:  ( fail )*
<code>

    var component;

    var sprite;

    component = Qt.createComponent("./TabTest.qml");

    sprite = component.createObject(tabs, {});

</code>
I think the reason is that, the Tab is not the child of the Tabs, but maybe
the child of Tabs.tabsModel

*Solution 2:  ( success )*
<code>

        Repeater  // at the end inside the Tabs

        {

            id: repeater

            model: 2

            Tab{ title: i18n.tr("test") }

        }

</code>
I found this solution in Tabs's source code, but not easy to manage
them(tabs)

*Opinion:*
Is it possible to add some functions in Tabs?  like: addTab(Item),
TabAt(index), etc..   I think it will be an easy way to manage dynamic tabs

BR,
Joey

Follow ups