diff --git a/pcsx2-qt/DisplayWidget.cpp b/pcsx2-qt/DisplayWidget.cpp index c517e8a033..e2e06731cb 100644 --- a/pcsx2-qt/DisplayWidget.cpp +++ b/pcsx2-qt/DisplayWidget.cpp @@ -230,16 +230,17 @@ bool DisplayWidget::event(QEvent* event) return true; } + // According to https://bugreports.qt.io/browse/QTBUG-95925 the recommended practice for handling DPI change is responding to paint events + case QEvent::Paint: case QEvent::Resize: { QWidget::event(event); const qreal dpr = devicePixelRatioFromScreen(); - const QSize size = static_cast(event)->size(); - const int width = static_cast(std::ceil(static_cast(size.width()) * devicePixelRatioFromScreen())); - const int height = static_cast(std::ceil(static_cast(size.height()) * devicePixelRatioFromScreen())); + const int scaled_width = static_cast(std::ceil(static_cast(width()) * devicePixelRatioFromScreen())); + const int scaled_height = static_cast(std::ceil(static_cast(height()) * devicePixelRatioFromScreen())); - emit windowResizedEvent(width, height, dpr); + emit windowResizedEvent(scaled_width, scaled_height, dpr); return true; }