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

QComboBox QSS padding-left Does Not Change Icon Position

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 5.15.2
    • Widgets: Style Sheets
    • None
    • Windows

    Description

      When using QSS to set the padding-left property for a QComboBox, it does not affect the positioning of the icon displayed in the combo box (subcontrol CE_ComboBoxLabel). The expected behavior is that increasing the padding-left should move the icon further to the right, but it appears that the icon remains aligned with the left edge of the combo box.

      QComboBox *comboBox = new QComboBox();
      
      comboBox->addItem(QIcon(":/path/to/icon1.png"), "Option 1");
      comboBox->addItem(QIcon(":/path/to/icon2.png"), "Option 2");
      comboBox->addItem(QIcon(":/path/to/icon3.png"), "Option 3");
      
      comboBox->setStyleSheet("QComboBox { padding-left: 20px; }"); 
      

      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
            0ices zero ices
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes