Results 1 to 10 of 10

Thread: Update value of Qlabel in QListWidgetItem

  1. #1
    Join Date
    Jun 2011
    Posts
    35
    Thanks
    16
    Qt products
    Qt3 Qt4
    Platforms
    Windows Symbian S60

    Default Update value of Qlabel in QListWidgetItem

    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)

  2. #2
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Update value of Qlabel in QListWidgetItem

    Sorry but I don't understand what you mean.

    Can you post your code/form??
    A camel can go 14 days without drink,
    I can't!!!

  3. The following user says thank you to mcosta for this useful post:

    jindoniit (2nd July 2011)

  4. #3
    Join Date
    Apr 2011
    Posts
    124
    Thanks
    1
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Default Re: Update value of Qlabel in QListWidgetItem

    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.

  5. The following user says thank you to DanH for this useful post:

    jindoniit (2nd July 2011)

  6. #4
    Join Date
    Jun 2011
    Posts
    35
    Thanks
    16
    Qt products
    Qt3 Qt4
    Platforms
    Windows Symbian S60

    Default Re: Update value of Qlabel in QListWidgetItem

    this is my code.

    i noted in my project , hope you understand my problem
    Attached Files Attached Files

  7. #5
    Join Date
    Jun 2011
    Posts
    35
    Thanks
    16
    Qt products
    Qt3 Qt4
    Platforms
    Windows Symbian S60

    Default Re: Update value of Qlabel in QListWidgetItem

    can anyone help me?

  8. #6
    Join Date
    Jun 2011
    Posts
    35
    Thanks
    16
    Qt products
    Qt3 Qt4
    Platforms
    Windows Symbian S60

    Default Re: Update value of Qlabel in QListWidgetItem

    oh, my problem is solved.

  9. #7
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Update value of Qlabel in QListWidgetItem

    How?

    Your solution may be usefull to other people.
    A camel can go 14 days without drink,
    I can't!!!

  10. #8
    Join Date
    Jun 2011
    Posts
    35
    Thanks
    16
    Qt products
    Qt3 Qt4
    Platforms
    Windows Symbian S60

    Default Re: Update value of Qlabel in QListWidgetItem

    yes, this is my demo
    Attached Files Attached Files

  11. #9
    Join Date
    Apr 2011
    Posts
    124
    Thanks
    1
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Default Re: Update value of Qlabel in QListWidgetItem

    [Never mind]

  12. #10
    Join Date
    Sep 2016
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Update value of Qlabel in QListWidgetItem

    I have a similar problem,thanks

Similar Threads

  1. Qlabel position update
    By robotics in forum Qt Programming
    Replies: 5
    Last Post: 30th May 2011, 16:08
  2. Replies: 3
    Last Post: 10th April 2011, 15:55
  3. Replies: 2
    Last Post: 29th September 2010, 17:44
  4. dynamic QLabel update
    By satanowicz in forum Newbie
    Replies: 8
    Last Post: 25th May 2010, 23:20
  5. Replies: 1
    Last Post: 29th September 2009, 19:44

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.