diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index 64e260f95..c0c130ea0 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -86,6 +86,11 @@ TreeWidget::TreeWidget(QWidget* parent) this->finishEditingAction->setStatusTip(tr("Finish editing object")); connect(this->finishEditingAction, SIGNAL(triggered()), this, SLOT(onFinishEditing())); + this->markRecomputeAction = new QAction(this); + this->markRecomputeAction->setText(tr("Mark to recompute")); + this->markRecomputeAction->setStatusTip(tr("Mark this object to be recomputed")); + connect(this->markRecomputeAction, SIGNAL(triggered()), + this, SLOT(onMarkRecompute())); // Setup connections Application::Instance->signalNewDocument.connect(boost::bind(&TreeWidget::slotNewDocument, this, _1)); @@ -173,6 +178,7 @@ void TreeWidget::contextMenuEvent (QContextMenuEvent * e) if (!contextMenu.actions().isEmpty()) contextMenu.addSeparator(); contextMenu.addAction(this->relabelObjectAction); + contextMenu.addAction(this->markRecomputeAction); // if only one item is selected setup the edit menu if (this->selectedItems().size() == 1) { @@ -300,6 +306,17 @@ void TreeWidget::onFinishEditing() } } +void TreeWidget::onMarkRecompute() +{ + if (this->contextItem && this->contextItem->type() == ObjectType) { + DocumentObjectItem* objitem = static_cast + (this->contextItem); + App::DocumentObject* obj = objitem->object()->getObject(); + if (!obj) return; + obj->touch(); + } +} + void TreeWidget::onActivateDocument(QAction* active) { // activate the specified document @@ -721,6 +738,9 @@ void TreeWidget::changeEvent(QEvent *e) this->finishEditingAction->setText(tr("Finish editing")); this->finishEditingAction->setStatusTip(tr("Finish editing object")); + + this->markRecomputeAction->setText(tr("Mark to recompute")); + this->markRecomputeAction->setStatusTip(tr("Mark this object to be recomputed")); } QTreeWidget::changeEvent(e); diff --git a/src/Gui/Tree.h b/src/Gui/Tree.h index fb3e3f3db..4d27f5462 100644 --- a/src/Gui/Tree.h +++ b/src/Gui/Tree.h @@ -101,6 +101,7 @@ protected Q_SLOTS: void onActivateDocument(QAction*); void onStartEditing(); void onFinishEditing(); + void onMarkRecompute(); private Q_SLOTS: void onItemSelectionChanged(void); @@ -122,6 +123,7 @@ private: QAction* createGroupAction; QAction* relabelObjectAction; QAction* finishEditingAction; + QAction* markRecomputeAction; QTreeWidgetItem* contextItem; QTreeWidgetItem* rootItem;