Merge pull request #4586 from xperia64/qt_color_button_fix

citra_qt: Use QPixmap/QIcon for background color selection button
This commit is contained in:
Weiyi Wang 2019-01-23 20:24:57 -05:00 committed by GitHub
commit 8b047a49ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,8 +46,10 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
if (!new_bg_color.isValid()) if (!new_bg_color.isValid())
return; return;
bg_color = new_bg_color; bg_color = new_bg_color;
ui->bg_button->setStyleSheet( QPixmap pixmap(ui->bg_button->size());
QString("QPushButton { background-color: %1 }").arg(bg_color.name())); pixmap.fill(bg_color);
const QIcon color_icon(pixmap);
ui->bg_button->setIcon(color_icon);
}); });
} }
@ -68,8 +70,10 @@ void ConfigureGraphics::setConfiguration() {
ui->swap_screen->setChecked(Settings::values.swap_screen); ui->swap_screen->setChecked(Settings::values.swap_screen);
bg_color = QColor::fromRgbF(Settings::values.bg_red, Settings::values.bg_green, bg_color = QColor::fromRgbF(Settings::values.bg_red, Settings::values.bg_green,
Settings::values.bg_blue); Settings::values.bg_blue);
ui->bg_button->setStyleSheet( QPixmap pixmap(ui->bg_button->size());
QString("QPushButton { background-color: %1 }").arg(bg_color.name())); pixmap.fill(bg_color);
const QIcon color_icon(pixmap);
ui->bg_button->setIcon(color_icon);
} }
void ConfigureGraphics::applyConfiguration() { void ConfigureGraphics::applyConfiguration() {