mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix coloration of swatches on styles with distinct frame backgrounds
This commit is contained in:
parent
baf5d71f93
commit
8b887cb0ff
1
CHANGES
1
CHANGES
|
@ -71,6 +71,7 @@ Other fixes:
|
||||||
- Qt: Fix preloading for ROM replacing
|
- Qt: Fix preloading for ROM replacing
|
||||||
- Qt: Fix screen not displaying on Wayland (fixes mgba.io/i/2190)
|
- Qt: Fix screen not displaying on Wayland (fixes mgba.io/i/2190)
|
||||||
- Qt: Fix crash when selecting 256-color sprite in sprite view
|
- Qt: Fix crash when selecting 256-color sprite in sprite view
|
||||||
|
- Qt: Fix coloration of swatches on styles with distinct frame backgrounds
|
||||||
- VFS: Failed file mapping should return NULL on POSIX
|
- VFS: Failed file mapping should return NULL on POSIX
|
||||||
Misc:
|
Misc:
|
||||||
- Core: Suspend runloop when a core crashes
|
- Core: Suspend runloop when a core crashes
|
||||||
|
|
|
@ -15,11 +15,8 @@ ColorPicker::ColorPicker() {
|
||||||
|
|
||||||
ColorPicker::ColorPicker(QWidget* parent, const QColor& defaultColor)
|
ColorPicker::ColorPicker(QWidget* parent, const QColor& defaultColor)
|
||||||
: m_parent(parent)
|
: m_parent(parent)
|
||||||
, m_defaultColor(defaultColor)
|
|
||||||
{
|
{
|
||||||
QPalette palette = parent->palette();
|
setColor(defaultColor);
|
||||||
palette.setColor(parent->backgroundRole(), defaultColor);
|
|
||||||
parent->setPalette(palette);
|
|
||||||
parent->installEventFilter(this);
|
parent->installEventFilter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,10 +33,7 @@ ColorPicker& ColorPicker::operator=(const ColorPicker& other) {
|
||||||
|
|
||||||
void ColorPicker::setColor(const QColor& color) {
|
void ColorPicker::setColor(const QColor& color) {
|
||||||
m_defaultColor = color;
|
m_defaultColor = color;
|
||||||
|
m_parent->setStyleSheet(QString("background-color: %1;").arg(color.name()));
|
||||||
QPalette palette = m_parent->palette();
|
|
||||||
palette.setColor(m_parent->backgroundRole(), color);
|
|
||||||
m_parent->setPalette(palette);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ColorPicker::eventFilter(QObject* obj, QEvent* event) {
|
bool ColorPicker::eventFilter(QObject* obj, QEvent* event) {
|
||||||
|
@ -57,10 +51,7 @@ bool ColorPicker::eventFilter(QObject* obj, QEvent* event) {
|
||||||
colorPicker->setCurrentColor(m_defaultColor);
|
colorPicker->setCurrentColor(m_defaultColor);
|
||||||
colorPicker->open();
|
colorPicker->open();
|
||||||
connect(colorPicker, &QColorDialog::colorSelected, [this, swatch](const QColor& color) {
|
connect(colorPicker, &QColorDialog::colorSelected, [this, swatch](const QColor& color) {
|
||||||
m_defaultColor = color;
|
setColor(color);
|
||||||
QPalette palette = swatch->palette();
|
|
||||||
palette.setColor(swatch->backgroundRole(), color);
|
|
||||||
swatch->setPalette(palette);
|
|
||||||
emit colorChanged(color);
|
emit colorChanged(color);
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue