Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-add ability to switch render modes under Qt 6 #917

Merged
merged 1 commit into from
Jan 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions plugins/quickinspector/quickinspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,25 +301,24 @@ void RenderModeRequest::apply()
if (connection)
disconnect(connection);

#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
// crashes in qrhigles2..bindShaderResources sometimes
return;
#endif

if (window && window->rendererInterface()->graphicsApi() != QSGRendererInterface::OpenGL)
return;

if (window) {
emit aboutToCleanSceneGraph();
const QByteArray mode = renderModeToString(RenderModeRequest::mode);
QQuickWindowPrivate *winPriv = QQuickWindowPrivate::get(window);
QMetaObject::invokeMethod(window, "cleanupSceneGraph", Qt::DirectConnection);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
winPriv->visualizationMode = mode;
QObject::connect(window.get(), &QQuickWindow::beforeSynchronizing, this, [this, winPriv, mode]() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

squash this commit bot patch locally please (and consider setting up pre-commit locally)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

emit aboutToCleanSceneGraph();
QMetaObject::invokeMethod(window, "cleanupSceneGraph", Qt::DirectConnection);
winPriv->visualizationMode = mode;
emit sceneGraphCleanedUp(); }, static_cast<Qt::ConnectionType>(Qt::DirectConnection | Qt::SingleShotConnection));
#else
emit aboutToCleanSceneGraph();
QMetaObject::invokeMethod(window, "cleanupSceneGraph", Qt::DirectConnection);
winPriv->customRenderMode = mode;
#endif
emit sceneGraphCleanedUp();
#endif
}

QMetaObject::invokeMethod(this, "preFinished", Qt::QueuedConnection);
Expand Down
Loading