MCPcopy Create free account
hub / github.com/KDAB/GammaRay / itemModelDataChanged

Method itemModelDataChanged

plugins/quickinspector/quickinspectorwidget.cpp:239–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237}
238
239void QuickInspectorWidget::itemModelDataChanged(const QModelIndex &topLeft,
240 const QModelIndex &bottomRight,
241 const QVector<int> &roles)
242{
243 if (!roles.contains(QuickItemModelRole::ItemEvent))
244 return;
245
246 for (int i = topLeft.row(); i <= bottomRight.row(); i++) {
247 const QModelIndex index = ui->itemTreeView->model()->index(i, 0, topLeft.parent());
248 const auto state = index.data(RemoteModelRole::LoadingState).value<RemoteModelNodeState::NodeStates>();
249 if (state & RemoteModelNodeState::Empty || ~state & RemoteModelNodeState::Outdated)
250 continue;
251
252 auto *colorAnimation = new QVariantAnimation(this);
253 QPersistentModelIndex persistentIndex(index);
254 connect(colorAnimation, &QVariantAnimation::valueChanged,
255 ui->itemTreeView->itemDelegate(), [persistentIndex, this](const QVariant &value) {
256 qobject_cast<QuickItemDelegate *>(ui->itemTreeView->itemDelegate())->setTextColor(value, persistentIndex);
257 });
258 colorAnimation->setStartValue(QColor(129, 0, 129));
259 colorAnimation->setEndValue(QColor(129, 0, 129, 0));
260 colorAnimation->setDuration(2000);
261 colorAnimation->start(QAbstractAnimation::DeleteWhenStopped);
262 }
263}
264
265void QuickInspectorUiFactory::initUi()
266{

Callers

nothing calls this directly

Calls 7

rowMethod · 0.80
setTextColorMethod · 0.80
indexMethod · 0.45
modelMethod · 0.45
parentMethod · 0.45
dataMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected