Debugger: Move watcher modification from delegate to model

We don't need the remove/re-insert cycle in the new model,
so the expression modification can be done directly.

Change-Id: If9626f48fcfbcf75e61d332afb59b986da6c2dbc
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
hjk
2015-03-06 11:32:39 +01:00
parent 862f9a46e6
commit df00a7af64
2 changed files with 18 additions and 22 deletions

View File

@@ -116,27 +116,6 @@ public:
return lineEdit;
}
void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const
{
// Standard handling for anything but the watcher name column (change
// expression), which removes/recreates a row, which cannot be done
// in model->setData().
if (index.column() != 0) {
QItemDelegate::setModelData(editor, model, index);
return;
}
const QMetaProperty userProperty = editor->metaObject()->userProperty();
QTC_ASSERT(userProperty.isValid(), return);
const QString value = editor->property(userProperty.name()).toString();
const QString exp = index.data(LocalsExpressionRole).toString();
if (exp == value)
return;
WatchHandler *handler = currentEngine()->watchHandler();
handler->removeData(index.data(LocalsINameRole).toByteArray());
handler->watchExpression(value);
}
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
const QModelIndex &) const
{