Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QAbstractItemModel comparison



  • Hi all,

    I have two models which i wan't to compare, such that given model A I can tell what elements are the same, modified or not present in model B (using comparison function implemented by each tree item). I'm unsure how to approach this problem and wondered if anyone had tackled a similar algorithm in the past. The best I could come up with was iterate over each item in A and check if it's in B, but this does not seem that neat and will probably have a O(n^2) complexity. On that note has anyone in the past implemented a breath first iterator in the past, is it easy?

    Apologies if this question is not appropriate for this forum.


Log in to reply