When processing a transaction/changeset the row-* signals from Dee are used as synchronization points and since the Qt model signals are emitted during the transaction, there's really always just one row that needs to be skipped.
The primary thing here is that the skipping only happens when inside the row-* callback.
Consider how the transaction looks like in pseudocode:
// starting inside dee
var rows = dbus_signal.get_rows_iter();
while (rows.has_next())
{
row = rows.next();
var row_signal = this.submit_change(row, out iter);
this.emit(row_signal, iter, () =>
{
// inside the signal emission we get into the DeeListModel plugin code
if (consecutive_changes(iter)) processChange(...);
else flushChangesAndProcessChange(() =>
{
beginRowsInserted(begin, end);
// now qt will emit rowsInserted() or rowsRemoved()
endRowsInserted(begin, end, () =>
{
// view code that will read the model
for (int i = begin; i < end; i++) model.data(i, someRole); // at this point we need to skip the row that's currently being added (current iter, always just one)
});
});
});
}
Of course the situation is different when the entire transaction is consecutive:
// starting inside dee
var rows = dbus_signal.get_rows_iter();
while (rows.has_next())
{
row = rows.next();
var row_signal = this.submit_change(row, out iter);
this.emit(row_signal, iter, () => { processChange(...); }
}
this.emit(changeset_finished, () =>
{
// inside the signal emission we get into the DeeListModel plugin code
flushChanges(() =>
{
beginRowsInserted(begin, end);
// now qt will emit rowsInserted() or rowsRemoved()
endRowsInserted(begin, end, () =>
{
// view code that will read the model
for (int i = begin; i < end; i++) model.data(i, someRole); // no need to skip anything, models are in sync
});
});
});
When processing a transaction/ changeset the row-* signals from Dee are used as synchronization points and since the Qt model signals are emitted during the transaction, there's really always just one row that needs to be skipped.
The primary thing here is that the skipping only happens when inside the row-* callback.
Consider how the transaction looks like in pseudocode:
// starting inside dee get_rows_ iter(); change( row, out iter); emit(row_ signal, iter, () => changes( iter)) processChange(...); ProcessChange( () => Inserted( begin, end); serted( begin, end, () =>
model. data(i, someRole); // at this point we need to skip the row that's currently being added (current iter, always just one)
var rows = dbus_signal.
while (rows.has_next())
{
row = rows.next();
var row_signal = this.submit_
this.
{
// inside the signal emission we get into the DeeListModel plugin code
if (consecutive_
else flushChangesAnd
{
beginRows
// now qt will emit rowsInserted() or rowsRemoved()
endRowsIn
{
// view code that will read the model
for (int i = begin; i < end; i++)
});
});
});
}
Of course the situation is different when the entire transaction is consecutive: get_rows_ iter(); change( row, out iter); emit(row_ signal, iter, () => { processChange(...); }
// starting inside dee
var rows = dbus_signal.
while (rows.has_next())
{
row = rows.next();
var row_signal = this.submit_
this.
}
this.emit( changeset_ finished, () => serted( begin, end); rted(begin, end, () =>
model. data(i, someRole); // no need to skip anything, models are in sync
{
// inside the signal emission we get into the DeeListModel plugin code
flushChanges(() =>
{
beginRowsIn
// now qt will emit rowsInserted() or rowsRemoved()
endRowsInse
{
// view code that will read the model
for (int i = begin; i < end; i++)
});
});
});