Replace QPalette::Background with QPalette::Window
This commit is contained in:
@@ -325,7 +325,7 @@ QColor ensureContrast(const QColor &bg, const QColor &fg, uint amount) {
|
|||||||
|
|
||||||
void BlockAnalyzer::paletteChange(const QPalette&) {
|
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));
|
const QColor fg = ensureContrast(bg, palette().color(QPalette::Highlight));
|
||||||
|
|
||||||
topbarpixmap_.fill(fg);
|
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)));
|
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
|
// make a complimentary fadebar colour
|
||||||
// TODO dark is not always correct, dumbo!
|
// TODO dark is not always correct, dumbo!
|
||||||
int h, s, v;
|
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 QColor fg2(QColor::fromHsv(h + 120, s, v));
|
||||||
|
|
||||||
const double dr2 = fg2.red() - bg2.red();
|
const double dr2 = fg2.red() - bg2.red();
|
||||||
@@ -358,7 +358,7 @@ void BlockAnalyzer::paletteChange(const QPalette&) {
|
|||||||
|
|
||||||
// Precalculate all fade-bar pixmaps
|
// Precalculate all fade-bar pixmaps
|
||||||
for (uint y = 0; y < kFadeSize; ++y) {
|
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]);
|
QPainter f(&fade_bars_[y]);
|
||||||
for (int z = 0; static_cast<uint>(z) < rows_; ++z) {
|
for (int z = 0; static_cast<uint>(z) < rows_; ++z) {
|
||||||
const double Y = 1.0 - (log10(kFadeSize - y) / log10(kFadeSize));
|
const double Y = 1.0 - (log10(kFadeSize - y) / log10(kFadeSize));
|
||||||
@@ -377,7 +377,7 @@ void BlockAnalyzer::drawBackground() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QColor bg = palette().color(QPalette::Background);
|
const QColor bg = palette().color(QPalette::Window);
|
||||||
const QColor bgdark = bg.darker(112);
|
const QColor bgdark = bg.darker(112);
|
||||||
|
|
||||||
background_.fill(bg);
|
background_.fill(bg);
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ void BoomAnalyzer::resizeEvent(QResizeEvent* e) {
|
|||||||
|
|
||||||
barPixmap_ = QPixmap(kColumnWidth - 2, HEIGHT);
|
barPixmap_ = QPixmap(kColumnWidth - 2, HEIGHT);
|
||||||
canvas_ = QPixmap(size());
|
canvas_ = QPixmap(size());
|
||||||
canvas_.fill(palette().color(QPalette::Background));
|
canvas_.fill(palette().color(QPalette::Window));
|
||||||
|
|
||||||
QPainter p(&barPixmap_);
|
QPainter p(&barPixmap_);
|
||||||
for (uint y = 0; y < HEIGHT; ++y) {
|
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;
|
const uint MAX_HEIGHT = height() - 1;
|
||||||
|
|
||||||
QPainter canvas_painter(&canvas_);
|
QPainter canvas_painter(&canvas_);
|
||||||
canvas_.fill(palette().color(QPalette::Background));
|
canvas_.fill(palette().color(QPalette::Window));
|
||||||
|
|
||||||
Analyzer::interpolate(scope, scope_);
|
Analyzer::interpolate(scope, scope_);
|
||||||
|
|
||||||
|
|||||||
@@ -90,9 +90,8 @@ void StyleSheetLoader::UpdateStyleSheet(QWidget *widget, StyleSheetData styledat
|
|||||||
.arg(alt.alpha()));
|
.arg(alt.alpha()));
|
||||||
|
|
||||||
ReplaceColor(&stylesheet, "Window", p, QPalette::Window);
|
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, "WindowText", p, QPalette::WindowText);
|
||||||
ReplaceColor(&stylesheet, "Foreground", p, QPalette::Foreground);
|
|
||||||
ReplaceColor(&stylesheet, "Base", p, QPalette::Base);
|
ReplaceColor(&stylesheet, "Base", p, QPalette::Base);
|
||||||
ReplaceColor(&stylesheet, "AlternateBase", p, QPalette::AlternateBase);
|
ReplaceColor(&stylesheet, "AlternateBase", p, QPalette::AlternateBase);
|
||||||
ReplaceColor(&stylesheet, "ToolTipBase", p, QPalette::ToolTipBase);
|
ReplaceColor(&stylesheet, "ToolTipBase", p, QPalette::ToolTipBase);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ ErrorDialog::ErrorDialog(QWidget *parent)
|
|||||||
QPixmap warning_pixmap(warning_icon.pixmap(48));
|
QPixmap warning_pixmap(warning_icon.pixmap(48));
|
||||||
|
|
||||||
QPalette messages_palette(ui_->messages->palette());
|
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_->messages->setPalette(messages_palette);
|
||||||
ui_->icon->setPixmap(warning_pixmap);
|
ui_->icon->setPixmap(warning_pixmap);
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ void FreeSpaceBar::paintEvent(QPaintEvent*) {
|
|||||||
// Draw the reflection
|
// Draw the reflection
|
||||||
// Create the reflected pixmap
|
// Create the reflected pixmap
|
||||||
QImage reflection(reflection_rect.size(), QImage::Format_ARGB32_Premultiplied);
|
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);
|
QPainter p(&reflection);
|
||||||
|
|
||||||
// Set up the transformation
|
// Set up the transformation
|
||||||
@@ -124,7 +124,6 @@ void FreeSpaceBar::paintEvent(QPaintEvent*) {
|
|||||||
void FreeSpaceBar::DrawBar(QPainter* p, const QRect &r) {
|
void FreeSpaceBar::DrawBar(QPainter* p, const QRect &r) {
|
||||||
|
|
||||||
p->setRenderHint(QPainter::Antialiasing, true);
|
p->setRenderHint(QPainter::Antialiasing, true);
|
||||||
p->setRenderHint(QPainter::HighQualityAntialiasing, true);
|
|
||||||
|
|
||||||
QRect bar_rect(r);
|
QRect bar_rect(r);
|
||||||
bar_rect.setWidth(float(bar_rect.width()) * (float(total_ - free_) / total_));
|
bar_rect.setWidth(float(bar_rect.width()) * (float(total_ - free_) / total_));
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ void VolumeSlider::generateGradient() {
|
|||||||
QPainter p(&gradient_image);
|
QPainter p(&gradient_image);
|
||||||
|
|
||||||
QLinearGradient gradient(gradient_image.rect().topLeft(), gradient_image.rect().topRight());
|
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));
|
gradient.setColorAt(1, palette().color(QPalette::Highlight));
|
||||||
p.fillRect(gradient_image.rect(), QBrush(gradient));
|
p.fillRect(gradient_image.rect(), QBrush(gradient));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user