Results 1 to 14 of 14

Thread: How to make QListView consume the space when rows decrease in height on h-resize?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2014
    Posts
    10
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default How to make QListView consume the space when rows decrease in height on h-resize?

    I have a QListView working with a custom model and a custom delegate, mainly for displaying two strings of word-wrapped text vertically on top of each other as one item.
    I've reimplemented QStyledItemDelegate::sizeHint() and everything seems to work fine.

    Except:
    1) When I resize the QListView horizontally so its width increases, the height of the individual items should shrink (due to word-wrapping). I know my delegate reports decreasing heights via its sizeHint().
    2) But somehow the view doesn't seem to "get" the items' new heights internally, which leads to gaps between the rows/items i. e. the next item is drawn further down than necessary.


    3) When I decrease the width of the widget my QListView is in the individual items' height increases. No problem with that.
    4) It only happens on horizontal resize. As soon as I vertically resize the window/widget QListView is in, all rows just "snap" into place.
    5) Similarly, as soon as my model emits a dataChanged() signal for a row with a height too large, it just snaps into place.
    6) I do call QListView::setResizeMode(QListView::Adjust);
    7) I'm using Qt 4.8.1.

    Am I missing something? Do I need to hack around this?
    Last edited by JmpNop; 20th December 2014 at 14:55.

Similar Threads

  1. How to add space b/w column and rows of gridlayout.
    By Niamita in forum Qt Programming
    Replies: 3
    Last Post: 8th July 2011, 08:55
  2. QCalendarWidget - height rows
    By pease in forum Qt Programming
    Replies: 1
    Last Post: 15th April 2010, 18:31
  3. How to set rows of QtableWidget to the same height?
    By sawerset in forum Qt Programming
    Replies: 3
    Last Post: 7th December 2008, 19:09
  4. Height of the text without balnk space at the top
    By THRESHE in forum Qt Programming
    Replies: 6
    Last Post: 19th March 2008, 14:33
  5. Replies: 2
    Last Post: 22nd January 2008, 17:10

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
  •  
Qt is a trademark of The Qt Company.