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. QListWidget never minimum size
Qt 6.11 is out! See what's new in the release blog

QListWidget never minimum size

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.6k Views
  • 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.
  • M Offline
    M Offline
    MatthewH
    wrote on last edited by
    #1

    I'm trying to use a QListWidget with a list that can have as few as one or two items. I would like the list to be as small as the items it contains, but no matter what I try the minimum obtainable size is always 78x52 (as reported by viewportSizeHint) which is enough vertical space for about 5 or 6 items.

    Also, if I let it, the QListWidget tries to push itself even lager with a minimum vertical space for about 15 items. Where is this minimum coming from? It seems the only way to get the control smaller is by using a fixed size policy, and then setting the size manually (which I don't want to have to do).

    Is there a way to get a QListWidget to resize down to a size of one item?

    Thanks,
    Matthew

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      listWidget->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      3

      • Login

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