From 8f2ff7d7f683aca4b589674c53c067bc50997815 Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Sun, 25 May 2025 03:35:42 -0600 Subject: [PATCH] Gui: property-editor open the combo directly and apply after selection Previously you had to make 4 clicks to apply a combo 1 to enter edit, 1 to open the combo, 1 to select, and 1 to defocus and apply with this commit only 2 clicks: 1 to open the combo and 1 to select --- src/Gui/propertyeditor/PropertyItemDelegate.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Gui/propertyeditor/PropertyItemDelegate.cpp b/src/Gui/propertyeditor/PropertyItemDelegate.cpp index 73abaf8464..42ee976a89 100644 --- a/src/Gui/propertyeditor/PropertyItemDelegate.cpp +++ b/src/Gui/propertyeditor/PropertyItemDelegate.cpp @@ -25,6 +25,7 @@ #ifndef _PreComp_ # include +# include # include # include #endif @@ -127,7 +128,16 @@ bool PropertyItemDelegate::editorEvent (QEvent * event, QAbstractItemModel* mode bool PropertyItemDelegate::eventFilter(QObject *o, QEvent *ev) { - if (ev->type() == QEvent::FocusOut) { + if (ev->type() == QEvent::FocusIn) { + auto *comboBox = qobject_cast(o); + if (comboBox) { + auto parentEditor = qobject_cast(this->parent()); + if (parentEditor && parentEditor->activeEditor == comboBox) { + comboBox->showPopup(); + } + } + } + else if (ev->type() == QEvent::FocusOut) { auto parentEditor = qobject_cast(this->parent()); auto widget = qobject_cast(o); if (widget && parentEditor && parentEditor->activeEditor @@ -218,6 +228,10 @@ void PropertyItemDelegate::valueChanged() if (propertyEditor) { Base::FlagToggler<> flag(changed); Q_EMIT commitData(propertyEditor); + auto *comboBox = qobject_cast(propertyEditor); + if (comboBox) { + Q_EMIT closeEditor(propertyEditor); + } } }