Use a stylesheet instead of QPalette for consistency across styles

This commit is contained in:
Luis Ángel San Martín
2024-12-24 08:40:22 +01:00
parent 6f1f53f487
commit 32e506e1dc

View File

@ -57,9 +57,7 @@ Viewer::Viewer(QWidget *parent)
setFrameStyle(QFrame::NoFrame); setFrameStyle(QFrame::NoFrame);
setAlignment(Qt::AlignCenter); setAlignment(Qt::AlignCenter);
QPalette palette; updateBackgroundColor(Configuration::getConfiguration().getBackgroundColor());
palette.setColor(backgroundRole(), Configuration::getConfiguration().getBackgroundColor());
setPalette(palette);
//--------------------------------------- //---------------------------------------
mglass = new MagnifyingGlass( mglass = new MagnifyingGlass(
Configuration::getConfiguration().getMagnifyingGlassSize(), Configuration::getConfiguration().getMagnifyingGlassSize(),
@ -1032,9 +1030,7 @@ void Viewer::updateOptions()
void Viewer::updateBackgroundColor(const QColor &color) void Viewer::updateBackgroundColor(const QColor &color)
{ {
QPalette palette; setStyleSheet(QString("background-color: %1;").arg(color.name()));
palette.setColor(backgroundRole(), color);
setPalette(palette);
} }
void Viewer::animateShowTranslator() void Viewer::animateShowTranslator()
@ -1099,9 +1095,7 @@ void Viewer::updateConfig(QSettings *settings)
{ {
goToFlow->updateConfig(settings); goToFlow->updateConfig(settings);
QPalette palette; updateBackgroundColor(Configuration::getConfiguration().getBackgroundColor());
palette.setColor(backgroundRole(), Configuration::getConfiguration().getBackgroundColor());
setPalette(palette);
} }
// deprecated // deprecated