Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Does QStyledItemDelegate handle required space for the item in the view
Forum Updated to NodeBB v4.3 + New Features

Does QStyledItemDelegate handle required space for the item in the view

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nosf
    wrote on last edited by
    #1

    Say using a delegate I have a rectangle drawn in each index with varying height based on a particular width.

    When i maximise (resize) this view based on the new width available from option.rect.width() I calculate a new height for each item and the corresponding paint event draws the new rectangle as intended.

    However since the rectangle's height has come down for most elements in the maximised state the gap between elements appear larger which just looks wrong.

    Am wondering is there something i need to do extra here to tell the view that the size of each item has changed from before apart from the sizeHint property so that it draws the next element closer.

    "Normal View":http://imageshack.us/photo/my-images/849/normalview.png

    "Maximised View":http://imageshack.us/photo/my-images/708/maximisedview.png

    In Each Image the text in blue is the value of the item's height.

    Am confused since the item's height has indeed come down but the view still appears to be giving the item the same height as before

    1 Reply Last reply
    0
    • N Offline
      N Offline
      Nosf
      wrote on last edited by
      #2

      Got a solution with QListView::Adjust as resizeMode

      Seems a bit overkill to have the view lay the items everytime if a resize occurs without knowing its actually needed to re-position.

      Guess thats the only option for now tho.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved