mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
b84e6dfc8a
commit
dbf2868dee
1 changed files with 5 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue