summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-02-05 08:01:04 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-12 18:19:07 +0300
commit1c854d580ae21d6647bcdd5d6db3e57cda9b5f3c (patch)
treeb833ec43a9e8fe064bf024ea987214cc26005141 /desktop-widgets/tab-widgets/maintab.cpp
parent8a33022f39090feff9212a1a61460f4bc75928c5 (diff)
downloadsubsurface-1c854d580ae21d6647bcdd5d6db3e57cda9b5f3c.tar.gz
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>
Diffstat (limited to 'desktop-widgets/tab-widgets/maintab.cpp')
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index 677b5adb2..11ec9690b 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -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() {