diff options
Diffstat (limited to 'qt-ui/locationinformation.cpp')
-rw-r--r-- | qt-ui/locationinformation.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index 50b3ccb1e..a63571a35 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -232,6 +232,8 @@ SimpleDiveSiteEditDialog::SimpleDiveSiteEditDialog(QWidget *parent) : ui(new Ui::SimpleDiveSiteEditDialog()), changed_dive_site(false) { ui->setupUi(this); + ui->diveSiteDescription->installEventFilter(this); + ui->diveSiteNotes->installEventFilter(this); } SimpleDiveSiteEditDialog::~SimpleDiveSiteEditDialog() @@ -239,6 +241,18 @@ SimpleDiveSiteEditDialog::~SimpleDiveSiteEditDialog() delete ui; } +bool SimpleDiveSiteEditDialog::eventFilter(QObject *obj, QEvent *ev) +{ + if (ev->type() != QEvent::FocusOut) + return false; + + if (obj == ui->diveSiteDescription) { + diveSiteDescription_editingFinished(); + } else if (obj == ui->diveSiteNotes) { + diveSiteNotes_editingFinished(); + } +} + void SimpleDiveSiteEditDialog::showEvent(QShowEvent *ev) { const int heigth = 275; @@ -292,7 +306,7 @@ void SimpleDiveSiteEditDialog::on_diveSiteCoordinates_editingFinished() changed_dive_site = true; } -void SimpleDiveSiteEditDialog::on_diveSiteDescription_editingFinished() +void SimpleDiveSiteEditDialog::diveSiteDescription_editingFinished() { if (ui->diveSiteDescription->toPlainText() == displayed_dive_site.description) return; @@ -301,7 +315,7 @@ void SimpleDiveSiteEditDialog::on_diveSiteDescription_editingFinished() changed_dive_site = true; } -void SimpleDiveSiteEditDialog::on_diveSiteNotes_editingFinished() +void SimpleDiveSiteEditDialog::diveSiteNotes_editingFinished() { if (ui->diveSiteNotes->toPlainText() == displayed_dive_site.notes) return; |