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. Stop combobox getting too wide

Stop combobox getting too wide

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

    I have a QComboBox. I insert items. Some of the items are quite wide, and the QComboBox resizes horizontally to be the same size as the widest item in the list.

    This is bad. I want it to have a maximum size.

    In the ui designer in QTCreator, I have set the horizontal sizePolicy to Maximum, and I have set Width in maximumSize to 60, but it makes no difference. It still expands to the size of the largest item.

    I've had this trouble before with QT; setting a maximum size requires flicking multiple switches. What have I missed?

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      Use the sizeHint parameter

      Greetz, Jeroen

      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