diff options
author | xperia64 <xperiancedapps@gmail.com> | 2019-01-21 04:09:23 +0100 |
---|---|---|
committer | fearlessTobi <thm.frey@gmail.com> | 2019-01-26 15:08:54 +0100 |
commit | 32eb080e02556b4f66f23910169729c73e1a7cc2 (patch) | |
tree | bdb16aa580eaf1d256ea4ba898f0c144c21d7a44 | |
parent | Merge pull request #2054 from bunnei/scope-context-refactor (diff) | |
download | yuzu-32eb080e02556b4f66f23910169729c73e1a7cc2.tar yuzu-32eb080e02556b4f66f23910169729c73e1a7cc2.tar.gz yuzu-32eb080e02556b4f66f23910169729c73e1a7cc2.tar.bz2 yuzu-32eb080e02556b4f66f23910169729c73e1a7cc2.tar.lz yuzu-32eb080e02556b4f66f23910169729c73e1a7cc2.tar.xz yuzu-32eb080e02556b4f66f23910169729c73e1a7cc2.tar.zst yuzu-32eb080e02556b4f66f23910169729c73e1a7cc2.zip |
-rw-r--r-- | src/yuzu/configuration/configure_graphics.cpp | 20 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_graphics.h | 2 |
2 files changed, 15 insertions, 7 deletions
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 8290b4384..d21f95469 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -62,9 +62,7 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent) const QColor new_bg_color = QColorDialog::getColor(bg_color); if (!new_bg_color.isValid()) return; - bg_color = new_bg_color; - ui->bg_button->setStyleSheet( - QString("QPushButton { background-color: %1 }").arg(bg_color.name())); + UpdateBackgroundColorButton(new_bg_color); }); } @@ -76,10 +74,8 @@ void ConfigureGraphics::setConfiguration() { ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit); ui->frame_limit->setValue(Settings::values.frame_limit); ui->use_accurate_gpu_emulation->setChecked(Settings::values.use_accurate_gpu_emulation); - bg_color = QColor::fromRgbF(Settings::values.bg_red, Settings::values.bg_green, - Settings::values.bg_blue); - ui->bg_button->setStyleSheet( - QString("QPushButton { background-color: %1 }").arg(bg_color.name())); + UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red, Settings::values.bg_green, + Settings::values.bg_blue)); } void ConfigureGraphics::applyConfiguration() { @@ -92,3 +88,13 @@ void ConfigureGraphics::applyConfiguration() { Settings::values.bg_green = static_cast<float>(bg_color.greenF()); Settings::values.bg_blue = static_cast<float>(bg_color.blueF()); } + +void ConfigureGraphics::UpdateBackgroundColorButton(QColor color) { + bg_color = color; + + QPixmap pixmap(ui->bg_button->size()); + pixmap.fill(bg_color); + + const QIcon color_icon(pixmap); + ui->bg_button->setIcon(color_icon); +} diff --git a/src/yuzu/configuration/configure_graphics.h b/src/yuzu/configuration/configure_graphics.h index d6ffc6fde..f2799822d 100644 --- a/src/yuzu/configuration/configure_graphics.h +++ b/src/yuzu/configuration/configure_graphics.h @@ -23,6 +23,8 @@ public: private: void setConfiguration(); + void UpdateBackgroundColorButton(QColor color); + std::unique_ptr<Ui::ConfigureGraphics> ui; QColor bg_color; }; |