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

QApplication::setPalette does not change Button color role after widget is shown

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P2: Important
    • None
    • 5.8.0
    • None
    • Windows 7 SP1 x64, Ubuntu 16.04.1 amd64

    Description

      When application palette is changed before a widget is shown all color roles are applied properly. But if you change app palette after showing the widget, the Button role color does not get updated. For instance in the following code color of push button remains unchanged:

      #include <QApplication>
      #include <QPushButton>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          qApp->setStyle("fusion");
      
          QPalette palette;
          palette.setColor(QPalette::Button, Qt::black);
      
          QPushButton pb;
          pb.show();
      
          for(int i=0;i<1000;i++)
              qApp->processEvents(QEventLoop::AllEvents);
      
          qApp->setPalette(palette);
      
          return a.exec();
      }
      

      This was not the case in Qt 5.7. I have tested the code in Windows and Linux, both have this problem. It seems that the problem is only for Button role and other roles are changed properly.

      Attachments

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

        Activity

          People

            dedietri Gabriel de Dietrich (drgvond)
            nejatafshar Nejat Afshar
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes