Avoid style-sheet inheritance in colour chooser boxes in Preferences

This avoid propagating the style-sheet to other widgets. For example, to
the tool-tip shown in the frame. But it could also fixed the problem
reported for Windows in issue #1493:
"Editing color preferences dialog background takes the last chosen color."
"Color dialog becomes obscured by the changing color patterns of each
selection."
This commit is contained in:
mgrojo
2019-03-04 21:17:02 +01:00
parent e9d8af6059
commit 1b414b7e35

View File

@@ -509,13 +509,13 @@ void PreferencesDialog::setColorSetting(QFrame *frame, const QColor &color)
palette.setColor(frame->backgroundRole(), color);
frame->setPalette(palette);
frame->setStyleSheet(QString("background-color: %2").arg(color.name()));
frame->setStyleSheet(QString(".QFrame {background-color: %2}").arg(color.name()));
palette = line->palette();
palette.setColor(role, color);
line->setPalette(palette);
line->setStyleSheet(QString("color: %1; background-color: %2").arg(palette.color(line->foregroundRole()).name(),
line->setStyleSheet(QString(".QLineEdit {color: %1; background-color: %2}").arg(palette.color(line->foregroundRole()).name(),
palette.color(line->backgroundRole()).name()));
}