Skip to content

Commit

Permalink
Gui: [skip ci] support undo/redo for view properties in editor
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Feb 8, 2021
1 parent 5323de3 commit 91435c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Gui/PropertyView.cpp
Expand Up @@ -95,11 +95,11 @@ PropertyView::PropertyView(QWidget *parent)
pLayout->addWidget(tabs, 0, 0);

propertyEditorView = new Gui::PropertyEditor::PropertyEditor();
propertyEditorView->setAutomaticDocumentUpdate(false);
propertyEditorView->setAutomaticDocumentUpdate(_GetParam()->GetBool("AutoTransactionView", false));
tabs->addTab(propertyEditorView, tr("View"));

propertyEditorData = new Gui::PropertyEditor::PropertyEditor();
propertyEditorData->setAutomaticDocumentUpdate(true);
propertyEditorData->setAutomaticDocumentUpdate(_GetParam()->GetBool("AutoTransactionData", true));
tabs->addTab(propertyEditorData, tr("Data"));

int preferredTab = _GetParam()->GetInt("LastTabIndex", 1);
Expand Down
6 changes: 6 additions & 0 deletions src/Gui/propertyeditor/PropertyEditor.cpp
Expand Up @@ -38,6 +38,7 @@
#include <App/Application.h>
#include <App/Document.h>
#include <App/AutoTransaction.h>
#include "ViewProviderDocumentObject.h"
#include "MainWindow.h"
#include "DlgAddProperty.h"
#include "PropertyEditor.h"
Expand Down Expand Up @@ -202,6 +203,11 @@ void PropertyEditor::setupTransaction(const QModelIndex &index) {
auto prop = items[0];
auto parent = prop->getContainer();
auto obj = Base::freecad_dynamic_cast<App::DocumentObject>(parent);
if (!obj) {
auto view = Base::freecad_dynamic_cast<ViewProviderDocumentObject>(parent);
if (view)
obj = view->getObject();
}
if(!obj || !obj->getDocument()) {
FC_LOG("invalid object");
return;
Expand Down

0 comments on commit 91435c9

Please sign in to comment.