Issue
I'm adding an item to a QListWidget, and although I can get the specifics of the item back from the QListQidget, the new item never appears on the screen. Is it possible to refresh the QListWidget to have it update to display newer contents?
>>>myQListWidget.addItem("Hello")
>>>print self.myQListWidget.item(0).text()
Hello
I'm doing this in Python, but if you have the solution in C++ I can easily convert it.
Thanks!
--Erin
Solution
You can update the widget's view by calling update()
or repaint()
, the second function is asynchronous and forces widget to update immediately. But the QListWidget should update automatically after insertion without calling any extra functions, if not, then the problem could be that Qt can't process the paint events. Then you have to call QCoreApplication::processEvents()
, but I am not sure if it is your problem.
Answered By - vitakot
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.