+ 0000454: Illegal storage access crash when canceling pad
+ live update of changes on pad task panel git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5053 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
parent
87dd7826c7
commit
d6a0e3cf14
|
@ -29,6 +29,7 @@
|
||||||
#include "ui_TaskPadParameters.h"
|
#include "ui_TaskPadParameters.h"
|
||||||
#include "TaskPadParameters.h"
|
#include "TaskPadParameters.h"
|
||||||
#include <App/Application.h>
|
#include <App/Application.h>
|
||||||
|
#include <App/Document.h>
|
||||||
#include <Gui/Application.h>
|
#include <Gui/Application.h>
|
||||||
#include <Gui/Document.h>
|
#include <Gui/Document.h>
|
||||||
#include <Gui/BitmapFactory.h>
|
#include <Gui/BitmapFactory.h>
|
||||||
|
@ -55,6 +56,13 @@ TaskPadParameters::TaskPadParameters(ViewProviderPad *PadView,QWidget *parent)
|
||||||
ui->setupUi(proxy);
|
ui->setupUi(proxy);
|
||||||
QMetaObject::connectSlotsByName(this);
|
QMetaObject::connectSlotsByName(this);
|
||||||
|
|
||||||
|
connect(ui->doubleSpinBox, SIGNAL(valueChanged(double)),
|
||||||
|
this, SLOT(onLengthChanged(double)));
|
||||||
|
connect(ui->checkBoxMirrored, SIGNAL(toggled(bool)),
|
||||||
|
this, SLOT(onMirrored(bool)));
|
||||||
|
connect(ui->checkBoxReversed, SIGNAL(toggled(bool)),
|
||||||
|
this, SLOT(onReversed(bool)));
|
||||||
|
|
||||||
this->groupLayout()->addWidget(proxy);
|
this->groupLayout()->addWidget(proxy);
|
||||||
|
|
||||||
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
|
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
|
||||||
|
@ -68,22 +76,41 @@ TaskPadParameters::TaskPadParameters(ViewProviderPad *PadView,QWidget *parent)
|
||||||
|
|
||||||
// check if the sketch has support
|
// check if the sketch has support
|
||||||
Sketcher::SketchObject *pcSketch;
|
Sketcher::SketchObject *pcSketch;
|
||||||
if(pcPad->Sketch.getValue() ){
|
if (pcPad->Sketch.getValue()) {
|
||||||
pcSketch = static_cast<Sketcher::SketchObject*>(pcPad->Sketch.getValue());
|
pcSketch = static_cast<Sketcher::SketchObject*>(pcPad->Sketch.getValue());
|
||||||
if(pcSketch->Support.getValue() )
|
if (pcSketch->Support.getValue())
|
||||||
// in case of sketch with support, reverse makes no sense (goes into the part)
|
// in case of sketch with support, reverse makes no sense (goes into the part)
|
||||||
ui->checkBoxReversed->setEnabled(0);
|
ui->checkBoxReversed->setEnabled(0);
|
||||||
else
|
else
|
||||||
ui->checkBoxReversed->setChecked(reversed);
|
ui->checkBoxReversed->setChecked(reversed);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ui->checkBoxReversed->setChecked(reversed);
|
ui->checkBoxReversed->setChecked(reversed);
|
||||||
|
|
||||||
setFocus ();
|
setFocus ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TaskPadParameters::onLengthChanged(double len)
|
||||||
|
{
|
||||||
|
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
|
||||||
|
pcPad->Length.setValue((float)len);
|
||||||
|
pcPad->getDocument()->recomputeFeature(pcPad);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TaskPadParameters::onMirrored(bool on)
|
||||||
|
{
|
||||||
|
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
|
||||||
|
pcPad->MirroredExtent.setValue(on);
|
||||||
|
pcPad->getDocument()->recomputeFeature(pcPad);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TaskPadParameters::onReversed(bool on)
|
||||||
|
{
|
||||||
|
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
|
||||||
|
pcPad->Reversed.setValue(on);
|
||||||
|
pcPad->getDocument()->recomputeFeature(pcPad);
|
||||||
|
}
|
||||||
|
|
||||||
double TaskPadParameters::getLength(void) const
|
double TaskPadParameters::getLength(void) const
|
||||||
{
|
{
|
||||||
return ui->doubleSpinBox->value();
|
return ui->doubleSpinBox->value();
|
||||||
|
@ -165,7 +192,7 @@ bool TaskDlgPadParameters::reject()
|
||||||
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
|
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
|
||||||
Sketcher::SketchObject *pcSketch;
|
Sketcher::SketchObject *pcSketch;
|
||||||
App::DocumentObject *pcSupport;
|
App::DocumentObject *pcSupport;
|
||||||
if(pcPad->Sketch.getValue() ){
|
if (pcPad->Sketch.getValue()) {
|
||||||
pcSketch = static_cast<Sketcher::SketchObject*>(pcPad->Sketch.getValue());
|
pcSketch = static_cast<Sketcher::SketchObject*>(pcPad->Sketch.getValue());
|
||||||
pcSupport = pcSketch->Support.getValue();
|
pcSupport = pcSketch->Support.getValue();
|
||||||
}
|
}
|
||||||
|
@ -175,12 +202,11 @@ bool TaskDlgPadParameters::reject()
|
||||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
|
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
|
||||||
|
|
||||||
// if abort command deleted the object the support is visible again
|
// if abort command deleted the object the support is visible again
|
||||||
if( ! Gui::Application::Instance->getViewProvider(pcPad) ){
|
if (!Gui::Application::Instance->getViewProvider(pcPad)) {
|
||||||
if(pcSketch && Gui::Application::Instance->getViewProvider(pcSketch))
|
if (pcSketch && Gui::Application::Instance->getViewProvider(pcSketch))
|
||||||
Gui::Application::Instance->getViewProvider(pcSketch)->show();
|
Gui::Application::Instance->getViewProvider(pcSketch)->show();
|
||||||
if(pcPad && Gui::Application::Instance->getViewProvider(pcSupport))
|
if (pcSupport && Gui::Application::Instance->getViewProvider(pcSupport))
|
||||||
Gui::Application::Instance->getViewProvider(pcSupport)->show();
|
Gui::Application::Instance->getViewProvider(pcSupport)->show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()");
|
//Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()");
|
||||||
|
|
|
@ -57,6 +57,9 @@ public:
|
||||||
bool getMirroredExtent(void) const;
|
bool getMirroredExtent(void) const;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
|
void onLengthChanged(double);
|
||||||
|
void onMirrored(bool);
|
||||||
|
void onReversed(bool);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent(QEvent *e);
|
void changeEvent(QEvent *e);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user