diff options
author | Louie S <louie@example.com> | 2024-03-15 16:35:30 -0400 |
---|---|---|
committer | Louie S <louie@example.com> | 2024-03-15 16:35:30 -0400 |
commit | 6c9d7e079cceade194b5faa6c65e98920be697ef (patch) | |
tree | 5af2be170449822320b3b4f1a873a9dc1dde10eb /src/entry.cpp | |
parent | 4c2c8bc81df55ab2f0112d16bfd1a9d236b51e6d (diff) |
sorting implemented; functionality is now matching pyqt version
Diffstat (limited to 'src/entry.cpp')
-rw-r--r-- | src/entry.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/entry.cpp b/src/entry.cpp index 4876641..1082c1e 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -13,3 +13,20 @@ Entry::Entry(int id, int parent_id, QString desc, QDateTime due, QString due_alt hidden(hidden) { } + +bool Entry::compare(Entry a, Entry b) { + // 1st level: sort not done before done + if(a.done != b.done) + return a.done < b.done; + // next level: sort on due date + if(a.due != b.due) + return a.due < b.due; + // next level: sort on alt due date + if(a.due_alt != b.due_alt) + return a.due_alt < b.due_alt; + // next level: sort on description + if(a.desc != b.desc) + return a.desc < b.desc; + // otherwise, sort on id + return a.id < b.id; +} |