PartDesignGui: move signal connections in several parameter dialogs after ui initialization

This commit is contained in:
Alexander Golubev 2015-07-23 01:34:35 +03:00 committed by Stefan Tröger
parent f16829baee
commit 11a71d46e3
6 changed files with 90 additions and 120 deletions

View File

@ -57,15 +57,6 @@ TaskChamferParameters::TaskChamferParameters(ViewProviderDressUp *DressUpView,QW
proxy = new QWidget(this);
ui = new Ui_TaskChamferParameters();
ui->setupUi(proxy);
QMetaObject::connectSlotsByName(this);
connect(ui->chamferDistance, SIGNAL(valueChanged(double)),
this, SLOT(onLengthChanged(double)));
connect(ui->buttonRefAdd, SIGNAL(toggled(bool)),
this, SLOT(onButtonRefAdd(bool)));
connect(ui->buttonRefRemove, SIGNAL(toggled(bool)),
this, SLOT(onButtonRefRemove(bool)));
this->groupLayout()->addWidget(proxy);
PartDesign::Chamfer* pcChamfer = static_cast<PartDesign::Chamfer*>(DressUpView->getObject());
@ -82,6 +73,16 @@ TaskChamferParameters::TaskChamferParameters(ViewProviderDressUp *DressUpView,QW
{
ui->listWidgetReferences->addItem(QString::fromStdString(*i));
}
QMetaObject::connectSlotsByName(this);
connect(ui->chamferDistance, SIGNAL(valueChanged(double)),
this, SLOT(onLengthChanged(double)));
connect(ui->buttonRefAdd, SIGNAL(toggled(bool)),
this, SLOT(onButtonRefAdd(bool)));
connect(ui->buttonRefRemove, SIGNAL(toggled(bool)),
this, SLOT(onButtonRefRemove(bool)));
// Create context menu
QAction* action = new QAction(tr("Remove"), this);
ui->listWidgetReferences->addAction(action);

View File

@ -57,20 +57,6 @@ TaskDraftParameters::TaskDraftParameters(ViewProviderDressUp *DressUpView,QWidge
proxy = new QWidget(this);
ui = new Ui_TaskDraftParameters();
ui->setupUi(proxy);
QMetaObject::connectSlotsByName(this);
connect(ui->draftAngle, SIGNAL(valueChanged(double)),
this, SLOT(onAngleChanged(double)));
connect(ui->checkReverse, SIGNAL(toggled(bool)),
this, SLOT(onReversedChanged(bool)));
connect(ui->buttonRefAdd, SIGNAL(toggled(bool)),
this, SLOT(onButtonRefAdd(bool)));
connect(ui->buttonRefRemove, SIGNAL(toggled(bool)),
this, SLOT(onButtonRefRemove(bool)));
connect(ui->buttonPlane, SIGNAL(toggled(bool)),
this, SLOT(onButtonPlane(bool)));
connect(ui->buttonLine, SIGNAL(toggled(bool)),
this, SLOT(onButtonLine(bool)));
this->groupLayout()->addWidget(proxy);
@ -91,6 +77,22 @@ TaskDraftParameters::TaskDraftParameters(ViewProviderDressUp *DressUpView,QWidge
{
ui->listWidgetReferences->addItem(QString::fromStdString(*i));
}
QMetaObject::connectSlotsByName(this);
connect(ui->draftAngle, SIGNAL(valueChanged(double)),
this, SLOT(onAngleChanged(double)));
connect(ui->checkReverse, SIGNAL(toggled(bool)),
this, SLOT(onReversedChanged(bool)));
connect(ui->buttonRefAdd, SIGNAL(toggled(bool)),
this, SLOT(onButtonRefAdd(bool)));
connect(ui->buttonRefRemove, SIGNAL(toggled(bool)),
this, SLOT(onButtonRefRemove(bool)));
connect(ui->buttonPlane, SIGNAL(toggled(bool)),
this, SLOT(onButtonPlane(bool)));
connect(ui->buttonLine, SIGNAL(toggled(bool)),
this, SLOT(onButtonLine(bool)));
// Create context menu
QAction* action = new QAction(tr("Remove"), this);
ui->listWidgetReferences->addAction(action);

View File

@ -56,14 +56,6 @@ TaskFilletParameters::TaskFilletParameters(ViewProviderDressUp *DressUpView,QWid
proxy = new QWidget(this);
ui = new Ui_TaskFilletParameters();
ui->setupUi(proxy);
QMetaObject::connectSlotsByName(this);
connect(ui->filletRadius, SIGNAL(valueChanged(double)),
this, SLOT(onLengthChanged(double)));
connect(ui->buttonRefAdd, SIGNAL(toggled(bool)),
this, SLOT(onButtonRefAdd(bool)));
connect(ui->buttonRefRemove, SIGNAL(toggled(bool)),
this, SLOT(onButtonRefRemove(bool)));
this->groupLayout()->addWidget(proxy);
@ -81,6 +73,16 @@ TaskFilletParameters::TaskFilletParameters(ViewProviderDressUp *DressUpView,QWid
{
ui->listWidgetReferences->addItem(QString::fromStdString(*i));
}
QMetaObject::connectSlotsByName(this);
connect(ui->filletRadius, SIGNAL(valueChanged(double)),
this, SLOT(onLengthChanged(double)));
connect(ui->buttonRefAdd, SIGNAL(toggled(bool)),
this, SLOT(onButtonRefAdd(bool)));
connect(ui->buttonRefRemove, SIGNAL(toggled(bool)),
this, SLOT(onButtonRefRemove(bool)));
// Create context menu
QAction* action = new QAction(tr("Remove"), this);
ui->listWidgetReferences->addAction(action);

View File

@ -61,39 +61,9 @@ TaskPadParameters::TaskPadParameters(ViewProviderPad *PadView,bool newObj, QWidg
proxy = new QWidget(this);
ui = new Ui_TaskPadParameters();
ui->setupUi(proxy);
QMetaObject::connectSlotsByName(this);
connect(ui->lengthEdit, SIGNAL(valueChanged(double)),
this, SLOT(onLengthChanged(double)));
connect(ui->checkBoxMidplane, SIGNAL(toggled(bool)),
this, SLOT(onMidplane(bool)));
connect(ui->checkBoxReversed, SIGNAL(toggled(bool)),
this, SLOT(onReversed(bool)));
connect(ui->lengthEdit2, SIGNAL(valueChanged(double)),
this, SLOT(onLength2Changed(double)));
connect(ui->spinOffset, SIGNAL(valueChanged(double)),
this, SLOT(onOffsetChanged(double)));
connect(ui->changeMode, SIGNAL(currentIndexChanged(int)),
this, SLOT(onModeChanged(int)));
connect(ui->buttonFace, SIGNAL(clicked()),
this, SLOT(onButtonFace()));
connect(ui->lineFaceName, SIGNAL(textEdited(QString)),
this, SLOT(onFaceName(QString)));
connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)),
this, SLOT(onUpdateView(bool)));
this->groupLayout()->addWidget(proxy);
// Temporarily prevent unnecessary feature recomputes
ui->lengthEdit->blockSignals(true);
ui->lengthEdit2->blockSignals(true);
ui->spinOffset->blockSignals(true);
ui->checkBoxMidplane->blockSignals(true);
ui->checkBoxReversed->blockSignals(true);
ui->buttonFace->blockSignals(true);
ui->lineFaceName->blockSignals(true);
ui->changeMode->blockSignals(true);
// set the history path
ui->lengthEdit->setParamGrpPath(QByteArray("User parameter:BaseApp/History/PadLength"));
ui->lengthEdit2->setParamGrpPath(QByteArray("User parameter:BaseApp/History/PadLength2"));
@ -150,16 +120,26 @@ TaskPadParameters::TaskPadParameters(ViewProviderPad *PadView,bool newObj, QWidg
ui->changeMode->insertItem(4, tr("Two dimensions"));
ui->changeMode->setCurrentIndex(index);
// activate and de-activate dialog elements as appropriate
ui->lengthEdit->blockSignals(false);
ui->lengthEdit2->blockSignals(false);
ui->spinOffset->blockSignals(false);
ui->checkBoxMidplane->blockSignals(false);
ui->checkBoxReversed->blockSignals(false);
ui->buttonFace->blockSignals(false);
ui->lineFaceName->blockSignals(false);
ui->changeMode->blockSignals(false);
updateUI(index);
QMetaObject::connectSlotsByName(this);
connect(ui->lengthEdit, SIGNAL(valueChanged(double)),
this, SLOT(onLengthChanged(double)));
connect(ui->checkBoxMidplane, SIGNAL(toggled(bool)),
this, SLOT(onMidplane(bool)));
connect(ui->checkBoxReversed, SIGNAL(toggled(bool)),
this, SLOT(onReversed(bool)));
connect(ui->lengthEdit2, SIGNAL(valueChanged(double)),
this, SLOT(onLength2Changed(double)));
connect(ui->spinOffset, SIGNAL(valueChanged(double)),
this, SLOT(onOffsetChanged(double)));
connect(ui->changeMode, SIGNAL(currentIndexChanged(int)),
this, SLOT(onModeChanged(int)));
connect(ui->buttonFace, SIGNAL(clicked()),
this, SLOT(onButtonFace()));
connect(ui->lineFaceName, SIGNAL(textEdited(QString)),
this, SLOT(onFaceName(QString)));
connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)),
this, SLOT(onUpdateView(bool)));
// if it is a newly created object use the last value of the history
if(newObj){

View File

@ -61,36 +61,9 @@ TaskPocketParameters::TaskPocketParameters(ViewProviderPocket *PocketView,QWidge
proxy = new QWidget(this);
ui = new Ui_TaskPocketParameters();
ui->setupUi(proxy);
QMetaObject::connectSlotsByName(this);
connect(ui->pocketLength, SIGNAL(valueChanged(double)),
this, SLOT(onLengthChanged(double)));
connect(ui->spinOffset, SIGNAL(valueChanged(double)),
this, SLOT(onOffsetChanged(double)));
connect(ui->checkBoxMidplane, SIGNAL(toggled(bool)),
this, SLOT(onMidplaneChanged(bool)));
connect(ui->checkBoxReversed, SIGNAL(toggled(bool)),
this, SLOT(onReversedChanged(bool)));
connect(ui->changeMode, SIGNAL(currentIndexChanged(int)),
this, SLOT(onModeChanged(int)));
connect(ui->buttonFace, SIGNAL(pressed()),
this, SLOT(onButtonFace()));
connect(ui->lineFaceName, SIGNAL(textEdited(QString)),
this, SLOT(onFaceName(QString)));
connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)),
this, SLOT(onUpdateView(bool)));
this->groupLayout()->addWidget(proxy);
// Temporarily prevent unnecessary feature recomputes
ui->pocketLength->blockSignals(true);
ui->spinOffset->blockSignals(true);
ui->checkBoxMidplane->blockSignals(true);
ui->checkBoxReversed->blockSignals(true);
ui->buttonFace->blockSignals(true);
ui->lineFaceName->blockSignals(true);
ui->changeMode->blockSignals(true);
// Get the feature data
PartDesign::Pocket* pcPocket = static_cast<PartDesign::Pocket*>(vp->getObject());
double l = pcPocket->Length.getValue();
@ -135,13 +108,24 @@ TaskPocketParameters::TaskPocketParameters(ViewProviderPocket *PocketView,QWidge
// Bind input fields to properties
ui->pocketLength->bind(pcPocket->Length);
ui->pocketLength->blockSignals(false);
ui->spinOffset->blockSignals(false);
ui->checkBoxMidplane->blockSignals(false);
ui->checkBoxReversed->blockSignals(false);
ui->buttonFace->blockSignals(false);
ui->lineFaceName->blockSignals(false);
ui->changeMode->blockSignals(false);
QMetaObject::connectSlotsByName(this);
connect(ui->pocketLength, SIGNAL(valueChanged(double)),
this, SLOT(onLengthChanged(double)));
connect(ui->spinOffset, SIGNAL(valueChanged(double)),
this, SLOT(onOffsetChanged(double)));
connect(ui->checkBoxMidplane, SIGNAL(toggled(bool)),
this, SLOT(onMidplaneChanged(bool)));
connect(ui->checkBoxReversed, SIGNAL(toggled(bool)),
this, SLOT(onReversedChanged(bool)));
connect(ui->changeMode, SIGNAL(currentIndexChanged(int)),
this, SLOT(onModeChanged(int)));
connect(ui->buttonFace, SIGNAL(pressed()),
this, SLOT(onButtonFace()));
connect(ui->lineFaceName, SIGNAL(textEdited(QString)),
this, SLOT(onFaceName(QString)));
connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)),
this, SLOT(onUpdateView(bool)));
ui->checkBoxReversed->setVisible(true);

