Set colours using style-sheet in Data Browser tab of Preferences

The colours of the frame and text-lines previewing the settings in Data
Browser tab need to have being set using a style-sheet, otherwise they
are eclipsed by the dark style-sheet when in use.
This commit is contained in:
mgrojo
2019-02-23 00:23:12 +01:00
parent ed178689a4
commit 20c3e9d97d

View File

@@ -473,26 +473,33 @@ void PreferencesDialog::loadColorSetting(QFrame *frame, const QString & settingN
void PreferencesDialog::setColorSetting(QFrame *frame, const QColor &color)
{
QPalette::ColorRole role;
QString style;
QLineEdit *line;
if (frame == ui->fr_bin_bg) {
line = ui->txtBlob;
role = line->backgroundRole();
style = QString("background-color");
} else if (frame == ui->fr_bin_fg) {
line = ui->txtBlob;
role = line->foregroundRole();
style = QString("color");
} else if (frame == ui->fr_reg_bg) {
line = ui->txtRegular;
role = line->backgroundRole();
style = QString("background-color");
} else if (frame == ui->fr_reg_fg) {
line = ui->txtRegular;
role = line->foregroundRole();
style = QString("color");
} else if (frame == ui->fr_null_bg) {
line = ui->txtNull;
role = line->backgroundRole();
style = QString("background-color");
} else if (frame == ui->fr_null_fg) {
line = ui->txtNull;
role = line->foregroundRole();
style = QString("color");
} else
return;
@@ -500,9 +507,14 @@ 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()));
palette = line->palette();
palette.setColor(role, color);
line->setPalette(palette);
line->setStyleSheet(QString("color: %1; background-color: %2").arg(palette.color(line->foregroundRole()).name(),
palette.color(line->backgroundRole()).name()));
}
void PreferencesDialog::saveColorSetting(QFrame *frame, const QString & settingName)