Merge pull request #2057 from FearlessTobi/port-4586
Port citra-emu/citra#4586: "Use QPixmap/QIcon for background color selection button"
This commit is contained in:
commit
c357d8f6f7
|
@ -62,9 +62,7 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
||||||
const QColor new_bg_color = QColorDialog::getColor(bg_color);
|
const QColor new_bg_color = QColorDialog::getColor(bg_color);
|
||||||
if (!new_bg_color.isValid())
|
if (!new_bg_color.isValid())
|
||||||
return;
|
return;
|
||||||
bg_color = new_bg_color;
|
UpdateBackgroundColorButton(new_bg_color);
|
||||||
ui->bg_button->setStyleSheet(
|
|
||||||
QString("QPushButton { background-color: %1 }").arg(bg_color.name()));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,10 +74,8 @@ void ConfigureGraphics::setConfiguration() {
|
||||||
ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit);
|
ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit);
|
||||||
ui->frame_limit->setValue(Settings::values.frame_limit);
|
ui->frame_limit->setValue(Settings::values.frame_limit);
|
||||||
ui->use_accurate_gpu_emulation->setChecked(Settings::values.use_accurate_gpu_emulation);
|
ui->use_accurate_gpu_emulation->setChecked(Settings::values.use_accurate_gpu_emulation);
|
||||||
bg_color = QColor::fromRgbF(Settings::values.bg_red, Settings::values.bg_green,
|
UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red, Settings::values.bg_green,
|
||||||
Settings::values.bg_blue);
|
Settings::values.bg_blue));
|
||||||
ui->bg_button->setStyleSheet(
|
|
||||||
QString("QPushButton { background-color: %1 }").arg(bg_color.name()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureGraphics::applyConfiguration() {
|
void ConfigureGraphics::applyConfiguration() {
|
||||||
|
@ -92,3 +88,13 @@ void ConfigureGraphics::applyConfiguration() {
|
||||||
Settings::values.bg_green = static_cast<float>(bg_color.greenF());
|
Settings::values.bg_green = static_cast<float>(bg_color.greenF());
|
||||||
Settings::values.bg_blue = static_cast<float>(bg_color.blueF());
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ public:
|
||||||
private:
|
private:
|
||||||
void setConfiguration();
|
void setConfiguration();
|
||||||
|
|
||||||
|
void UpdateBackgroundColorButton(QColor color);
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigureGraphics> ui;
|
std::unique_ptr<Ui::ConfigureGraphics> ui;
|
||||||
QColor bg_color;
|
QColor bg_color;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue