Update scenegraph API check in isUsable

Do not test for OpenGL-through-QRhi, but rather for
anything-through-QRhi. The implementation of the profiler
views is not tied to OpenGL anymore. That said, QQuickWidget
implies using OpenGL as of now, so in practice we will always
have OpenGL at best, but update the tests now to be better
prepared for the future.

Change-Id: Ic43eac1c5cf0e2ce2ef35cdd8a29b475884a5af8
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Laszlo Agocs
2021-08-26 13:58:58 +02:00
parent 30827fe401
commit 491bd18d1f
2 changed files with 8 additions and 0 deletions

View File

@@ -76,7 +76,11 @@ PerfProfilerTraceView::PerfProfilerTraceView(QWidget *parent, PerfProfilerTool *
bool PerfProfilerTraceView::isUsable() const bool PerfProfilerTraceView::isUsable() const
{ {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return quickWindow()->rendererInterface()->graphicsApi() == QSGRendererInterface::OpenGL; return quickWindow()->rendererInterface()->graphicsApi() == QSGRendererInterface::OpenGL;
#else
return QSGRendererInterface::isApiRhiBased(quickWindow()->rendererInterface()->graphicsApi());
#endif
} }
void PerfProfilerTraceView::selectByTypeId(int typeId) void PerfProfilerTraceView::selectByTypeId(int typeId)

View File

@@ -296,8 +296,12 @@ void QmlProfilerTraceView::showContextMenu(QPoint position)
bool QmlProfilerTraceView::isUsable() const bool QmlProfilerTraceView::isUsable() const
{ {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return d->m_mainView->quickWindow()->rendererInterface()->graphicsApi() return d->m_mainView->quickWindow()->rendererInterface()->graphicsApi()
== QSGRendererInterface::OpenGL; == QSGRendererInterface::OpenGL;
#else
return QSGRendererInterface::isApiRhiBased(d->m_mainView->quickWindow()->rendererInterface()->graphicsApi());
#endif
} }
bool QmlProfilerTraceView::isSuspended() const bool QmlProfilerTraceView::isSuspended() const