Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-111620

QComboBox with AdjustToContents does not update minimum size hint

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.15.11, 6.2.6, 6.4.1
    • None

      When a QComboBox has "AdjustToContents" set and model data is dynamically added/changed the minimum size hint of the QComboBox is not updated.

      This is not the case for the normal size hint, which is correctly updated every time the model changes.

      The only trigger that can cause the minimum size hint to be recalculated is a StyleChange event. I could not find any other place where the cached minimum size hint is cleared.

      How to reproduce with the provided example:

      (you can hover over combo box to see the current minimum size hint)

      1) start the application and click the "insert item" button

      combo box stays the same width because the minimum size hint is not updated

      2) click on the "style change event" button

      combo box is resized to correct size because the event has trigger a recalculation of the minimum size hint

        1. combobox_size_issue.pro
          0.6 kB
        2. main.cpp
          0.2 kB
        3. mainwindow.cpp
          2 kB
        4. mainwindow.h
          0.3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            roman_schuh Roman Schuh
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes