mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
Fix the screen going black on pause after changing windows
More info: https://zeduckmaster.frama.io/2016/how-to-create-a-custom-rendering-in-a-qt5-widget/
This commit is contained in:
parent
ab44a7065d
commit
0cb27cc42c
@ -52,6 +52,7 @@ RenderWidget::RenderWidget(QWidget* parent) : QWidget(parent)
|
|||||||
});
|
});
|
||||||
|
|
||||||
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) {
|
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) {
|
||||||
|
// Stop filling the background once emulation starts, but fill it until then (Bug 10958)
|
||||||
SetFillBackground(Config::Get(Config::MAIN_RENDER_TO_MAIN) &&
|
SetFillBackground(Config::Get(Config::MAIN_RENDER_TO_MAIN) &&
|
||||||
state == Core::State::Uninitialized);
|
state == Core::State::Uninitialized);
|
||||||
if (state == Core::State::Running)
|
if (state == Core::State::Running)
|
||||||
@ -90,9 +91,15 @@ RenderWidget::RenderWidget(QWidget* parent) : QWidget(parent)
|
|||||||
|
|
||||||
void RenderWidget::SetFillBackground(bool fill)
|
void RenderWidget::SetFillBackground(bool fill)
|
||||||
{
|
{
|
||||||
|
setAutoFillBackground(fill);
|
||||||
setAttribute(Qt::WA_OpaquePaintEvent, !fill);
|
setAttribute(Qt::WA_OpaquePaintEvent, !fill);
|
||||||
setAttribute(Qt::WA_NoSystemBackground, !fill);
|
setAttribute(Qt::WA_NoSystemBackground, !fill);
|
||||||
setAutoFillBackground(fill);
|
setAttribute(Qt::WA_PaintOnScreen, !fill);
|
||||||
|
}
|
||||||
|
|
||||||
|
QPaintEngine* RenderWidget::paintEngine() const
|
||||||
|
{
|
||||||
|
return autoFillBackground() ? QWidget::paintEngine() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderWidget::dragEnterEvent(QDragEnterEvent* event)
|
void RenderWidget::dragEnterEvent(QDragEnterEvent* event)
|
||||||
|
@ -19,6 +19,7 @@ public:
|
|||||||
|
|
||||||
bool event(QEvent* event) override;
|
bool event(QEvent* event) override;
|
||||||
void showFullScreen();
|
void showFullScreen();
|
||||||
|
QPaintEngine* paintEngine() const override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void EscapePressed();
|
void EscapePressed();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user