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

MacOS / PyQt: Qt ComboBox does not scale with font size.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.2.0
    • None
    • MacOS Big Sur
    • macOS

    Description

      The following minimal python code illustrates the problem. It produces a QLineEdit and a QComboBox arranged vertically, with font size 40. The LineEdit is rendered correctly, whereas the ComboBox does not expand vertically; also the check mark and the text overlap. On Ubuntu however this works as expected.

      import sys
      from PyQt6 import QtWidgets as qtw
      
      if __name__ == '__main__':
          app = qtw.QApplication([])
      
          widget = qtw.QWidget()
          lineEdit = qtw.QLineEdit()
          lineEdit.setText('This is font size 40')
          comboBox = qtw.QComboBox()
          comboBox.addItem('My first item')
          comboBox.addItem('My second item')
          
          # Set font size.
          font = lineEdit.font()
          font.setPointSize(40)
          lineEdit.setFont(font)
          comboBox.setFont(font)
          
          # Set layout
          layout = qtw.QVBoxLayout()
          layout.addWidget(lineEdit)
          layout.addWidget(comboBox)
          widget.setLayout(layout)
          widget.show()
      
          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
            mwisse Marco Wisse
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes