Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.7.1
-
None
-
openSUSE Leap 42.2
-
52d9fd74b13e7c730cd3f353bfbc7a64b15e9038
Description
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 }