Stop combobox getting too wide

  • 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?

  • Use the sizeHint parameter

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.