QmlProfiler: Avoid empty timeline when restricting to ranges

The timeline models were suspended for editing but never restored. To
test the correct behavior a test case for the trace view is added.

Change-Id: Ic1803e9d84656eed97795f1f1674e3d56c83f650
Task-number: QTCREATORBUG-18354
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Ulf Hermann
2017-08-07 12:05:11 +02:00
parent 48d3fd1af5
commit 1e781cd396
7 changed files with 139 additions and 7 deletions

View File

@@ -114,13 +114,16 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, QmlProfilerViewManag
break;
case QmlProfilerModelManager::ClearingData:
d->m_zoomControl->clear();
if (!d->m_suspendedModels.isEmpty())
break; // Models are suspended already. AcquiringData was aborted.
// Fall through
case QmlProfilerModelManager::AcquiringData:
// Temporarily remove the models, while we're changing them
d->m_suspendedModels = d->m_modelProxy->models();
d->m_modelProxy->setModels(QVariantList());
if (d->m_suspendedModels.isEmpty()) {
// Temporarily remove the models, while we're changing them
d->m_suspendedModels = d->m_modelProxy->models();
d->m_modelProxy->setModels(QVariantList());
}
// Otherwise models are suspended already. This can happen if either acquiring was
// aborted or we're doing a "restrict to range" which consists of a partial clearing and
// then re-acquiring of data.
break;
}
});
@@ -308,6 +311,11 @@ bool QmlProfilerTraceView::isUsable() const
#endif
}
bool QmlProfilerTraceView::isSuspended() const
{
return !d->m_suspendedModels.isEmpty();
}
void QmlProfilerTraceView::changeEvent(QEvent *e)
{
if (e->type() == QEvent::EnabledChange) {