diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-07-30 09:20:25 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-10-11 16:22:27 -0700 |
commit | ec7d85835fb26ee9c0a9c780907441c312d7ac3f (patch) | |
tree | 1ecb5231abdc50929ba6ba308c25196eb408c381 /desktop-widgets/simplewidgets.cpp | |
parent | 6ac4ddbeeda5286faacac9633b622dcf298eea7b (diff) | |
download | subsurface-ec7d85835fb26ee9c0a9c780907441c312d7ac3f.tar.gz |
Dive list: implement proper Qt-model semantics for DiveTripModel
Previously, each dive-list modifying function would lead to a
full model reset. Instead, implement proper Qt-model semantics
using beginInsertRows()/endInsertRows(), beginRemoveRows()/
endRemoveRows(), dataChange().
To do so, a DiveListNotifer singleton is generatated, which
broadcasts all changes to the dive-list. Signals are sent by
the commands and received by the DiveTripModel. Signals are
batched by dive-trip. This seems to be an adequate compromise
for the two kinds of list-views (tree and list). In the common
usecase mostly dives of a single trip are affected.
Thus, batching of dives is performed in two positions:
- At command-level to batch by trip
- In DiveTripModel to feed batches of contiguous elements
to Qt's begin*/end*-functions.
This is conceptually simple, but rather complex code. To avoid
repetition of complex loops, the batching is implemented in
templated-functions, which are passed lambda-functions, which
are called for each batch.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/simplewidgets.cpp')
-rw-r--r-- | desktop-widgets/simplewidgets.cpp | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index 72a81d873..1df69e7bb 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -172,9 +172,6 @@ void RenumberDialog::buttonClicked(QAbstractButton *button) } } Command::renumberDives(renumberedDives); - - mark_divelist_changed(true); - MainWindow::instance()->dive_list()->restoreSelection(); } } |