forked from qt-creator/qt-creator
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:
@@ -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)
|
void QmlProfilerTraceView::changeEvent(QEvent *e)
|
||||||
{
|
{
|
||||||
if (e->type() == QEvent::EnabledChange) {
|
if (e->type() == QEvent::EnabledChange) {
|
||||||
|
@@ -55,6 +55,7 @@ public:
|
|||||||
qint64 selectionStart() const;
|
qint64 selectionStart() const;
|
||||||
qint64 selectionEnd() const;
|
qint64 selectionEnd() const;
|
||||||
void showContextMenu(QPoint position);
|
void showContextMenu(QPoint position);
|
||||||
|
bool isUsable() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
|
@@ -147,6 +147,11 @@ void QmlProfilerViewManager::restrictEventsToRange(qint64 rangeStart, qint64 ran
|
|||||||
d->profilerModelManager->restrictToRange(rangeStart, rangeEnd);
|
d->profilerModelManager->restrictToRange(rangeStart, rangeEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QmlProfilerViewManager::isTimelineUsable() const
|
||||||
|
{
|
||||||
|
return d->traceView->isUsable();
|
||||||
|
}
|
||||||
|
|
||||||
void QmlProfilerViewManager::raiseTimeline()
|
void QmlProfilerViewManager::raiseTimeline()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(qobject_cast<QDockWidget *>(d->traceView->parentWidget()), return);
|
QTC_ASSERT(qobject_cast<QDockWidget *>(d->traceView->parentWidget()), return);
|
||||||
|
@@ -53,6 +53,7 @@ public:
|
|||||||
bool isEventsRestrictedToRange() const;
|
bool isEventsRestrictedToRange() const;
|
||||||
void restrictEventsToRange(qint64 rangeStart, qint64 rangeEnd);
|
void restrictEventsToRange(qint64 rangeStart, qint64 rangeEnd);
|
||||||
|
|
||||||
|
bool isTimelineUsable() const;
|
||||||
void raiseTimeline();
|
void raiseTimeline();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
Reference in New Issue
Block a user