diff --git a/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp b/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp index fd49cc49d3..5d11ba6355 100644 --- a/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp +++ b/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp @@ -26,6 +26,7 @@ #ifndef _PreComp_ # include # include +# include #endif #include @@ -96,6 +97,8 @@ TaskFeaturePick::TaskFeaturePick(std::vector& objects, connect(ui->radioDependent, SIGNAL(toggled(bool)), this, SLOT(onUpdate(bool))); connect(ui->radioXRef, SIGNAL(toggled(bool)), this, SLOT(onUpdate(bool))); connect(ui->listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onItemSelectionChanged())); + connect(ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(onDoubleClick(QListWidgetItem *))); + enum { axisBit=0, planeBit = 1}; @@ -471,6 +474,18 @@ void TaskFeaturePick::onItemSelectionChanged() doSelection = false; } +void TaskFeaturePick::onDoubleClick(QListWidgetItem *item) +{ + if (doSelection) + return; + doSelection = true; + QString t = item->data(Qt::UserRole).toString(); + Gui::Selection().addSelection(documentName.c_str(), t.toLatin1()); + doSelection = false; + + QMetaObject::invokeMethod(qobject_cast(&Gui::Control()), "accept", Qt::QueuedConnection); +} + void TaskFeaturePick::slotDeletedObject(const Gui::ViewProviderDocumentObject& Obj) { std::vector::iterator it; @@ -572,4 +587,5 @@ void TaskDlgFeaturePick::showExternal(bool val) } + #include "moc_TaskFeaturePick.cpp" diff --git a/src/Mod/PartDesign/Gui/TaskFeaturePick.h b/src/Mod/PartDesign/Gui/TaskFeaturePick.h index eef80dc5c2..bdce4fd7d6 100644 --- a/src/Mod/PartDesign/Gui/TaskFeaturePick.h +++ b/src/Mod/PartDesign/Gui/TaskFeaturePick.h @@ -31,6 +31,7 @@ #include #include +#include namespace PartDesignGui { @@ -55,22 +56,23 @@ public: afterTip }; - TaskFeaturePick(std::vector &objects, + TaskFeaturePick(std::vector &objects, const std::vector &status, QWidget *parent = 0); - + ~TaskFeaturePick(); std::vector getFeatures(); std::vector buildFeatures(); void showExternal(bool val); - + static App::DocumentObject* makeCopy(App::DocumentObject* obj, std::string sub, bool independent); - + protected Q_SLOTS: void onUpdate(bool); void onSelectionChanged(const Gui::SelectionChanges& msg); void onItemSelectionChanged(); + void onDoubleClick(QListWidgetItem *item); protected: /** Notifies when the object is about to be removed. */ @@ -117,16 +119,17 @@ public: virtual bool accept(); /// is called by the framework if the dialog is rejected (Cancel) virtual bool reject(); - /// is called by the framework if the user presses the help button + /// is called by the framework if the user presses the help button virtual bool isAllowedAlterDocument(void) const { return false; } - + void showExternal(bool val); - /// returns for Close and Help button + /// returns for Close and Help button virtual QDialogButtonBox::StandardButtons getStandardButtons(void) const { return QDialogButtonBox::Ok|QDialogButtonBox::Cancel; } + protected: TaskFeaturePick *pick; bool accepted;