aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprofiler
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-03-27 16:45:42 +0200
committerUlf Hermann <ulf.hermann@qt.io>2018-04-17 09:14:09 +0000
commite0ba6f91ceac6e1fed5b143d39cebffc78f07245 (patch)
tree7812926b118c849163f0575329f197d15c1ce36c /src/plugins/qmlprofiler
parent1ccd058bdfbd6334dfe09d23ac85b7de0cfa1ff1 (diff)
Timeline: Add stash() and restore() methods to notes model
Those are needed when manipulating the model in a way that may change the indices, like restricting to a range or filtering by categories. Change-Id: I9f218d269cf23104c306960ef77c0fc41591daa1 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler')
-rw-r--r--src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp4
-rw-r--r--src/plugins/qmlprofiler/qmlprofilernotesmodel.cpp4
-rw-r--r--src/plugins/qmlprofiler/qmlprofilernotesmodel.h6
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertraceview.cpp2
-rw-r--r--src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp2
5 files changed, 9 insertions, 9 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp
index 0828fee5f55..0a7bd0bf365 100644
--- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp
@@ -536,7 +536,7 @@ void QmlProfilerModelManager::save(const QString &filename)
return;
}
- d->notesModel->saveData();
+ d->notesModel->stash();
QmlProfilerFileWriter *writer = new QmlProfilerFileWriter(this);
writer->setTraceTime(traceTime()->startTime(), traceTime()->endTime(),
@@ -713,7 +713,7 @@ void QmlProfilerModelManager::clear()
void QmlProfilerModelManager::restrictToRange(qint64 startTime, qint64 endTime)
{
- d->notesModel->saveData();
+ d->notesModel->stash();
const QVector<QmlNote> notes = d->notesModel->notes();
d->notesModel->clear();
diff --git a/src/plugins/qmlprofiler/qmlprofilernotesmodel.cpp b/src/plugins/qmlprofiler/qmlprofilernotesmodel.cpp
index 7c41726c6ed..2d6c0c09f4a 100644
--- a/src/plugins/qmlprofiler/qmlprofilernotesmodel.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilernotesmodel.cpp
@@ -83,7 +83,7 @@ int QmlProfilerNotesModel::addQmlNote(int typeId, int collapsedRow, qint64 start
}
-void QmlProfilerNotesModel::loadData()
+void QmlProfilerNotesModel::restore()
{
{
QSignalBlocker blocker(this);
@@ -97,7 +97,7 @@ void QmlProfilerNotesModel::loadData()
emit changed(-1, -1, -1);
}
-void QmlProfilerNotesModel::saveData()
+void QmlProfilerNotesModel::stash()
{
// Keep notes that are outside the given range, overwrite the ones inside the range.
m_notes = Utils::filtered(m_notes, [](const QmlNote &note) {
diff --git a/src/plugins/qmlprofiler/qmlprofilernotesmodel.h b/src/plugins/qmlprofiler/qmlprofilernotesmodel.h
index e2b683fd79f..d131dc74c4e 100644
--- a/src/plugins/qmlprofiler/qmlprofilernotesmodel.h
+++ b/src/plugins/qmlprofiler/qmlprofilernotesmodel.h
@@ -37,12 +37,12 @@ class QMLPROFILER_EXPORT QmlProfilerNotesModel : public Timeline::TimelineNotesM
public:
QmlProfilerNotesModel(QObject *parent);
- void loadData();
- void saveData();
+ void restore() override;
+ void stash() override;
const QVector<QmlNote> &notes() const;
void setNotes(const QVector<QmlNote> &notes);
- void clear();
+ void clear() override;
protected:
QVector<QmlNote> m_notes;
diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp
index 9129e753136..5846a6b67b7 100644
--- a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp
@@ -108,7 +108,7 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, QmlProfilerViewManag
case QmlProfilerModelManager::Empty:
d->m_modelProxy->setModels(d->m_suspendedModels);
d->m_suspendedModels.clear();
- d->m_modelManager->notesModel()->loadData();
+ d->m_modelManager->notesModel()->restore();
break;
case QmlProfilerModelManager::ClearingData:
d->m_zoomControl->clear();
diff --git a/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp b/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp
index 14799f07bf5..f21dbcacf5b 100644
--- a/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp
+++ b/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp
@@ -87,7 +87,7 @@ int FlameGraphModelTest::generateData(QmlProfilerModelManager *manager)
manager->finalize();
manager->notesModel()->setNotes(QVector<QmlNote>({QmlNote(0, 2, 1, 20, "dings")}));
- manager->notesModel()->loadData();
+ manager->notesModel()->restore();
return rangeModelId;
}