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

Stylesheet bug - :read-only has no effect

    XMLWordPrintable

Details

    Description

      Opposite to [readOnly="true"] which works flawlessly, :read-only does not work.

      Code to reproduce:
      ---------------------------------------------------
      #include <QtGui>

      int main( int argc, char * argv[] )
      {
      QApplication app( argc, argv );
      QMainWindow mainWindow;
      QWidget * centralWidget = new QWidget( & mainWindow );
      mainWindow.setCentralWidget( centralWidget );
      QHBoxLayout * layout = new QHBoxLayout;
      centralWidget->setLayout( layout );

      QPlainTextEdit * edit1 = new QPlainTextEdit( centralWidget );
      layout->addWidget( edit1 );

      QPlainTextEdit * edit2 = new QPlainTextEdit( centralWidget );
      edit2->setReadOnly( true );
      layout->addWidget( edit2 );

      QString s = "QPlainTextEdit

      { background-color: blue; }

      "
      // WORKS
      //"QPlainTextEdit[readOnly=\"true\"]

      { background-color: red; }

      ";
      // DOES NOT WORK
      "QPlainTextEdit:read-only

      { background-color: red; }

      ";
      app.setStyleSheet( s );

      mainWindow.show();
      return app.exec();
      }
      ---------------------------------------------------

      Attachments

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

        Activity

          People

            goffart Olivier Goffart (closed Nokia identity) (Inactive)
            admin Administrator
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes