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

QLineEdit inside QComboBox looses style

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Not Evaluated Not Evaluated
    • None
    • 4.6.2
    • Widgets: Style Sheets
    • None
    • Debian Squueze, Qt 4.6.2, gcc 4.4

      Consider the folowing example:

          QComboBox *bb = new QComboBox;
          QLineEdit *lb = new QLineEdit;
          bb->setDuplicatesEnabled(false);
          bb->setEditable(true);
          bb->setLineEdit(lb);
          bb->addItem("1");
          bb->addItem("2");
          bb->addItem("3");
      
          bb->setStyleSheet("QComboBox{color:cyan}");
          lb->setStyleSheet("QLineEdit{color:magenta}");
          bb->show();
      

      QComboBox should have "color" set to "cyan", and QLineEdit should have "color" set to "magenta". But if I compile and run this example, text in QLineEdit will have "cyan" color. If I remove "bb->setStyleSheet("QComboBox");", QLineEdit will have "magenta" color as expected. It seems that QComboBox replaces QLineEdit's style.

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

            goffart Olivier Goffart (closed Nokia identity) (Inactive)
            dmitry64 Dmitry
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes