extend function to mark all selected objects for recompute or all objects of a document
This commit is contained in:
parent
5fa34f519e
commit
ccbd0f02af
|
@ -159,6 +159,7 @@ void TreeWidget::contextMenuEvent (QContextMenuEvent * e)
|
||||||
if (this->contextItem && this->contextItem->type() == DocumentType) {
|
if (this->contextItem && this->contextItem->type() == DocumentType) {
|
||||||
if (!contextMenu.actions().isEmpty())
|
if (!contextMenu.actions().isEmpty())
|
||||||
contextMenu.addSeparator();
|
contextMenu.addSeparator();
|
||||||
|
contextMenu.addAction(this->markRecomputeAction);
|
||||||
contextMenu.addAction(this->createGroupAction);
|
contextMenu.addAction(this->createGroupAction);
|
||||||
}
|
}
|
||||||
else if (this->contextItem && this->contextItem->type() == ObjectType) {
|
else if (this->contextItem && this->contextItem->type() == ObjectType) {
|
||||||
|
@ -177,8 +178,8 @@ void TreeWidget::contextMenuEvent (QContextMenuEvent * e)
|
||||||
}
|
}
|
||||||
if (!contextMenu.actions().isEmpty())
|
if (!contextMenu.actions().isEmpty())
|
||||||
contextMenu.addSeparator();
|
contextMenu.addSeparator();
|
||||||
contextMenu.addAction(this->relabelObjectAction);
|
|
||||||
contextMenu.addAction(this->markRecomputeAction);
|
contextMenu.addAction(this->markRecomputeAction);
|
||||||
|
contextMenu.addAction(this->relabelObjectAction);
|
||||||
|
|
||||||
// if only one item is selected setup the edit menu
|
// if only one item is selected setup the edit menu
|
||||||
if (this->selectedItems().size() == 1) {
|
if (this->selectedItems().size() == 1) {
|
||||||
|
@ -308,12 +309,24 @@ void TreeWidget::onFinishEditing()
|
||||||
|
|
||||||
void TreeWidget::onMarkRecompute()
|
void TreeWidget::onMarkRecompute()
|
||||||
{
|
{
|
||||||
if (this->contextItem && this->contextItem->type() == ObjectType) {
|
// if a document item is selected then touch all objects
|
||||||
DocumentObjectItem* objitem = static_cast<DocumentObjectItem*>
|
if (this->contextItem && this->contextItem->type() == DocumentType) {
|
||||||
(this->contextItem);
|
DocumentItem* docitem = static_cast<DocumentItem*>(this->contextItem);
|
||||||
App::DocumentObject* obj = objitem->object()->getObject();
|
App::Document* doc = docitem->document()->getDocument();
|
||||||
if (!obj) return;
|
std::vector<App::DocumentObject*> obj = doc->getObjects();
|
||||||
obj->touch();
|
for (std::vector<App::DocumentObject*>::iterator it = obj.begin(); it != obj.end(); ++it)
|
||||||
|
(*it)->touch();
|
||||||
|
}
|
||||||
|
// mark all selected objects
|
||||||
|
else {
|
||||||
|
QList<QTreeWidgetItem*> items = this->selectedItems();
|
||||||
|
for (QList<QTreeWidgetItem*>::iterator it = items.begin(); it != items.end(); ++it) {
|
||||||
|
if ((*it)->type() == ObjectType) {
|
||||||
|
DocumentObjectItem* objitem = static_cast<DocumentObjectItem*>(*it);
|
||||||
|
App::DocumentObject* obj = objitem->object()->getObject();
|
||||||
|
obj->touch();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user