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

Incorrect colour name returned when handling colorSchemeChanged

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.5.3, 6.6.0 Beta4, 6.7.0 FF
    • 6.5.0
    • GUI: Other
    • None
    • Windows 11 22H2
    • Windows
    • 39882a135 (dev), 5929b175f (6.5), 35ee5b4eb (6.6)

    Description

      I have a class that initialises a colour name in the ctor initialiser list:

       

      windowColourName{ palette().color(QPalette::ColorRole::Window).name()}, // Default base window colour
      {{}}
       
      

      If the active windows theme is a Light theme it is set to "#f0f0f0" at that point.

      If the active windows theme is a Dark theme it is set to "#1e1e1e"

      If I switch themes, I enter this code:

      void ExplorerBar::onColorSchemeChanged(Qt::ColorScheme scheme)
      {
      //
      // Dark colour scheme?
      //
      if (Qt::ColorScheme::Dark == scheme)
      activeGroupColourName = "darkcyan";
      else
      activeGroupColourName = "lightcyan";
      windowColourName = palette().color(QPalette::ColorRole::Window).name(); // Default base window colour
      const auto tabID = dssApp->tab();
      if (IDD_REGISTERING == tabID)
      { 
      ui->registerAndStack->setStyleSheet(QString("background-color: %1").arg(activeGroupColourName)); ui->processing->setStyleSheet(QString("background-color: %1").arg(windowColourName)); }
      else
      {
      ui->registerAndStack->setStyleSheet(QString("background-color: %1").arg(windowColourName));
      ui->processing->setStyleSheet(QString("background-color: %1").arg(activeGroupColourName));
      }
      ui->options->setStyleSheet(QString("background-color: %1").arg(activeGroupColourName));
      makeLinks();
      }
      

      My problem is that the line that sets windowColourName is returning #1e1e1e when switching to a light theme from a Dark theme, or #f0f0f0 when switching the other way.  

      Attachments

        For Gerrit Dashboard: QTBUG-112653
        # Subject Branch Project Status CR V

        Activity

          People

            santhoshkumar Santhosh Kumar Selvaraj
            perdrix David Partridge
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes