TreeView: update status on manual object touch
This commit is contained in:
@@ -371,16 +371,12 @@ bool Document::setEdit(Gui::ViewProvider* p, int ModNum, const char *subname)
|
||||
}
|
||||
}
|
||||
|
||||
View3DInventor *activeView = dynamic_cast<View3DInventor *>(getActiveView());
|
||||
View3DInventor *view3d = dynamic_cast<View3DInventor *>(getActiveView());
|
||||
// if the currently active view is not the 3d view search for it and activate it
|
||||
if (!activeView) {
|
||||
activeView = dynamic_cast<View3DInventor *>(setActiveView(vp));
|
||||
if(!activeView){
|
||||
FC_ERR("cannot edit without active view");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
getMainWindow()->setActiveWindow(activeView);
|
||||
if (view3d)
|
||||
getMainWindow()->setActiveWindow(view3d);
|
||||
else
|
||||
view3d = dynamic_cast<View3DInventor *>(setActiveView(vp));
|
||||
Application::Instance->setEditDocument(this);
|
||||
|
||||
d->_editViewProviderParent = vp;
|
||||
@@ -402,7 +398,8 @@ bool Document::setEdit(Gui::ViewProvider* p, int ModNum, const char *subname)
|
||||
FC_LOG("object '" << sobj->getFullName() << "' refuse to edit");
|
||||
return false;
|
||||
}
|
||||
activeView->getViewer()->setEditingViewProvider(d->_editViewProvider,ModNum);
|
||||
if(view3d)
|
||||
view3d->getViewer()->setEditingViewProvider(d->_editViewProvider,ModNum);
|
||||
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
|
||||
if (dlg)
|
||||
dlg->setDocumentName(this->getDocument()->getName());
|
||||
@@ -871,7 +868,6 @@ void Document::slotSkipRecompute(const App::Document& doc, const std::vector<App
|
||||
void Document::slotTouchedObject(const App::DocumentObject &Obj)
|
||||
{
|
||||
getMainWindow()->updateActions(true);
|
||||
TreeWidget::updateStatus(true);
|
||||
if(!isModified()) {
|
||||
FC_LOG(Obj.getFullName() << " touched");
|
||||
setModified(true);
|
||||
|
||||
@@ -2155,11 +2155,18 @@ void TreeWidget::slotChangedViewObject(const Gui::ViewProvider& vp, const App::P
|
||||
&& vp.isDerivedFrom(ViewProviderDocumentObject::getClassTypeId()))
|
||||
{
|
||||
const auto &vpd = static_cast<const ViewProviderDocumentObject&>(vp);
|
||||
if(&prop == &vpd.ShowInTree)
|
||||
if(&prop == &vpd.ShowInTree) {
|
||||
ChangedObjects.emplace(vpd.getObject(),0);
|
||||
_updateStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TreeWidget::slotTouchedObject(const App::DocumentObject &obj) {
|
||||
ChangedObjects.emplace(const_cast<App::DocumentObject*>(&obj),0);
|
||||
_updateStatus();
|
||||
}
|
||||
|
||||
void TreeWidget::slotShowHidden(const Gui::Document& Doc)
|
||||
{
|
||||
auto it = DocumentMap.find(&Doc);
|
||||
@@ -2331,10 +2338,14 @@ void TreeWidget::onUpdateStatus(void)
|
||||
|
||||
if(docItem->connectChgObject.connected())
|
||||
continue;
|
||||
docItem->connectChgObject = docItem->document()->signalChangedObject.connect(
|
||||
boost::bind(&TreeWidget::slotChangeObject, this, _1, _2));
|
||||
|
||||
auto doc = v.first->getDocument();
|
||||
|
||||
docItem->connectChgObject = docItem->document()->signalChangedObject.connect(
|
||||
boost::bind(&TreeWidget::slotChangeObject, this, _1, _2));
|
||||
docItem->connectTouchedObject = doc->signalTouchedObject.connect(
|
||||
boost::bind(&TreeWidget::slotTouchedObject, this, _1));
|
||||
|
||||
if(doc->testStatus(App::Document::PartialDoc))
|
||||
docItem->setIcon(0, *documentPartialPixmap);
|
||||
else if(docItem->_ExpandInfo) {
|
||||
@@ -2909,9 +2920,12 @@ DocumentItem::DocumentItem(const Gui::Document* doc, QTreeWidgetItem * parent)
|
||||
connectNewObject = doc->signalNewObject.connect(boost::bind(&DocumentItem::slotNewObject, this, _1));
|
||||
connectDelObject = doc->signalDeletedObject.connect(
|
||||
boost::bind(&TreeWidget::slotDeleteObject, getTree(), _1));
|
||||
if(!App::GetApplication().isRestoring())
|
||||
if(!App::GetApplication().isRestoring()) {
|
||||
connectChgObject = doc->signalChangedObject.connect(
|
||||
boost::bind(&TreeWidget::slotChangeObject, getTree(), _1, _2));
|
||||
connectTouchedObject = doc->getDocument()->signalTouchedObject.connect(
|
||||
boost::bind(&TreeWidget::slotTouchedObject, getTree(), _1));
|
||||
}
|
||||
connectEdtObject = doc->signalInEdit.connect(boost::bind(&DocumentItem::slotInEdit, this, _1));
|
||||
connectResObject = doc->signalResetEdit.connect(boost::bind(&DocumentItem::slotResetEdit, this, _1));
|
||||
connectHltObject = doc->signalHighlightObject.connect(
|
||||
@@ -2934,6 +2948,7 @@ DocumentItem::~DocumentItem()
|
||||
connectNewObject.disconnect();
|
||||
connectDelObject.disconnect();
|
||||
connectChgObject.disconnect();
|
||||
connectTouchedObject.disconnect();
|
||||
connectEdtObject.disconnect();
|
||||
connectResObject.disconnect();
|
||||
connectHltObject.disconnect();
|
||||
|
||||
@@ -193,6 +193,7 @@ private:
|
||||
void _slotDeleteObject(const Gui::ViewProviderDocumentObject&, DocumentItem *deletingDoc);
|
||||
void slotDeleteObject(const Gui::ViewProviderDocumentObject&);
|
||||
void slotChangeObject(const Gui::ViewProviderDocumentObject&, const App::Property &prop);
|
||||
void slotTouchedObject(const App::DocumentObject&);
|
||||
|
||||
void changeEvent(QEvent *e);
|
||||
void setupText();
|
||||
@@ -346,6 +347,7 @@ private:
|
||||
Connection connectNewObject;
|
||||
Connection connectDelObject;
|
||||
Connection connectChgObject;
|
||||
Connection connectTouchedObject;
|
||||
Connection connectEdtObject;
|
||||
Connection connectResObject;
|
||||
Connection connectHltObject;
|
||||
|
||||
Reference in New Issue
Block a user