QmlProfiler: Add functions to check if timeline view is usable

We can only use the timeline view if the scene graph is rendered via
OpenGL. This can be checked from Qt 5.8 on by querying the
RendererInterface. Earlier versions of Qt can only render with OpenGL.

Change-Id: I3f77e2a4dee1f9a1df5d6b1946cf7eb05a1bad01
Task-number: QTCREATORBUG-16503
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Ulf Hermann
2016-12-14 13:40:23 +01:00
parent 02dd37d30a
commit bba1304817
4 changed files with 17 additions and 0 deletions

View File

@@ -293,6 +293,16 @@ void QmlProfilerTraceView::showContextMenu(QPoint position)
}
}
bool QmlProfilerTraceView::isUsable() const
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
return d->m_mainView->quickWindow()->rendererInterface()->graphicsApi()
== QSGRendererInterface::OpenGL;
#else
return true;
#endif
}
void QmlProfilerTraceView::changeEvent(QEvent *e)
{
if (e->type() == QEvent::EnabledChange) {

View File

@@ -55,6 +55,7 @@ public:
qint64 selectionStart() const;
qint64 selectionEnd() const;
void showContextMenu(QPoint position);
bool isUsable() const;
public slots:
void clear();

View File

@@ -147,6 +147,11 @@ void QmlProfilerViewManager::restrictEventsToRange(qint64 rangeStart, qint64 ran
d->profilerModelManager->restrictToRange(rangeStart, rangeEnd);
}
bool QmlProfilerViewManager::isTimelineUsable() const
{
return d->traceView->isUsable();
}
void QmlProfilerViewManager::raiseTimeline()
{
QTC_ASSERT(qobject_cast<QDockWidget *>(d->traceView->parentWidget()), return);

View File

@@ -53,6 +53,7 @@ public:
bool isEventsRestrictedToRange() const;
void restrictEventsToRange(qint64 rangeStart, qint64 rangeEnd);
bool isTimelineUsable() const;
void raiseTimeline();
public slots: