+ 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:
wmayer 2011-10-22 11:56:38 +00:00
parent 87dd7826c7
commit d6a0e3cf14
2 changed files with 39 additions and 10 deletions

View File

@ -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());
@ -75,15 +83,34 @@ TaskPadParameters::TaskPadParameters(ViewProviderPad *PadView,QWidget *parent)
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();
@ -178,9 +205,8 @@ bool TaskDlgPadParameters::reject()
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()");

View File

@ -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);