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 <QKeyEvent>
|
||||
#include <QPainter>
|
||||
|
||||
extern "C" {
|
||||
#include "gba-serialize.h"
|
||||
|
@ -138,3 +139,10 @@ void LoadSaveState::showEvent(QShowEvent* event) {
|
|||
m_slots[m_currentFocus]->setFocus();
|
||||
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 void closeEvent(QCloseEvent*) override;
|
||||
virtual void showEvent(QShowEvent*) override;
|
||||
virtual void paintEvent(QPaintEvent*) override;
|
||||
|
||||
private:
|
||||
void loadState(int slot);
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<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 name="text">
|
||||
<string>%1 State</string>
|
||||
|
|
|
@ -19,8 +19,12 @@ void SavestateButton::paintEvent(QPaintEvent*) {
|
|||
painter.setPen(Qt::black);
|
||||
QLinearGradient grad(0, 0, 0, 1);
|
||||
grad.setCoordinateMode(QGradient::ObjectBoundingMode);
|
||||
grad.setColorAt(0, palette.color(QPalette::Shadow));
|
||||
grad.setColorAt(1, palette.color(QPalette::Dark));
|
||||
QColor shadow = palette.color(QPalette::Shadow);
|
||||
QColor dark = palette.color(QPalette::Dark);
|
||||
shadow.setAlpha(128);
|
||||
dark.setAlpha(128);
|
||||
grad.setColorAt(0, shadow);
|
||||
grad.setColorAt(1, dark);
|
||||
painter.setBrush(grad);
|
||||
painter.drawRect(frame);
|
||||
painter.setPen(Qt::NoPen);
|
||||
|
|
Loading…
Reference in New Issue