Paint background on savestate window
Jeffrey Pfau jeffrey@endrift.com
Thu, 16 Oct 2014 04:07:19 -0700
4 files changed,
16 insertions(+),
3 deletions(-)
M
src/platform/qt/LoadSaveState.cpp
→
src/platform/qt/LoadSaveState.cpp
@@ -4,6 +4,7 @@ #include "GameController.h"
#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)); +}
M
src/platform/qt/LoadSaveState.h
→
src/platform/qt/LoadSaveState.h
@@ -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);
M
src/platform/qt/LoadSaveState.ui
→
src/platform/qt/LoadSaveState.ui
@@ -94,7 +94,7 @@ <verstretch>0</verstretch>
</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>
M
src/platform/qt/SavestateButton.cpp
→
src/platform/qt/SavestateButton.cpp
@@ -19,8 +19,12 @@ QPalette palette = QApplication::palette(this);
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);