From c538357107cd07005e01711f07ba5cb608db8718 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 12 Sep 2023 11:38:06 +0400 Subject: [PATCH] Implement QOpenGLWidget wrong fbo size workaround. --- ui/gl/gl_surface.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui/gl/gl_surface.cpp b/ui/gl/gl_surface.cpp index c9ac213..3900b07 100644 --- a/ui/gl/gl_surface.cpp +++ b/ui/gl/gl_surface.cpp @@ -32,6 +32,7 @@ private: void resizeGL(int w, int h) override; void paintEvent(QPaintEvent *e) override; void paintGL() override; + bool eventHook(QEvent *e) override; void callDeInit(); const std::unique_ptr _renderer; @@ -109,6 +110,14 @@ void SurfaceOpenGL::paintGL() { _renderer->paint(this, *f); } +bool SurfaceOpenGL::eventHook(QEvent *e) { + const auto result = RpWidgetBase::eventHook(e); + if (e->type() == QEvent::ScreenChangeInternal) { + _deviceSize = size() * devicePixelRatio(); + } + return result; +} + void SurfaceOpenGL::callDeInit() { if (!_connection) { return;