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;
bool do_replot = false;
if (ui.location->hasFocus()) {
this->setFocus();
}
if (ui.location->hasFocus())
setFocus();
acceptingEdit = true;
tabBar()->setTabIcon(0, QIcon()); // Notes
@ -1337,8 +1336,12 @@ void MainTab::editWeightWidget(const QModelIndex &index)
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)
rejectChanges();
else
setFocus();
}
void MainTab::clearTabs() {