Results 1 to 2 of 2

Thread: TreeModel: removing items will make the expand/collapse button vanish

  1. #1
    Join Date
    Jun 2010
    Posts
    11
    Qt products
    Qt4
    Platforms
    Windows

    Default TreeModel: removing items will make the expand/collapse button vanish

    hi,

    i have a treemodel which is actually working fine, except removing.
    how it looks like:
    Qt Code:
    1. HEADLINE (expanded view)
    2. group1
    3. item1
    4. item2
    5. item3
    6. group2
    7. itemA
    8. itemB
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. HEADLINE (collapsed view group1)
    2. group1
    3. group2
    4. itemA
    5. itemB
    To copy to clipboard, switch view to plain text mode 
    adding is working fine.
    removing items from any expanded group does work fine.

    BUT if "group1" is collapsed and i remove an item (eg: "item3"), then the button infront of "group1" will vanish.
    i can still press that invisible button to expand "group1".
    when i add another item to "group1" the button will appear BUT only if it is expanded.

    other groups are not affected until i remove item out of them

    Qt Code:
    1. bool TreeModel::insertRows( int row , int count , const QModelIndex &parent )
    2. {
    3. TreeItem *parentItem = getItem(parent);
    4. beginInsertRows(parent, row, row + count - 1);
    5. parentItem->appendChild(tmpItem);
    6. endInsertRows();
    7. return true;
    8. }
    9. bool TreeModel::removeRows( int row , int count , const QModelIndex &parent )
    10. {
    11. TreeItem *parentItem = getItem(parent);
    12. beginRemoveRows(parent, row, row + count - 1);
    13. parentItem->removeChild(tmpItem);
    14. endRemoveRows();
    15. return true;
    16. }
    To copy to clipboard, switch view to plain text mode 

    any help or ideas ?

  2. #2
    Join Date
    Jun 2010
    Posts
    11
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: TreeModel: removing items will make the expand/collapse button vanish

    btw:
    just tested it with linux and there it is working fine. the button is a rectangle with a cross inside
    i am using win7 and the button is a triangle.

Similar Threads

  1. How can i expand a form with a push button?
    By Bong.Da.City in forum Qt Programming
    Replies: 4
    Last Post: 25th August 2010, 07:10
  2. QTreeWidget Expand/Collapse Button Size
    By Slewman in forum Qt Programming
    Replies: 3
    Last Post: 28th July 2010, 11:07
  3. Collapse/Expand button in QTreeViewWidget
    By Skorpien126 in forum Qt Programming
    Replies: 3
    Last Post: 10th June 2010, 12:30
  4. QTabbar style ::scroller to expand the tab scoll button space.
    By AmolShinde_8 in forum Qt Programming
    Replies: 0
    Last Post: 22nd February 2010, 14:40
  5. preserve collapse/expand of a QTreeView
    By yazwas in forum Qt Programming
    Replies: 1
    Last Post: 7th November 2009, 09:49

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.