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

QComboBox content is vertically misaligned on macOS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.12
    • None
    • macOS

    Description

      I believe this is a bug long present in Qt5, something similar (likely related) was reported in QTBUG-40442 back in '14 for Qt5.2.1.

      In the combobox (not its dropdown), the contents appear to be placed a pixel or two too high.

      This can nicely be seen by putting an icon into the combobox, as shown in the screenshot. There's a spacing of two pixels above and 5 pixels below the icon.

      The expected behaviour is that there should be equal spacing below and above the icon, as it is in the dropdown.

      Minimal code example

      class Window(QMainWindow):
      
          def __init__(self):
              super().__init__()
              self.setWindowTitle("Python ")
              self.setGeometry(100, 100, 400, 200)
              self.UiComponents()
              self.show()
      
          def UiComponents(self):
              self.combo_box = QComboBox(self)
              self.combo_box.setGeometry(200, 100, 120, 30)
      
              geek_list = ["Geek", "Geeky Geek"]
              self.combo_box.addItems(geek_list)
              icon = QIcon("Grid.svg")
              self.combo_box.setItemIcon(0, icon)
      
      App = QApplication(sys.argv)
      window = Window()
      sys.exit(App.exec())
      

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            irgolic Rafael Irgolič
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes