Replace QPalette::Background with QPalette::Window

This commit is contained in:
Jonas Kvinge 2020-07-18 04:12:50 +02:00
parent 4328831fcd
commit 9b8bfdf33c
6 changed files with 11 additions and 13 deletions

View File

@ -325,7 +325,7 @@ QColor ensureContrast(const QColor &bg, const QColor &fg, uint amount) {
void BlockAnalyzer::paletteChange(const QPalette&) {
const QColor bg = palette().color(QPalette::Background);
const QColor bg = palette().color(QPalette::Window);
const QColor fg = ensureContrast(bg, palette().color(QPalette::Highlight));
topbarpixmap_.fill(fg);
@ -343,12 +343,12 @@ void BlockAnalyzer::paletteChange(const QPalette&) {
p.fillRect(0, y * (kHeight + 1), kWidth, kHeight, QColor(r + static_cast<int>(dr * y), g + static_cast<int>(dg * y), b + static_cast<int>(db * y)));
{
const QColor bg2 = palette().color(QPalette::Background).darker(112);
const QColor bg2 = palette().color(QPalette::Window).darker(112);
// make a complimentary fadebar colour
// TODO dark is not always correct, dumbo!
int h, s, v;
palette().color(QPalette::Background).darker(150).getHsv(&h, &s, &v);
palette().color(QPalette::Window).darker(150).getHsv(&h, &s, &v);
const QColor fg2(QColor::fromHsv(h + 120, s, v));
const double dr2 = fg2.red() - bg2.red();
@ -358,7 +358,7 @@ void BlockAnalyzer::paletteChange(const QPalette&) {
// Precalculate all fade-bar pixmaps
for (uint y = 0; y < kFadeSize; ++y) {
fade_bars_[y].fill(palette().color(QPalette::Background));
fade_bars_[y].fill(palette().color(QPalette::Window));
QPainter f(&fade_bars_[y]);
for (int z = 0; static_cast<uint>(z) < rows_; ++z) {
const double Y = 1.0 - (log10(kFadeSize - y) / log10(kFadeSize));
@ -377,7 +377,7 @@ void BlockAnalyzer::drawBackground() {
return;
}
const QColor bg = palette().color(QPalette::Background);
const QColor bg = palette().color(QPalette::Window);
const QColor bgdark = bg.darker(112);
background_.fill(bg);

View File

@ -87,7 +87,7 @@ void BoomAnalyzer::resizeEvent(QResizeEvent* e) {
barPixmap_ = QPixmap(kColumnWidth - 2, HEIGHT);
canvas_ = QPixmap(size());
canvas_.fill(palette().color(QPalette::Background));
canvas_.fill(palette().color(QPalette::Window));
QPainter p(&barPixmap_);
for (uint y = 0; y < HEIGHT; ++y) {
@ -120,7 +120,7 @@ void BoomAnalyzer::analyze(QPainter& p, const Scope& scope, bool new_frame) {
const uint MAX_HEIGHT = height() - 1;
QPainter canvas_painter(&canvas_);
canvas_.fill(palette().color(QPalette::Background));
canvas_.fill(palette().color(QPalette::Window));
Analyzer::interpolate(scope, scope_);

View File

@ -90,9 +90,8 @@ void StyleSheetLoader::UpdateStyleSheet(QWidget *widget, StyleSheetData styledat
.arg(alt.alpha()));
ReplaceColor(&stylesheet, "Window", p, QPalette::Window);
ReplaceColor(&stylesheet, "Background", p, QPalette::Background);
ReplaceColor(&stylesheet, "Background", p, QPalette::Window);
ReplaceColor(&stylesheet, "WindowText", p, QPalette::WindowText);
ReplaceColor(&stylesheet, "Foreground", p, QPalette::Foreground);
ReplaceColor(&stylesheet, "Base", p, QPalette::Base);
ReplaceColor(&stylesheet, "AlternateBase", p, QPalette::AlternateBase);
ReplaceColor(&stylesheet, "ToolTipBase", p, QPalette::ToolTipBase);

View File

@ -45,7 +45,7 @@ ErrorDialog::ErrorDialog(QWidget *parent)
QPixmap warning_pixmap(warning_icon.pixmap(48));
QPalette messages_palette(ui_->messages->palette());
messages_palette.setColor(QPalette::Base, messages_palette.color(QPalette::Background));
messages_palette.setColor(QPalette::Base, messages_palette.color(QPalette::Window));
ui_->messages->setPalette(messages_palette);
ui_->icon->setPixmap(warning_pixmap);

View File

@ -91,7 +91,7 @@ void FreeSpaceBar::paintEvent(QPaintEvent*) {
// Draw the reflection
// Create the reflected pixmap
QImage reflection(reflection_rect.size(), QImage::Format_ARGB32_Premultiplied);
reflection.fill(palette().color(QPalette::Background).rgba());
reflection.fill(palette().color(QPalette::Window).rgba());
QPainter p(&reflection);
// Set up the transformation
@ -124,7 +124,6 @@ void FreeSpaceBar::paintEvent(QPaintEvent*) {
void FreeSpaceBar::DrawBar(QPainter* p, const QRect &r) {
p->setRenderHint(QPainter::Antialiasing, true);
p->setRenderHint(QPainter::HighQualityAntialiasing, true);
QRect bar_rect(r);
bar_rect.setWidth(float(bar_rect.width()) * (float(total_ - free_) / total_));

View File

@ -241,7 +241,7 @@ void VolumeSlider::generateGradient() {
QPainter p(&gradient_image);
QLinearGradient gradient(gradient_image.rect().topLeft(), gradient_image.rect().topRight());
gradient.setColorAt(0, palette().color(QPalette::Background));
gradient.setColorAt(0, palette().color(QPalette::Window));
gradient.setColorAt(1, palette().color(QPalette::Highlight));
p.fillRect(gradient_image.rect(), QBrush(gradient));