forked from qt-creator/qt-creator
QmlProfiler: Avoid reloading notes twice on range restriction
We need to clear them before we restrict as otherwise the other models will end up with invalid notes. Doing that by calling loadData() is inefficient as we need to call the same method again after finalizing, because the timeline models may have changed. Change-Id: I4cd6e13bfb73804aab8f1cfee6db4069a7b808cd Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
@@ -443,6 +443,9 @@ void QmlProfilerModelManager::clear()
|
|||||||
void QmlProfilerModelManager::restrictToRange(qint64 startTime, qint64 endTime)
|
void QmlProfilerModelManager::restrictToRange(qint64 startTime, qint64 endTime)
|
||||||
{
|
{
|
||||||
d->notesModel->saveData();
|
d->notesModel->saveData();
|
||||||
|
const QVector<QmlNote> notes = d->notesModel->notes();
|
||||||
|
d->notesModel->clear();
|
||||||
|
|
||||||
setState(ClearingData);
|
setState(ClearingData);
|
||||||
setVisibleFeatures(0);
|
setVisibleFeatures(0);
|
||||||
|
|
||||||
@@ -450,7 +453,7 @@ void QmlProfilerModelManager::restrictToRange(qint64 startTime, qint64 endTime)
|
|||||||
d->model->replayEvents(startTime, endTime,
|
d->model->replayEvents(startTime, endTime,
|
||||||
std::bind(&QmlProfilerModelManager::dispatch, this,
|
std::bind(&QmlProfilerModelManager::dispatch, this,
|
||||||
std::placeholders::_1, std::placeholders::_2));
|
std::placeholders::_1, std::placeholders::_2));
|
||||||
d->notesModel->loadData();
|
d->notesModel->setNotes(notes);
|
||||||
d->traceTime->restrictToRange(startTime, endTime);
|
d->traceTime->restrictToRange(startTime, endTime);
|
||||||
acquiringDone();
|
acquiringDone();
|
||||||
}
|
}
|
||||||
|
@@ -87,7 +87,6 @@ int QmlProfilerNotesModel::addQmlNote(int typeId, int collapsedRow, qint64 start
|
|||||||
void QmlProfilerNotesModel::loadData()
|
void QmlProfilerNotesModel::loadData()
|
||||||
{
|
{
|
||||||
blockSignals(true);
|
blockSignals(true);
|
||||||
TimelineNotesModel::clear();
|
|
||||||
for (int i = 0; i != m_notes.size(); ++i) {
|
for (int i = 0; i != m_notes.size(); ++i) {
|
||||||
QmlNote ¬e = m_notes[i];
|
QmlNote ¬e = m_notes[i];
|
||||||
note.setLoaded(addQmlNote(note.typeIndex(), note.collapsedRow(), note.startTime(),
|
note.setLoaded(addQmlNote(note.typeIndex(), note.collapsedRow(), note.startTime(),
|
||||||
|
Reference in New Issue
Block a user