From b6604a7ad5e3379d61f16e6348bc11ef755a3cad Mon Sep 17 00:00:00 2001 From: Ludwig Jaeck <ludwig.jaeck@outlook.de> Date: Tue, 14 Feb 2023 11:13:34 +0100 Subject: [PATCH] MainWindow: fix window redraw after new project Canvas is not initialized in application start so a window manager like x11 may reopen the mainwindow on gl context switching without this fix. The behaviour was caused by different surface format / opengl contexts of the QMainWindow instance and the QOpenGLWidget instance of Canvas. In Qt6 it became more complex to quickly share the gl context. Hence we just create a dummy QOpenGLWidget before MainWindow is show to reset it. --- GUI/View/Main/MainWindow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/GUI/View/Main/MainWindow.cpp b/GUI/View/Main/MainWindow.cpp index 95f77d248db..e641408b190 100644 --- a/GUI/View/Main/MainWindow.cpp +++ b/GUI/View/Main/MainWindow.cpp @@ -31,6 +31,7 @@ #include <QButtonGroup> #include <QCloseEvent> #include <QMessageBox> +#include <QOpenGLWidget> #include <QProgressBar> #include <QPushButton> #include <QSettings> @@ -74,6 +75,8 @@ MainWindow::MainWindow() vlayout->setSpacing(0); vlayout->addLayout(m_viewsStack); + vlayout->addWidget(new QOpenGLWidget()); // quick fix to reset surface format + mainLayout->addLayout(m_viewSelectionButtonsLayout); mainLayout->addLayout(vlayout); -- GitLab