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

QComboBox sizing does not consider new lines

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.14.2
    • None
    • Windows

    Description

      Consider this sample program:

      #include <QApplication>
      #include <QDialog>
      #include <QHBoxLayout>
      #include <QComboBox>
      int main( int argc, char* argv[] )
      {
          QApplication app( argc, argv );
      
          QDialog dlg;
          new QHBoxLayout( &dlg );
      
          for ( int i = 0; i != 5; ++i )
          {
              QComboBox* box = new QComboBox();
              box->addItem( "Hello World\nHello World\nHello World" );
              dlg.layout()->addWidget( box );
          }
          dlg.show();
          return app.exec();
      }
      

      The QComboBox minimum width is way too large considering it's content. Looks like it's based on characters count, not on it's actual content, it should be three times smaller.

      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
            jpo38 Jean Porcherot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes