Results 1 to 3 of 3

Thread: PyQt remove the current QTreeWidgetItem

  1. #1
    Join Date
    Jan 2009
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default PyQt remove the current QTreeWidgetItem

    Hello,

    I have in my PyQT4 application a QTreeWidget. But I can't find a function to remove the current QTreeWidgetItem. I've found the function QTreeWidget::removeItemWidget ( QTreeWidgetItem * item, int column ), but when I try this function, nothing seems to happening. I guess removeItemWidget is not to remove a total treeWidgetItem?

    Qt Code:
    1. def contextActionRemove(self):
    2. item = self.parent.ui.tree_playlist.currentItem();
    3. self.parent.ui.tree_playlist.removeItemWidget(item, 0)
    To copy to clipboard, switch view to plain text mode 

    How can I remove a QTreeWidgetItem?

    Thanks a lot!

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: PyQt remove the current QTreeWidgetItem

    "Item widgets" are widgets laid on top of items. It is possible to insert for example a QPushButton on top of a single QTreeWidgetItem. Anyway, in C++ one would simply delete the QTreeWidgetItem. There's also QTreeWidget::takeTopLevelItem() and QTreeWidgetItem::takeChild().
    J-P Nurmi

  3. #3
    Join Date
    Jan 2009
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: PyQt remove the current QTreeWidgetItem

    Thanks! QTreeWidget::takeTopLevelItem() works. Stupid that I didn't try takeTopLevelItem before...

Similar Threads

  1. Qt designer plugin errors on OSX Leopard
    By mpotocnik in forum Qt Tools
    Replies: 10
    Last Post: 21st January 2008, 09:45
  2. Distributing QT application for Mac OS
    By mb0 in forum Qt Programming
    Replies: 1
    Last Post: 31st May 2007, 18:59
  3. Replies: 15
    Last Post: 21st April 2007, 17:46

Tags for this Thread

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.