Gui: [skip ci] support undo/redo for view properties in editor
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user