diff --git a/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp b/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp index b350a300d9..53b9e353d7 100644 --- a/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp +++ b/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp @@ -442,7 +442,14 @@ App::DocumentObject* TaskFeaturePick::makeCopy(App::DocumentObject* obj, std::st return copy; } -void TaskFeaturePick::onSelectionChanged(const Gui::SelectionChanges& /*msg*/) +bool TaskFeaturePick::isSingleSelectionEnabled() const +{ + ParameterGrp::handle hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")-> + GetGroup("Preferences")->GetGroup("Selection"); + return hGrp->GetBool("singleClickFeatureSelect", true); +} + +void TaskFeaturePick::onSelectionChanged(const Gui::SelectionChanges& msg) { if (doSelection) return; @@ -454,6 +461,12 @@ void TaskFeaturePick::onSelectionChanged(const Gui::SelectionChanges& /*msg*/) QString t = item->data(Qt::UserRole).toString(); if (t.compare(QString::fromLatin1(obj.FeatName))==0) { item->setSelected(true); + + if (msg.Type == Gui::SelectionChanges::AddSelection) { + if (isSingleSelectionEnabled()) { + QMetaObject::invokeMethod(qobject_cast(&Gui::Control()), "accept", Qt::QueuedConnection); + } + } } } } diff --git a/src/Mod/PartDesign/Gui/TaskFeaturePick.h b/src/Mod/PartDesign/Gui/TaskFeaturePick.h index 3f1ed083f6..3ee59d0d73 100644 --- a/src/Mod/PartDesign/Gui/TaskFeaturePick.h +++ b/src/Mod/PartDesign/Gui/TaskFeaturePick.h @@ -66,6 +66,7 @@ public: std::vector getFeatures(); std::vector buildFeatures(); void showExternal(bool val); + bool isSingleSelectionEnabled() const; static App::DocumentObject* makeCopy(App::DocumentObject* obj, std::string sub, bool independent);