summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tagwidget.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-02-07 19:59:34 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-12 18:19:07 +0300
commit8c89f6fe1520d9d88fb81acab995ba803f5c4ac1 (patch)
treefb081e05e0832e91591696187c8fa148464da4c0 /desktop-widgets/tagwidget.cpp
parent1c854d580ae21d6647bcdd5d6db3e57cda9b5f3c (diff)
downloadsubsurface-8c89f6fe1520d9d88fb81acab995ba803f5c4ac1.tar.gz
Undo: implement undo of tag editing
The code follows the other edit-commands, but uses its own base class, because it is distinctly different. Editing the tag field does not simply mean setting the tag for all dives, but rather adding and removing individual tags. This class will be reused for editing of dive buddies and masters. Modify the tag widget thus that it sends an editingFinished() signal when it goes out of focus. The editingFinished() signal was prevented by hooking into the return, enter and tab key-events. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/tagwidget.cpp')
-rw-r--r--desktop-widgets/tagwidget.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/desktop-widgets/tagwidget.cpp b/desktop-widgets/tagwidget.cpp
index 6673b23ac..b09507537 100644
--- a/desktop-widgets/tagwidget.cpp
+++ b/desktop-widgets/tagwidget.cpp
@@ -211,3 +211,11 @@ void TagWidget::fixPopupPosition(int delta)
m_completer->popup()->setGeometry(toGlobal.x(), toGlobal.y() + delta +10, toGlobal.width(), toGlobal.height());
}
}
+
+// Since we capture enter / return / tab, we never send an editingFinished() signal.
+// Therefore, override the focusOutEvent()
+void TagWidget::focusOutEvent(QFocusEvent *ev)
+{
+ GroupedLineEdit::focusOutEvent(ev);
+ emit editingFinished();
+}