diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2016-04-26 13:23:35 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2016-05-23 12:04:49 +0000 |
commit | 5ba6f04d4b240c0217dd714aa8caf32d4ad24c4a (patch) | |
tree | 4d4adc24eadcf31b17b7ce3cbfdcaa2eb9637e41 /src/plugins/qmlprofiler/inputeventsmodel.cpp | |
parent | 67378a7928af1d3ed91d0f704ae71a3e1381c8f4 (diff) |
QmlProfiler: Load the timeline model data event by event
All the models do the same thing when loading the data: They iterate
the list of events, determine for each one if they accept it, and if
so, they load it. After the list has been fully loaded, they do some
finalization. This can be centralized, and ultimately we won't need to
expose the central QVector<QmlEvent> for that anymore.
Change-Id: Ia82facfdc3968200bbec323a02f2fcc02ac44e9e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler/inputeventsmodel.cpp')
-rw-r--r-- | src/plugins/qmlprofiler/inputeventsmodel.cpp | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/src/plugins/qmlprofiler/inputeventsmodel.cpp b/src/plugins/qmlprofiler/inputeventsmodel.cpp index 055e4259f5f..35a6790950f 100644 --- a/src/plugins/qmlprofiler/inputeventsmodel.cpp +++ b/src/plugins/qmlprofiler/inputeventsmodel.cpp @@ -140,29 +140,22 @@ int InputEventsModel::collapsedRow(int index) const return 1; } -void InputEventsModel::loadData() +void InputEventsModel::loadEvent(const QmlEvent &event, const QmlEventType &type) { - QmlProfilerDataModel *simpleModel = modelManager()->qmlModel(); - if (simpleModel->isEmpty()) - return; - - const QVector<QmlEventType> &types = simpleModel->eventTypes(); - foreach (const QmlEvent &event, simpleModel->events()) { - const QmlEventType &type = types[event.typeIndex()]; - if (!accepted(type)) - continue; - - m_data.insert(insert(event.timestamp(), 0, type.detailType), - InputEvent(static_cast<InputEventType>(event.number<qint32>(0)), - event.number<qint32>(1), event.number<qint32>(2))); - - if (type.detailType == Mouse) { - if (m_mouseTypeId == -1) - m_mouseTypeId = event.typeIndex(); - } else if (m_keyTypeId == -1) { - m_keyTypeId = event.typeIndex(); - } + m_data.insert(insert(event.timestamp(), 0, type.detailType), + InputEvent(static_cast<InputEventType>(event.number<qint32>(0)), + event.number<qint32>(1), event.number<qint32>(2))); + + if (type.detailType == Mouse) { + if (m_mouseTypeId == -1) + m_mouseTypeId = event.typeIndex(); + } else if (m_keyTypeId == -1) { + m_keyTypeId = event.typeIndex(); } +} + +void InputEventsModel::finalize() +{ setCollapsedRowCount(2); setExpandedRowCount(3); } |