Results 1 to 4 of 4

Thread: QML doesn't set the list model when adding tab dynamically the second time

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2010
    Posts
    95
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QML doesn't set the list model when adding tab dynamically the second time

    The component gets created as the reference is printed properly.

    I learned that the tab need to be active before setting the model to the new tab.

    Qt Code:
    1. if(t != null)
    2. {
    3. var last = tabview.count-1;
    4. tabview.getTab(last).active = true;
    5. t.item.partsModel = toolbarModel
    6. console.log(tabview.getTab(last).item);
    7. }
    To copy to clipboard, switch view to plain text mode 

    Thanks for the pointers.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QML doesn't set the list model when adding tab dynamically the second time

    Tab is a Loader
    "active" is the Loader's property that tells the Loader whether it should have the item loaded or not.
    So it seems it started in unloaded state.

    You could also just write
    Qt Code:
    1. t.active = true:
    To copy to clipboard, switch view to plain text mode 
    i.e. no need to get through getTab()

    Cheers,
    _

Similar Threads

  1. Dynamically adding resources
    By atomic in forum Qt Programming
    Replies: 10
    Last Post: 21st July 2015, 18:08
  2. Replies: 6
    Last Post: 25th June 2015, 10:54
  3. Adding derived objects to a list dynamically
    By alizadeh91 in forum Qt Programming
    Replies: 1
    Last Post: 19th October 2013, 14:59
  4. Replies: 1
    Last Post: 23rd April 2011, 17:33
  5. Dynamically adding tabs
    By larry104 in forum Qt Programming
    Replies: 7
    Last Post: 26th July 2006, 20:27

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
  •  
Qt is a trademark of The Qt Company.