Details
-
Bug
-
Resolution: Out of scope
-
P2: Important
-
None
-
6.5.2, 6.6.0 Beta3
-
Windows 10 22H2, MSVC 2019 x64
Description
Code
#include <windows.h> #include <QAbstractNativeEventFilter> #include <QApplication> #include <QQuickWidget> #include <QMainWindow> class MyNativeEventFilter : public QAbstractNativeEventFilter { public: bool nativeEventFilter(const QByteArray&, void* message, qintptr*) { auto msg = (MSG*)message; QWidget* widget = QWidget::find(WId(msg->hwnd)); if (widget) qDebug() << widget << widget->winId(); // WORKAROUND 1: Avoid calling winId() here return false; } }; int main(int argc, char *argv[]) { //QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL); QApplication app(argc, argv); app.installNativeEventFilter(new MyNativeEventFilter); QMainWindow mainWindow; // NOTE: mainWindow.winId() changes after each line below. Not sure if this is relevant. mainWindow.setWindowState(Qt::WindowMaximized); // WORKAROUND 2: Call this line AFTER the QQuickWidget is constructed mainWindow.setCentralWidget(new QQuickWidget); mainWindow.show(); return app.exec(); }
Outcomes on Qt 6.5.2/6.6.0b3
After a running the code above for a few seconds, it will crash.
If the OpenGL RHI backend is chosen, we will also see the following warning:
QOpenGLContext::makeCurrent() called with non-opengl surface 0x2b5ff73c540 QRhiGles2: Failed to make context current. Expect bad things to happen. Failed to create QRhi for QBackingStoreRhiSupport
Attachments
Issue Links
- relates to
-
QTBUG-104596 [reg->6.4] Qt Designer crashes when OpenGL widget is dragged to form
-
- Closed
-