View File

@ -56,21 +56,6 @@ TaskThicknessParameters::TaskThicknessParameters(ViewProviderDressUp *DressUpVie
proxy = new QWidget(this);
ui = new Ui_TaskThicknessParameters();
ui->setupUi(proxy);
QMetaObject::connectSlotsByName(this);
connect(ui->Value, SIGNAL(valueChanged(double)),
this, SLOT(onValueChanged(double)));
connect(ui->checkReverse, SIGNAL(toggled(bool)),
this, SLOT(onReversedChanged(bool)));
connect(ui->buttonRefAdd, SIGNAL(toggled(bool)),
this, SLOT(onButtonRefAdd(bool)));
connect(ui->buttonRefRemove, SIGNAL(toggled(bool)),
this, SLOT(onButtonRefRemove(bool)));
connect(ui->modeComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(onModeChanged(int)));
connect(ui->joinComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(onJoinTypeChanged(int)));
this->groupLayout()->addWidget(proxy);
PartDesign::Thickness* pcThickness = static_cast<PartDesign::Thickness*>(DressUpView->getObject());
@ -90,6 +75,22 @@ TaskThicknessParameters::TaskThicknessParameters(ViewProviderDressUp *DressUpVie
{
ui->listWidgetReferences->addItem(QString::fromStdString(*i));
}
QMetaObject::connectSlotsByName(this);
connect(ui->Value, SIGNAL(valueChanged(double)),
this, SLOT(onValueChanged(double)));
connect(ui->checkReverse, SIGNAL(toggled(bool)),
this, SLOT(onReversedChanged(bool)));
connect(ui->buttonRefAdd, SIGNAL(toggled(bool)),
this, SLOT(onButtonRefAdd(bool)));
connect(ui->buttonRefRemove, SIGNAL(toggled(bool)),
this, SLOT(onButtonRefRemove(bool)));
connect(ui->modeComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(onModeChanged(int)));
connect(ui->joinComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(onJoinTypeChanged(int)));
// Create context menu
QAction* action = new QAction(tr("Remove"), this);
ui->listWidgetReferences->addAction(action);