Results 1 to 4 of 4

Thread: createQmlObject - does not add Tab to Tabs

  1. #1
    Join Date
    Dec 2004
    Location
    London
    Beans
    7

    [SOLVED] createQmlObject - does not add Tab to Tabs

    I have the following snippet from my qml app. Can anyone explain why the second tab does not show. There is no error reported.

    Code:
        Tabs {
            id: tabs
            anchors.fill: parent
            Component.onCompleted: {
            mainView.initializeDB();
            var feedTab = Qt.createQmlObject('import QtQuick 2.0;import Ubuntu.Components 0.1;Tab {anchors.fill: parent;objectName: "Tab";title: i18n.tr("Tab");page: Page {anchors.margins: units.gu(2);Column {anchors.centerIn: parent;Label {id: label;objectName: "label";text: i18n.tr("Tab");}}}}',tabs,"feedTab");
            }
            
            Tab {
                id: tabFrontPage
                objectName: "tabFrontPage"
                
                title: i18n.tr("Front Page")
                
                // Tab content begins here
                page: Page {
                    Column {
                        anchors.centerIn: parent
                        Label {
                            id: labelFrontPage
                            text: i18n.tr("This will be the front page \n An aggregation of the top stories from each feed")
                        }
                    }
                }
            }
        }
    Last edited by morchuboo; February 27th, 2013 at 07:11 PM. Reason: solved

  2. #2
    Join Date
    May 2007
    Beans
    41

    Re: createQmlObject - does not add Tab to Tabs

    Tabs contains a VisualItemModel called tabsModel,so maybe you need to use tabs.tabsModel as the parent object?

  3. #3
    Join Date
    Dec 2004
    Location
    London
    Beans
    7

    Re: createQmlObject - does not add Tab to Tabs

    Quote Originally Posted by mhall119 View Post
    Tabs contains a VisualItemModel called tabsModel,so maybe you need to use tabs.tabsModel as the parent object?
    I tried tabs.__tabsModel (as well as tabs.__tabs) but same issue - no error reported and no additional tab...

  4. #4
    Join Date
    Dec 2004
    Location
    London
    Beans
    7

    Re: createQmlObject - does not add Tab to Tabs

    See my question on askubuntu:
    http://askubuntu.com/questions/26148...ng-tab-to-tabs
    VisualItemModel, upon which Tabs component is implemented does not currently support appending so cannot be done.
    My workaround is to generate the whole Tabs collection in a function. Messy but works until functionality is added upstream.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •