Results 1 to 3 of 3

Thread: Problem with QListWidget Updating

  1. #1
    Join Date
    Nov 2009
    Posts
    10
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Angry Problem with QListWidget Updating

    Hi All,

    In Qt 4.5.3, I am using a standard QListWidget as part of a mainwindow. It is being populated by QListWidgetItems (addItem), each of which is then linked against a custom widget (addItemWidget). When an item is selected from the list (QListWidget::itemClicked signal), I show the custom widget. The custom widget is subsequently hidden when focus changes to another item (QListWidget::currentItemChanged signal).

    The problem I am having lies in that the custom widget is significantly greater in height than the list widget's items (specifically, I've forced the list widget's items to a height of 30, and the custom widget has a height of 80). When the custom widget is shown, it covers up the list items below it. I would to know how to make the QListWidget update its layout to accommodate the changing item/widget heights.

    Help?

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem with QListWidget Updating

    wont resize() help?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Nov 2009
    Posts
    10
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Wink Re: Problem with QListWidget Updating

    No, resize() didn't do it...

    I ended up forcing a layout update by calling setFlow(QListView::TopToBottom).

    I guess what I needed was a way to either call updateLayout or emit the layoutChanged signal... however, even though I would have access to those methods from QListView, it was hidden from me as a QListWidget. As it was, I didn't need all the extras of subclassing item views or models, so ...dunno if that's the solution, per se, but at least it's updating as needed.

    Now to see how that performance is affected when I stick the application on my embedded device. Ugh.

    Thanks!

Similar Threads

  1. QListWidget selection custom painting problem
    By xeento in forum Qt Programming
    Replies: 3
    Last Post: 27th November 2008, 09:49
  2. deployment problem: msvc++ 2008 Express, Qt 4.4.3
    By vonCZ in forum Qt Programming
    Replies: 7
    Last Post: 10th November 2008, 14:38
  3. Problem updating Line edit from a thread
    By raghvendramisra in forum Qt Programming
    Replies: 5
    Last Post: 3rd December 2007, 05:05
  4. QListWidget Problem
    By pmabie in forum Qt Programming
    Replies: 1
    Last Post: 7th October 2007, 06:52
  5. Problem with QScrollArea updating from 4.0.1 to 4.1.0
    By SkripT in forum Qt Programming
    Replies: 8
    Last Post: 28th January 2006, 22:35

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.