mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Desktop: fix dive site editing
When clicking "done" on the dive site edit screen, the diveSite member variable was reset to nullptr in acceptChanges() at the beginning of the function. This prevented posting an undo-command as a consequence of the active widget losing focus. Reset the diveSite variable after exiting dive-site mode, which causes the active widget to lose focus. Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
a9b1fbdcc5
commit
81ea47a498
2 changed files with 8 additions and 1 deletions
|
@ -189,13 +189,19 @@ void LocationInformationWidget::diveSiteDeleted(struct dive_site *ds, int)
|
|||
|
||||
void LocationInformationWidget::acceptChanges()
|
||||
{
|
||||
diveSite = nullptr;
|
||||
closeDistance = 0;
|
||||
|
||||
MainWindow::instance()->diveList->setEnabled(true);
|
||||
MainWindow::instance()->setEnabledToolbar(true);
|
||||
MainWindow::instance()->setApplicationState(ApplicationState::Default);
|
||||
MultiFilterSortModel::instance()->stopFilterDiveSites();
|
||||
|
||||
// Subtlety alert: diveSite must be cleared *after* exiting the dive-site mode.
|
||||
// Exiting dive-site mode removes the focus from the active widget and
|
||||
// thus fires the corresponding editingFinished signal, which in turn creates
|
||||
// an undo-command. To set an undo-command, the widget has to know the
|
||||
// currently edited dive-site.
|
||||
diveSite = nullptr;
|
||||
}
|
||||
|
||||
void LocationInformationWidget::initFields(dive_site *ds)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue