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

QComboBox editable / non-editable different item height

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Won't Do
    • Affects Version/s: 5.15.2, 6.0.0 RC
    • Fix Version/s: None
    • Component/s: GUI: High-DPI
    • Labels:
      None
    • Environment:
      Monitor 2560x1440 screen resolution
      Windows 10 Professional 64 bit with 150% scaling enabled
      Linux / KDE Plasma 5.20.3 with 150% scaling enabled
    • Platform/s:
      Linux/X11, Windows

      Description

      If High-DPI-Scaling is enabled QComboxBox item height differs for editable and non-editable comboboxes. For a 2560x1440 screen in my opinion the item height of non-editable QCombox is too large. The item height of editable QComboBox fits better for that resolution. Either way the item height should be the same for editable and non-editable QComboBox.

      This issue might also affect other control-widgets that got listboxes.

      An Qt 6.0 example application:

      #include <QApplication>
      #include <QWidget>
      #include <QComboBox>
      #include <QStringList>
      #include <QLabel>
      
      int main(int argc, char *argv[])
      {
          // Add this line if using Qt 5.15.2
          // QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling).
          
          QApplication a(argc, argv);
          QWidget w;
          w.resize(470,305);
      
          QStringList stringList = {"Item1", "Item2", "Item3", "Item4", "Item5", "Item6", "Item7", "Item8", "Item9", "Item10"};
      
          QLabel label1("ComboBox 1", &w);
          label1.setGeometry(22, 13, 150, 15);
      
          QComboBox combo1(&w);
          combo1.setGeometry(20,30,200,25);
          combo1.setFont(QFont("Roboto", 10));
          combo1.addItems(stringList);
      
          QLabel label2("ComboBox 2 editable", &w);
          label2.setGeometry(252, 13, 150, 15);
      
          QComboBox combo2(&w);
          combo2.setGeometry(250,30,200,25);
          combo2.setFont(QFont("Roboto", 10));
          combo2.setEditable(true);
          combo2.addItems(stringList);
      
          w.show();
          return a.exec();
      }
      

       

        Attachments

        1. comboBox1.png
          comboBox1.png
          32 kB
        2. comboBox2.png
          comboBox2.png
          33 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            sorvig Morten Sørvig
            Reporter:
            mireiner Chris
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes