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

QStyledItemDelegate draws overlapping items in QComboBox

    XMLWordPrintable

Details

    Description

      The sizeHint method of the item delegate of a QComboBox is called with very different option.rect values depending on option.state. Thus it is impossible to compute an appropriate sizeHint using option.rect.width(), and when paint is later called, drop-down items are drawn overlapping.

      For example, sizeHint is called first with an option.rect with width 624, then 0, then 27, then 640, then 0, then 27, then finally 50.
      paint is only called with an option.rect with a (correct) width of 50.

      I've attached an example that illustrates the problem as well as an image with the incorrectly drawn combo drop-down.

      cheers,
      -Mark

      Attachments

        1. badcombobox.png
          12 kB
          Mark Visser
        2. comboboxdelegate.zip
          2 kB
          Mark Visser
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            mjmvisser Mark Visser
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes