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

Applying a stylesheet on a QTableView make cell editor to ignore table's palette background color (windows + base role)

    XMLWordPrintable

Details

    Description

      Consider the following main file:

      int main( int argc, char** argv )
      {
      QApplication app( argc, argv );
      QTableWidget table;
      table.setColumnCount( 10 );
      table.setRowCount( 10 );

      QPalette myPalette(table.palette());
      myPalette.setColor( QPalette::Window, Qt::lightGray );
      myPalette.setColor( QPalette::Base, Qt::lightGray );
      table.setPalette(myPalette);

      // This make the editor unawre of the "background" color of the table
      //table.setStyleSheet("QTableView

      { border: none; }

      ");

      table.show();

      return app.exec();
      }

      This test case shows a 10*10 table with a grey background color. When you edit a cell (double-click on it), the cell stay gray during editing.
      Now, uncomment the setStyleSheet line: the edited cell will become white during editing and return grey when the editor has been closed.

      Attachments

        1. white.png
          16 kB
          Didier Weckmann
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            bachewii Jens
            daidai67 Didier Weckmann
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes