mirror of https://github.com/mgba-emu/mgba.git
Paint background on savestate window
This commit is contained in:
parent
1d00ccf6dd
commit
b9d4101937
|
@ -4,6 +4,7 @@
|
||||||
#include "VFileDevice.h"
|
#include "VFileDevice.h"
|
||||||
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QPainter>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "gba-serialize.h"
|
#include "gba-serialize.h"
|
||||||
|
@ -138,3 +139,10 @@ void LoadSaveState::showEvent(QShowEvent* event) {
|
||||||
m_slots[m_currentFocus]->setFocus();
|
m_slots[m_currentFocus]->setFocus();
|
||||||
QWidget::showEvent(event);
|
QWidget::showEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LoadSaveState::paintEvent(QPaintEvent* event) {
|
||||||
|
QPainter painter(this);
|
||||||
|
QRect full(QPoint(), size());
|
||||||
|
painter.drawPixmap(full, m_currentImage);
|
||||||
|
painter.fillRect(full, QColor(0, 0, 0, 128));
|
||||||
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ protected:
|
||||||
virtual bool eventFilter(QObject*, QEvent*) override;
|
virtual bool eventFilter(QObject*, QEvent*) override;
|
||||||
virtual void closeEvent(QCloseEvent*) override;
|
virtual void closeEvent(QCloseEvent*) override;
|
||||||
virtual void showEvent(QShowEvent*) override;
|
virtual void showEvent(QShowEvent*) override;
|
||||||
|
virtual void paintEvent(QPaintEvent*) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadState(int slot);
|
void loadState(int slot);
|
||||||
|
|
|
@ -94,7 +94,7 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">font-size: 30pt; font-weight: bold;</string>
|
<string notr="true">font-size: 30pt; font-weight: bold; color: white;</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>%1 State</string>
|
<string>%1 State</string>
|
||||||
|
|
|
@ -19,8 +19,12 @@ void SavestateButton::paintEvent(QPaintEvent*) {
|
||||||
painter.setPen(Qt::black);
|
painter.setPen(Qt::black);
|
||||||
QLinearGradient grad(0, 0, 0, 1);
|
QLinearGradient grad(0, 0, 0, 1);
|
||||||
grad.setCoordinateMode(QGradient::ObjectBoundingMode);
|
grad.setCoordinateMode(QGradient::ObjectBoundingMode);
|
||||||
grad.setColorAt(0, palette.color(QPalette::Shadow));
|
QColor shadow = palette.color(QPalette::Shadow);
|
||||||
grad.setColorAt(1, palette.color(QPalette::Dark));
|
QColor dark = palette.color(QPalette::Dark);
|
||||||
|
shadow.setAlpha(128);
|
||||||
|
dark.setAlpha(128);
|
||||||
|
grad.setColorAt(0, shadow);
|
||||||
|
grad.setColorAt(1, dark);
|
||||||
painter.setBrush(grad);
|
painter.setBrush(grad);
|
||||||
painter.drawRect(frame);
|
painter.drawRect(frame);
|
||||||
painter.setPen(Qt::NoPen);
|
painter.setPen(Qt::NoPen);
|
||||||
|
|
Loading…
Reference in New Issue