forked from qt-creator/qt-creator
QmlProfiler: Get rid of processing step
The child models are made aware of possible changes in the details strings, and in turn, we can do the finalization immediately after acquiring is done. Change-Id: Ibe57f158e64e5d01d4c97aa617c9b2bcc8e4e96e Task-number: QTCREATORBUG-20106 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -398,6 +398,12 @@ void QmlProfilerStatisticsModel::modelManagerStateChanged()
|
||||
}
|
||||
}
|
||||
|
||||
void QmlProfilerStatisticsModel::typeDetailsChanged(int typeIndex)
|
||||
{
|
||||
const QModelIndex index = createIndex(typeIndex, MainDetails);
|
||||
emit dataChanged(index, index, QVector<int>({SortRole, Qt::DisplayRole}));
|
||||
}
|
||||
|
||||
void QmlProfilerStatisticsModel::notesChanged(int typeIndex)
|
||||
{
|
||||
static const QVector<int> noteRoles({Qt::ToolTipRole, Qt::TextColorRole});
|
||||
@@ -498,6 +504,8 @@ QmlProfilerStatisticsRelativesModel::QmlProfilerStatisticsRelativesModel(
|
||||
QTC_CHECK(modelManager);
|
||||
QTC_CHECK(statisticsModel);
|
||||
statisticsModel->setRelativesModel(this, relation);
|
||||
connect(m_modelManager, &QmlProfilerModelManager::typeDetailsChanged,
|
||||
this, &QmlProfilerStatisticsRelativesModel::typeDetailsChanged);
|
||||
}
|
||||
|
||||
bool operator<(const QmlProfilerStatisticsRelativesModel::QmlStatisticsRelativesData &a,
|
||||
@@ -697,6 +705,22 @@ bool QmlProfilerStatisticsRelativesModel::setData(const QModelIndex &index, cons
|
||||
}
|
||||
}
|
||||
|
||||
void QmlProfilerStatisticsRelativesModel::typeDetailsChanged(int typeId)
|
||||
{
|
||||
auto main_it = m_data.constFind(m_relativeTypeIndex);
|
||||
if (main_it == m_data.constEnd())
|
||||
return;
|
||||
|
||||
const QVector<QmlStatisticsRelativesData> &rows = main_it.value();
|
||||
for (int row = 0, end = rows.length(); row != end; ++row) {
|
||||
if (rows[row].typeIndex == typeId) {
|
||||
const QModelIndex index = createIndex(row, RelativeDetails);
|
||||
emit dataChanged(index, index, QVector<int>({SortRole, Qt::DisplayRole}));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QmlProfilerStatisticsRelativesModel::clear()
|
||||
{
|
||||
beginResetModel();
|
||||
|
||||
Reference in New Issue
Block a user