Editing an item is now undo/redo-able.
This commit is contained in:
@ -16,3 +16,25 @@ bool ModelItem::setData(const QVariant& value, int role) {
|
||||
|
||||
return valueChanged;
|
||||
}
|
||||
|
||||
bool ModelItem::setItemData(const QMap<int, QVariant>& changedValues) {
|
||||
bool valueChanged = false;
|
||||
|
||||
QMap<int, QVariant>::const_iterator citer = changedValues.constBegin();
|
||||
|
||||
while (citer != changedValues.constEnd()) {
|
||||
const int role = citer.key();
|
||||
const QVariant value = citer.value();
|
||||
|
||||
if (m_values.contains(role)) {
|
||||
if (m_values.value(role) != value) {
|
||||
valueChanged = true;
|
||||
}
|
||||
}
|
||||
m_values[role] = value;
|
||||
|
||||
citer++;
|
||||
}
|
||||
|
||||
return valueChanged;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user