Desktop: on ESC, remove focus when editing dive fields

Give the user a way to accept the changes made to a dive-field
by pressing ESC.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-02-05 08:01:04 +01:00 committed by Dirk Hohndel
parent 8a33022f39
commit 1c854d580a

View file

@ -721,9 +721,8 @@ void MainTab::acceptChanges()
struct dive *d; struct dive *d;
bool do_replot = false; bool do_replot = false;
if (ui.location->hasFocus()) { if (ui.location->hasFocus())
this->setFocus(); setFocus();
}
acceptingEdit = true; acceptingEdit = true;
tabBar()->setTabIcon(0, QIcon()); // Notes tabBar()->setTabIcon(0, QIcon()); // Notes
@ -1337,8 +1336,12 @@ void MainTab::editWeightWidget(const QModelIndex &index)
void MainTab::escDetected() void MainTab::escDetected()
{ {
// In edit mode, pressing escape cancels the current changes.
// In standard mode, remove focus of any active widget to
if (editMode != NONE) if (editMode != NONE)
rejectChanges(); rejectChanges();
else
setFocus();
} }
void MainTab::clearTabs() { void MainTab::clearTabs() {