From dbf2868dee841a0094a2cb3dddfa0792dca87e84 Mon Sep 17 00:00:00 2001 From: Sander Kleijwegt Date: Wed, 19 Aug 2015 18:58:08 +0200 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/simplewidgets.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'qt-ui/simplewidgets.cpp') 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 > 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(); } } -- cgit v1.2.3-70-g09d2