Results 1 to 4 of 4

Thread: How to delete a node in treeview?

  1. #1
    Join Date
    Nov 2009
    Posts
    5
    Thanks
    1

    Smile How to delete a node in treeview?

    I want to delete a node in the treeview, how can i do it ?

  2. #2
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to delete a node in treeview?

    Quote Originally Posted by jasonjoy View Post
    I want to delete a node in the treeview, how can i do it ?
    Delete it from associated model and it will be deleted from view also.

  3. #3
    Join Date
    Nov 2009
    Posts
    5
    Thanks
    1

    Default Re: How to delete a node in treeview?

    but how can i delete it from associated model? Is there any ready-to-use function?

  4. #4
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to delete a node in treeview?

    Quote Originally Posted by jasonjoy View Post
    but how can i delete it from associated model? Is there any ready-to-use function?
    Yes !!
    For example you are using QDirModel, so you can use:
    Qt Code:
    1. bool QDirModel::remove ( const QModelIndex & index )
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. how to justfy a node is leaf node or not
    By weixj2003ld in forum Qt Programming
    Replies: 4
    Last Post: 9th April 2009, 07:40
  2. Replies: 4
    Last Post: 19th February 2009, 11:10
  3. Best way for a graphicsitem to delete itself
    By pherthyl in forum Qt Programming
    Replies: 7
    Last Post: 22nd June 2008, 05:57
  4. QTreeView restore Expanded node after reload model
    By patrik08 in forum Qt Programming
    Replies: 3
    Last Post: 26th May 2008, 17:42
  5. c++, placement delete upon exception
    By stinos in forum General Programming
    Replies: 6
    Last Post: 31st October 2006, 15:38

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.