Header: | #include <QSDiffRunner> |
QSDiffRunner() | |
QSPatchSet | compare(const QVariantList & from, const QVariantList & to) |
QString | keyField() const |
bool | patch(QSPatchable * patchable, const QSPatchSet & patches) const |
void | setKeyField(const QString & keyField) |
QSDiffRunner compares two QVariantList to produce a patch for transforming one of the list to another list with minimum no. of steps. The result can be applied on a QSListModel via QSPatchable interface. QSDiffRunner use an average O(n) algorithm and therefore it should be fast enough for regular UI application.
Call this function to compare two list, then return a list of patches required to transform from a list to other with the minimum number of steps. It uses an algorithm with average O(n) runtime.
You should set the key field before calling this function.
See also setKeyField.
See also setKeyField().
Call this function to patch a list model that implemented the QSPatchable interface. You should use the result generated by QSDiffRunner::compare().
Call this function to set the key field before using compare(). If it is not set, it won't be able to identify insert, remove and move changes.
See also keyField().