+ Fix transaction issues
This commit is contained in:
parent
7bef06f329
commit
01921f4f25
|
@ -259,12 +259,21 @@ void TreeWidget::onStartEditing()
|
|||
Gui::Document* doc = Gui::Application::Instance->getDocument(obj->getDocument());
|
||||
MDIView *view = doc->getActiveView();
|
||||
if (view) getMainWindow()->setActiveWindow(view);
|
||||
|
||||
// Always open a transaction here doesn't make much sense because:
|
||||
// - many objects open transactions when really changing some properties
|
||||
// - this leads to certain inconsistencies with the doubleClicked() method
|
||||
// So, only the view provider class should decide what to do
|
||||
#if 0
|
||||
// open a transaction before starting edit mode
|
||||
std::string cmd("Edit ");
|
||||
cmd += obj->Label.getValue();
|
||||
doc->openCommand(cmd.c_str());
|
||||
bool ok = doc->setEdit(objitem->object(), edit);
|
||||
if (!ok) doc->abortCommand();
|
||||
#else
|
||||
doc->setEdit(objitem->object(), edit);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <Mod/Raytracing/App/LuxProject.h>
|
||||
#include <Mod/Raytracing/App/RayProject.h>
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
|
@ -90,8 +91,12 @@ bool ViewProviderLux::setEdit(int ModNum)
|
|||
bool ok;
|
||||
QString file = QInputDialog::getItem(Gui::getMainWindow(), tr("Template"), tr("Select a template"), items, current, false, &ok);
|
||||
if (ok) {
|
||||
App::Document* doc = getObject()->getDocument();
|
||||
doc->openTransaction("Edit Lux project");
|
||||
QString fn = QString::fromAscii("%1%2.lxs").arg(dataDir).arg(file);
|
||||
static_cast<Raytracing::LuxProject*>(getObject())->Template.setValue((const char*)fn.toUtf8());
|
||||
doc->commitTransaction();
|
||||
doc->recompute();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -158,8 +163,12 @@ bool ViewProviderPovray::setEdit(int ModNum)
|
|||
bool ok;
|
||||
QString file = QInputDialog::getItem(Gui::getMainWindow(), tr("Template"), tr("Select a template"), items, current, false, &ok);
|
||||
if (ok) {
|
||||
App::Document* doc = getObject()->getDocument();
|
||||
doc->openTransaction("Edit Povray project");
|
||||
QString fn = QString::fromAscii("%1%2.pov").arg(dataDir).arg(file);
|
||||
static_cast<Raytracing::RayProject*>(getObject())->Template.setValue((const char*)fn.toUtf8());
|
||||
doc->commitTransaction();
|
||||
doc->recompute();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user