forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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;
|
||||
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)));
|
||||
|
||||
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();
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user