PDA

View Full Version : Update value of Qlabel in QListWidgetItem



jindoniit
1st July 2011, 09:54
I design 1 listWidgetItem with many WidgetItem. in widgetitem include:

Label1 ( show image)
Label2 (show text)

After i was showed listWidget, I want update value for Label2 but it only update for widgetitem last. who anyone help me? (sorry for my english)

mcosta
1st July 2011, 15:53
Sorry but I don't understand what you mean.

Can you post your code/form??

DanH
1st July 2011, 18:14
The simplest approach is to keep a separate array/list of the labels that you create, keeping the array/list ordered the same as your QListWidget so that if you want to update QListWidget item #7, say, you'd update the label pointed to by array element #7.

Otherwise, use QListWidget.item to fetch a pointer to the QListWidgetItem of interest, then examine the item (based on how you originally constructed it) to locate and update the label of interest.

jindoniit
2nd July 2011, 03:57
this is my code.

i noted in my project , hope you understand my problem

jindoniit
4th July 2011, 05:21
can anyone help me?

jindoniit
4th July 2011, 08:01
oh, my problem is solved.

mcosta
4th July 2011, 12:09
How?

Your solution may be usefull to other people.

jindoniit
5th July 2011, 03:03
yes, this is my demo

DanH
5th July 2011, 17:19
[Never mind]

clever_dada
27th September 2016, 11:05
I have a similar problem,thanks