Results 1 to 1 of 1

Thread: [SOLVED] Unable to delete Item from QListWidget, not even clear()ing works

  1. #1
    Join Date
    Apr 2015
    Posts
    11
    Qt products
    Qt5
    Platforms
    Windows

    Default [SOLVED] Unable to delete Item from QListWidget, not even clear()ing works

    Here's my code and I've verified that it's hitting all the right points with the debugger:

    Qt Code:
    1. def deleteLedItems(self):
    2. for ledItem in self.selectedLedItems:
    3. self.ledListWidget.removeItemWidget(ledItem)
    4.  
    5. count = self.ledListWidget.count() # Here, even after entering above loop, count is still 1, when it should be 0
    6. self.selectedLedItems.clear()
    To copy to clipboard, switch view to plain text mode 

    I had similar issues before with deleting rows from a QTableWidget which made me have to not use it. Hopefully that won't be the case here. Please guide me!

    Oh yeah, I'm using PyQt5

    Thanks.

    Regards, -EM


    Added after 18 minutes:


    self.ledListWidget.clear() works, nvm!
    Last edited by enjoysmath; 4th August 2015 at 03:37.

Similar Threads

  1. Replies: 1
    Last Post: 20th March 2011, 08:12
  2. Does QTableWidget::clear() delete pointers?
    By Slewman in forum Qt Programming
    Replies: 5
    Last Post: 21st January 2011, 17:09
  3. Replies: 3
    Last Post: 21st July 2010, 08:40
  4. QListWidget - clear()
    By Carlsberg in forum Qt Programming
    Replies: 3
    Last Post: 3rd June 2010, 08:01
  5. Does clear()/clearContents() delete items?
    By vycke in forum Qt Programming
    Replies: 1
    Last Post: 31st July 2008, 18:49

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.