+ fix inconsistency problem after undo/redo

This commit is contained in:
wmayer 2014-11-16 19:13:06 +01:00
parent 2ead6f9bcf
commit 62de0655d7
2 changed files with 30 additions and 3 deletions

View File

@ -24,6 +24,7 @@
#include "PreCompiled.h" #include "PreCompiled.h"
#ifndef _PreComp_ #ifndef _PreComp_
# include <boost/bind.hpp>
#endif #endif
#include "TaskDlgEditSketch.h" #include "TaskDlgEditSketch.h"
@ -51,11 +52,28 @@ TaskDlgEditSketch::TaskDlgEditSketch(ViewProviderSketch *sketchView)
Content.push_back(General); Content.push_back(General);
Content.push_back(Constraints); Content.push_back(Constraints);
Content.push_back(Elements); Content.push_back(Elements);
App::Document* document = sketchView->getObject()->getDocument();
connectUndoDocument =
document->signalUndo.connect(boost::bind(&TaskDlgEditSketch::slotUndoDocument, this, _1));
connectRedoDocument =
document->signalRedo.connect(boost::bind(&TaskDlgEditSketch::slotRedoDocument, this, _1));
} }
TaskDlgEditSketch::~TaskDlgEditSketch() TaskDlgEditSketch::~TaskDlgEditSketch()
{ {
connectUndoDocument.disconnect();
connectRedoDocument.disconnect();
}
void TaskDlgEditSketch::slotUndoDocument(const App::Document& doc)
{
const_cast<App::Document&>(doc).recomputeFeature(sketchView->getObject());
}
void TaskDlgEditSketch::slotRedoDocument(const App::Document& doc)
{
const_cast<App::Document&>(doc).recomputeFeature(sketchView->getObject());
} }
//==== calls from the TaskView =============================================================== //==== calls from the TaskView ===============================================================

View File

@ -31,6 +31,9 @@
#include "TaskSketcherElements.h" #include "TaskSketcherElements.h"
#include "TaskSketcherGeneral.h" #include "TaskSketcherGeneral.h"
#include "TaskSketcherMessages.h" #include "TaskSketcherMessages.h"
#include <boost/signals.hpp>
typedef boost::signals::connection Connection;
namespace SketcherGui { namespace SketcherGui {
@ -64,12 +67,18 @@ public:
virtual QDialogButtonBox::StandardButtons getStandardButtons(void) const virtual QDialogButtonBox::StandardButtons getStandardButtons(void) const
{ return QDialogButtonBox::Close|QDialogButtonBox::Help; } { return QDialogButtonBox::Close|QDialogButtonBox::Help; }
protected:
void slotUndoDocument(const App::Document&);
void slotRedoDocument(const App::Document&);
protected: protected:
ViewProviderSketch *sketchView; ViewProviderSketch *sketchView;
TaskSketcherConstrains *Constraints; TaskSketcherConstrains *Constraints;
TaskSketcherElements *Elements; TaskSketcherElements *Elements;
TaskSketcherGeneral *General; TaskSketcherGeneral *General;
TaskSketcherMessages *Messages; TaskSketcherMessages *Messages;
Connection connectUndoDocument;
Connection connectRedoDocument;
}; };