aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/simplewidgets.cpp
diff options
context:
space:
mode:
authorGravatar Sander Kleijwegt <sander@myowndomain.nl>2015-08-19 18:58:08 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-08-19 10:11:38 -0700
commitdbf2868dee841a0094a2cb3dddfa0792dca87e84 (patch)
tree25afbf29e44aa64fbefa4efa535143bef0731ed5 /qt-ui/simplewidgets.cpp
parentb84e6dfc8a288e89cebd38e3e4066a0572c4d1ff (diff)
downloadsubsurface-dbf2868dee841a0094a2cb3dddfa0792dca87e84.tar.gz
Restore selection after renumbering dives.
After renumbering any number of selected dives, the selected dives would still be selected, but this was not visible from the divelist view. Clicking on subsequent dives would deselect them while the GUI shows them as selected, any further action like delete would not be done on the visible selection, but on the invisible dive->selected state, leading to apparently very weird behaviour. Fixes #917 Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/simplewidgets.cpp')
-rw-r--r--qt-ui/simplewidgets.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index c86094d13..99b4b2be8 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -143,6 +143,7 @@ void RenumberDialog::renumberOnlySelected(bool selected)
void RenumberDialog::buttonClicked(QAbstractButton *button)
{
if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
+ MainWindow::instance()->dive_list()->rememberSelection();
// we remember a map from dive uuid to a pair of old number / new number
QMap<int,QPair<int, int> > renumberedDives;
int i;
@@ -154,6 +155,10 @@ void RenumberDialog::buttonClicked(QAbstractButton *button)
}
UndoRenumberDives *undoCommand = new UndoRenumberDives(renumberedDives);
MainWindow::instance()->undoStack->push(undoCommand);
+
+ MainWindow::instance()->dive_list()->fixMessyQtModelBehaviour();
+ mark_divelist_changed(true);
+ MainWindow::instance()->dive_list()->restoreSelection();
}
}