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

QColorDialog writes custom colors only to the settings if they are unchanged

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 5.9.0 Beta 2
    • 5.7.1
    • None
    • openSUSE Leap 42.2
    • 52d9fd74b13e7c730cd3f353bfbc7a64b15e9038

      QColorDialog writes custom colors only to the settings, if they are unchanged. That does not make sense. You can verify this effect e.g. with "qtbase/examples/widgets/richtext/textedit/textedit". The following steps apply to LINUX.

      1a. Remove ~/.config/QtProject.conf
      2a. Within "textedit": Press "Color", press "Cancel"
      3a. Open ~/.config/QtProject.conf. You see 16 lines "customColors*" with identical values 4294967295 (#ffffffff).

      1b. Remove ~/.config/QtProject.conf
      2b. Within "textedit": Press "Color", press "Add to Custom Colors", press "Ok"
      3b. Try to open ~/.config/QtProject.conf. The file is not recreated (or the section "customColors" is empty).

      Attention: Do not use QColorDialog in other programs during the test.

      Reason for the described behaviour seems to be the line "if (!customSet)" in the following code snippet (should it be "if (customSet)"?).

      void QColorDialogStaticData::writeSettings() const
      {
      #ifndef QT_NO_SETTINGS
          if (!customSet) {
              QSettings settings(QSettings::UserScope, QStringLiteral("QtProject"));
              for (int i = 0; i < int(CustomColorCount); ++i)
                  settings.setValue(QLatin1String("Qt/customColors/") + QString::number(i), customRgb[i]);
          }
      #endif
      }
      

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

            kkohne Kai Köhne
            wschenke Winfried Schenke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes