From 5f8f9842e4d09c7f3fe380cce89d5b4ede9fd241 Mon Sep 17 00:00:00 2001 From: jriegel Date: Mon, 29 Apr 2013 22:21:55 +0200 Subject: [PATCH] wiering the tet dialog --- src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.cpp | 41 +++++++++++++--------- src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.h | 4 ++- src/Mod/Fem/Gui/TaskTetParameter.cpp | 22 +++++------- src/Mod/Fem/Gui/TaskTetParameter.h | 1 + src/Mod/Fem/Gui/TaskTetParameter.ui | 2 +- 5 files changed, 39 insertions(+), 31 deletions(-) diff --git a/src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.cpp b/src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.cpp index 6923bf7c4..e4256429c 100644 --- a/src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.cpp +++ b/src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.cpp @@ -72,23 +72,32 @@ void TaskDlgMeshShapeNetgen::open() } +void TaskDlgMeshShapeNetgen::clicked(int button) +{ + try { + if(QDialogButtonBox::Apply == button) + { + // May throw an exception which we must handle here + FemMeshShapeNetgenObject->execute(); + } + } + catch (const Base::Exception& e) { + Base::Console().Warning("FemMeshShapeNetgenObject::execute(): %s\n", e.what()); + } +} + bool TaskDlgMeshShapeNetgen::accept() { - //try { - // FemSetNodesObject->Nodes.setValues(param->tempSet); - // FemSetNodesObject->recompute(); - // //Gui::Document* doc = Gui::Application::Instance->activeDocument(); - // //if(doc) - // // doc->resetEdit(); - // param->MeshViewProvider->resetHighlightNodes(); - // FemSetNodesObject->Label.setValue(name->name); - // Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()"); + try { + FemMeshShapeNetgenObject->recompute(); + //FemSetNodesObject->Label.setValue(name->name); + Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()"); - // return true; - //} - //catch (const Base::Exception& e) { - // Base::Console().Warning("TaskDlgMeshShapeNetgen::accept(): %s\n", e.what()); - //} + return true; + } + catch (const Base::Exception& e) { + Base::Console().Warning("TaskDlgMeshShapeNetgen::accept(): %s\n", e.what()); + } return false; } @@ -100,8 +109,8 @@ bool TaskDlgMeshShapeNetgen::reject() // //if(doc) // // doc->resetEdit(); //param->MeshViewProvider->resetHighlightNodes(); - //Gui::Command::abortCommand(); - //Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()"); + Gui::Command::abortCommand(); + Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()"); return true; } diff --git a/src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.h b/src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.h index 5c5551fb3..2391c604e 100644 --- a/src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.h +++ b/src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.h @@ -48,6 +48,8 @@ public: public: /// is called the TaskView when the dialog is opened virtual void open(); + /// is called by the framework if an button is clicked which has no accept or rject role + virtual void clicked(int); /// is called by the framework if the dialog is accepted (Ok) virtual bool accept(); /// is called by the framework if the dialog is rejected (Cancel) @@ -57,7 +59,7 @@ public: /// returns for Close and Help button virtual QDialogButtonBox::StandardButtons getStandardButtons(void) const - { return QDialogButtonBox::Ok|QDialogButtonBox::Cancel; } + { return QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Apply; } protected: TaskTetParameter *param; diff --git a/src/Mod/Fem/Gui/TaskTetParameter.cpp b/src/Mod/Fem/Gui/TaskTetParameter.cpp index 05d318725..3ede366eb 100644 --- a/src/Mod/Fem/Gui/TaskTetParameter.cpp +++ b/src/Mod/Fem/Gui/TaskTetParameter.cpp @@ -39,6 +39,7 @@ #include #include #include +#include using namespace FemGui; @@ -60,9 +61,8 @@ TaskTetParameter::TaskTetParameter(Fem::FemMeshShapeNetgenObject *pcObject,QWidg this->groupLayout()->addWidget(proxy); - //QObject::connect(ui->toolButton_Poly,SIGNAL(clicked()),this,SLOT(Poly())); - //QObject::connect(ui->toolButton_Pick,SIGNAL(clicked()),this,SLOT(Pick())); - //QObject::connect(ui->comboBox,SIGNAL(activated (int)),this,SLOT(SwitchMethod(int))); + QObject::connect(ui->doubleSpinBox_MaxSize,SIGNAL(valueChanged(double)),this,SLOT(maxSizeValueChanged(double))); + QObject::connect(ui->comboBox_Fineness,SIGNAL(activated (int)),this,SLOT(SwitchMethod(int))); } @@ -74,15 +74,12 @@ TaskTetParameter::~TaskTetParameter() void TaskTetParameter::SwitchMethod(int Value) { - //if(Value == 1){ - // ui->groupBox_AngleSearch->setEnabled(true); - // ui->toolButton_Pick->setEnabled(true); - // ui->toolButton_Poly->setEnabled(false); - //}else{ - // ui->groupBox_AngleSearch->setEnabled(false); - // ui->toolButton_Pick->setEnabled(false); - // ui->toolButton_Poly->setEnabled(true); - //} + pcObject->Fininess.setValue(Value); +} + +void TaskTetParameter::maxSizeValueChanged(double Value) +{ + pcObject->MaxSize.setValue(Value); } @@ -90,5 +87,4 @@ void TaskTetParameter::SwitchMethod(int Value) - #include "moc_TaskTetParameter.cpp" diff --git a/src/Mod/Fem/Gui/TaskTetParameter.h b/src/Mod/Fem/Gui/TaskTetParameter.h index c14abb1c7..76360e147 100644 --- a/src/Mod/Fem/Gui/TaskTetParameter.h +++ b/src/Mod/Fem/Gui/TaskTetParameter.h @@ -62,6 +62,7 @@ public: private Q_SLOTS: void SwitchMethod(int Value); + void maxSizeValueChanged(double Value); protected: Fem::FemMeshShapeNetgenObject *pcObject; diff --git a/src/Mod/Fem/Gui/TaskTetParameter.ui b/src/Mod/Fem/Gui/TaskTetParameter.ui index a72ea70d4..ab6ac67f4 100644 --- a/src/Mod/Fem/Gui/TaskTetParameter.ui +++ b/src/Mod/Fem/Gui/TaskTetParameter.ui @@ -30,7 +30,7 @@ - +