mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
2bb2643ae4
Currently, the notes field uses a QTextEdit, which doesn't send a signal if it goes out of focus. But for undo of dive-editing we don't want to create an undo object for *every* text change. Thus, create a custom TextEdit widget that derives from QTextEdit and turns the focusOutEvent into a editingFinished signal. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
20 lines
507 B
C++
20 lines
507 B
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef TEXTEDIT_H
|
|
#define TEXTEDIT_H
|
|
|
|
#include <QTextEdit>
|
|
|
|
// QTextEdit does not possess a signal that fires when the user finished
|
|
// editing the text. This subclass therefore overrides the focusOutEvent
|
|
// and sends the textEdited signal.
|
|
class TextEdit : public QTextEdit {
|
|
Q_OBJECT
|
|
public:
|
|
using QTextEdit::QTextEdit; // Make constructors of QTextEdit available
|
|
signals:
|
|
void editingFinished();
|
|
private:
|
|
void focusOutEvent(QFocusEvent *ev) override;
|
|
};
|
|
|
|
#endif
|