From b0928cf1159aa3ec18b832f16fbdc1368bc1e2ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Br=C3=A6strup=20Sayoc?= Date: Thu, 12 Sep 2024 16:23:17 +0200 Subject: [PATCH] [Measure] Redirect enter key press to apply button Fixes #16401. Now call of the save function is dependent on whether the apply button is enabled. The button is only enabled if valid objects to save. --- src/Mod/Measure/Gui/TaskMeasure.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Mod/Measure/Gui/TaskMeasure.cpp b/src/Mod/Measure/Gui/TaskMeasure.cpp index 328ea28b56..a227c31f4e 100644 --- a/src/Mod/Measure/Gui/TaskMeasure.cpp +++ b/src/Mod/Measure/Gui/TaskMeasure.cpp @@ -479,7 +479,9 @@ bool TaskMeasure::eventFilter(QObject* obj, QEvent* event) } if (keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter) { - this->apply(); + // Save object. Indirectly dependent on whether the apply button is enabled + // enabled if valid measurement object. + this->buttonBox->button(QDialogButtonBox::Apply)->click(); return true; } }