Results 1 to 2 of 2

Thread: Child items do not appear in QStandardItemModel

  1. #1
    Join Date
    Jun 2010
    Posts
    142
    Thanks
    11
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Child items do not appear in QStandardItemModel

    I have a QTreeView set to use a QStandardItemModel, and I add some items to it like this:

    Qt Code:
    1. QStandardItem *i1 = new QStandardItem("test item");
    2. QStandardItem *i2 = new QStandardItem("sub item");
    3. i1->appendRow(i2);
    4. m_tabModel->appendRow(i1);
    To copy to clipboard, switch view to plain text mode 

    "test item" appears, but "sub item" does not. What's wrong?

  2. #2
    Join Date
    Jun 2010
    Posts
    142
    Thanks
    11
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Child items do not appear in QStandardItemModel

    I found the problem, I needed to call expandAll() on the view.

Similar Threads

  1. Getting Child Items from QStandardItemModel
    By nikhilqt in forum Qt Programming
    Replies: 4
    Last Post: 4th June 2013, 15:10
  2. Replies: 0
    Last Post: 11th July 2011, 09:31
  3. QStandardItemModel, parent / child to form tree structure
    By Nightfox in forum Qt Programming
    Replies: 2
    Last Post: 8th January 2010, 17:01
  4. Replies: 2
    Last Post: 24th August 2008, 14:42
  5. Replies: 2
    Last Post: 23rd July 2008, 17:48

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.