Refactoring. Delete repetitive code.
--HG-- branch : feature
This commit is contained in:
parent
ce19b4ccab
commit
ac71fd3cad
|
@ -39,32 +39,28 @@
|
|||
*/
|
||||
DialogAlongLine::DialogAlongLine(const VContainer *data, QWidget *parent)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogAlongLine), number(0), pointName(QString()), typeLine(QString()),
|
||||
formula(QString()), firstPointId(0), secondPointId(0), formulaBaseHeight(0)
|
||||
formula(QString()), firstPointId(0), secondPointId(0), formulaBaseHeight(ui->plainTextEditFormula->height())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
labelResultCalculation = ui->labelResultCalculation;
|
||||
plainTextEditFormula = ui->plainTextEditFormula;
|
||||
labelEditFormula = ui->labelEditFormula;
|
||||
|
||||
this->formulaBaseHeight=ui->plainTextEditFormula->height();
|
||||
InitVariables(ui);
|
||||
InitFormulaUI(ui);
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
flagFormula = false;
|
||||
flagName = false;
|
||||
InitOkCancelApply(ui);
|
||||
CheckState();
|
||||
|
||||
FillComboBoxTypeLine(ui->comboBoxLineType);
|
||||
ui->comboBoxLineType->setCurrentIndex(0);
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
FillComboBoxTypeLine(ui->comboBoxLineType);
|
||||
ui->comboBoxLineType->setCurrentIndex(0);
|
||||
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogAlongLine::PutHere);
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogAlongLine::NamePointChanged);
|
||||
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogAlongLine::EvalFormula);
|
||||
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogAlongLine::FormulaTextChanged);
|
||||
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogAlongLine::DeployFormulaTextEdit);
|
||||
InitVariables(ui);
|
||||
connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogTool::PutVal);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,8 @@
|
|||
DialogArc::DialogArc(const VContainer *data, QWidget *parent)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false),
|
||||
timerRadius(nullptr), timerF1(nullptr), timerF2(nullptr), center(0), radius(QString()), f1(QString()),
|
||||
f2(QString()), formulaBaseHeight(0), formulaBaseHeightF1(0), formulaBaseHeightF2(0)
|
||||
f2(QString()), formulaBaseHeight(ui->plainTextEditFormula->height()),
|
||||
formulaBaseHeightF1(ui->plainTextEditF1->height()), formulaBaseHeightF2(ui->plainTextEditF2->height())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -63,10 +64,6 @@ DialogArc::DialogArc(const VContainer *data, QWidget *parent)
|
|||
|
||||
InitOkCancelApply(ui);
|
||||
|
||||
this->formulaBaseHeight=ui->plainTextEditFormula->height();
|
||||
this->formulaBaseHeightF1=ui->plainTextEditF1->height();
|
||||
this->formulaBaseHeightF2=ui->plainTextEditF2->height();
|
||||
|
||||
FillComboBoxPoints(ui->comboBoxBasePoint);
|
||||
|
||||
CheckState();
|
||||
|
|
|
@ -40,17 +40,14 @@
|
|||
*/
|
||||
DialogBisector::DialogBisector(const VContainer *data, QWidget *parent)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogBisector), number(0), pointName(QString()), typeLine(QString()),
|
||||
formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0), formulaBaseHeight(0)
|
||||
formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0),
|
||||
formulaBaseHeight(ui->plainTextEditFormula->height())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
labelResultCalculation = ui->labelResultCalculation;
|
||||
plainTextEditFormula = ui->plainTextEditFormula;
|
||||
labelEditFormula = ui->labelEditFormula;
|
||||
InitFormulaUI(ui);
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
|
||||
this->formulaBaseHeight=ui->plainTextEditFormula->height();
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
flagFormula = false;
|
||||
flagName = false;
|
||||
|
@ -58,8 +55,8 @@ DialogBisector::DialogBisector(const VContainer *data, QWidget *parent)
|
|||
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
FillComboBoxPoints(ui->comboBoxThirdPoint);
|
||||
FillComboBoxTypeLine(ui->comboBoxLineType);
|
||||
FillComboBoxPoints(ui->comboBoxThirdPoint);
|
||||
|
||||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogBisector::PutHere);
|
||||
connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogBisector::PutVal);
|
||||
|
|
|
@ -40,20 +40,17 @@
|
|||
*/
|
||||
DialogCutArc::DialogCutArc(const VContainer *data, QWidget *parent)
|
||||
: DialogTool(data, parent), ui(new Ui::DialogCutArc), pointName(QString()), formula(QString()), arcId(0),
|
||||
formulaBaseHeight(0)
|
||||
formulaBaseHeight(ui->plainTextEditFormula->height())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
labelResultCalculation = ui->labelResultCalculation;
|
||||
plainTextEditFormula = ui->plainTextEditFormula;
|
||||
labelEditFormula = ui->labelEditFormula;
|
||||
InitFormulaUI(ui);
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
flagFormula = false;
|
||||
flagName = false;
|
||||
CheckState();
|
||||
this->formulaBaseHeight=ui->plainTextEditFormula->height();
|
||||
|
||||
FillComboBoxArcs(ui->comboBoxArc);
|
||||
|
||||
|
|
|
@ -40,22 +40,18 @@
|
|||
*/
|
||||
DialogCutSpline::DialogCutSpline(const VContainer *data, QWidget *parent)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogCutSpline), pointName(QString()), formula(QString()), splineId(0),
|
||||
formulaBaseHeight(0)
|
||||
formulaBaseHeight(ui->plainTextEditFormula->height())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
labelResultCalculation = ui->labelResultCalculation;
|
||||
plainTextEditFormula = ui->plainTextEditFormula;
|
||||
labelEditFormula = ui->labelEditFormula;
|
||||
InitFormulaUI(ui);
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
InitOkCancel(ui);
|
||||
|
||||
InitOkCancel(ui);
|
||||
flagFormula = false;
|
||||
flagName = false;
|
||||
CheckState();
|
||||
|
||||
this->formulaBaseHeight=ui->plainTextEditFormula->height();
|
||||
|
||||
FillComboBoxSplines(ui->comboBoxSpline);
|
||||
|
||||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSpline::PutHere);
|
||||
|
|
|
@ -40,20 +40,17 @@
|
|||
*/
|
||||
DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, QWidget *parent)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogCutSplinePath), pointName(QString()), formula(QString()),
|
||||
splinePathId(0), formulaBaseHeight(0)
|
||||
splinePathId(0), formulaBaseHeight(ui->plainTextEditFormula->height())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
labelResultCalculation = ui->labelResultCalculation;
|
||||
plainTextEditFormula = ui->plainTextEditFormula;
|
||||
labelEditFormula = ui->labelEditFormula;
|
||||
InitFormulaUI(ui);
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
|
||||
InitOkCancel(ui);
|
||||
flagFormula = false;
|
||||
flagName = false;
|
||||
CheckState();
|
||||
this->formulaBaseHeight=ui->plainTextEditFormula->height();
|
||||
|
||||
FillComboBoxSplinesPath(ui->comboBoxSplinePath);
|
||||
|
||||
|
|
|
@ -31,20 +31,17 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, QWidget *parent)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogEditWrongFormula), formula(QString()), formulaBaseHeight(0)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogEditWrongFormula), formula(QString()),
|
||||
formulaBaseHeight(ui->plainTextEditFormula->height())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
labelResultCalculation = ui->labelResult;
|
||||
plainTextEditFormula = ui->plainTextEditFormula;
|
||||
labelEditFormula = ui->labelFormula;
|
||||
InitFormulaUI(ui);
|
||||
|
||||
InitOkCancel(ui);
|
||||
flagFormula = false;
|
||||
CheckState();
|
||||
|
||||
this->formulaBaseHeight=ui->plainTextEditFormula->height();
|
||||
|
||||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogEditWrongFormula::PutHere);
|
||||
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogEditWrongFormula::PutVal);
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelFormula">
|
||||
<widget class="QLabel" name="labelEditFormula">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -88,7 +88,7 @@
|
|||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../share/resources/icon.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/icon/24x24/putHereLeft.png</normaloff>:/icon/24x24/putHereLeft.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
|
@ -120,7 +120,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelResult">
|
||||
<widget class="QLabel" name="labelResultCalculation">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
|
|
|
@ -40,17 +40,13 @@
|
|||
*/
|
||||
DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()), formula(QString()),
|
||||
angle(0), basePointId(0), formulaBaseHeight(0)
|
||||
angle(0), basePointId(0), formulaBaseHeight(ui->plainTextEditFormula->height())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
labelResultCalculation = ui->labelResultCalculation;
|
||||
plainTextEditFormula = ui->plainTextEditFormula;
|
||||
labelEditFormula = ui->labelEditFormula;
|
||||
InitFormulaUI(ui);
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
|
||||
this->formulaBaseHeight=ui->plainTextEditFormula->height();
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
flagFormula = false;
|
||||
flagName = false;
|
||||
|
|
|
@ -37,18 +37,15 @@
|
|||
*/
|
||||
DialogNormal::DialogNormal(const VContainer *data, QWidget *parent)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()), typeLine(QString()),
|
||||
formula(QString()), angle(0), firstPointId(0), secondPointId(0), formulaBaseHeight(0)
|
||||
formula(QString()), angle(0), firstPointId(0), secondPointId(0),
|
||||
formulaBaseHeight(ui->plainTextEditFormula->height())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
labelResultCalculation = ui->labelResultCalculation;
|
||||
plainTextEditFormula = ui->plainTextEditFormula;
|
||||
labelEditFormula = ui->labelEditFormula;
|
||||
InitFormulaUI(ui);
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
|
||||
this->formulaBaseHeight=ui->plainTextEditFormula->height();
|
||||
|
||||
flagFormula = false;
|
||||
flagName = false;
|
||||
CheckState();
|
||||
|
|
|
@ -39,40 +39,21 @@
|
|||
*/
|
||||
DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *parent)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogPointOfContact), number(0), pointName(QString()), radius(QString()),
|
||||
center(0), firstPoint(0), secondPoint(0), formulaBaseHeight(0)
|
||||
center(0), firstPoint(0), secondPoint(0), formulaBaseHeight(ui->plainTextEditFormula->height())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
listWidget = ui->listWidget;
|
||||
labelResultCalculation = ui->labelResultCalculation;
|
||||
labelDescription = ui->labelDescription;
|
||||
radioButtonSizeGrowth = ui->radioButtonSizeGrowth;
|
||||
radioButtonStandardTable = ui->radioButtonStandardTable;
|
||||
radioButtonIncrements = ui->radioButtonIncrements;
|
||||
radioButtonLengthLine = ui->radioButtonLengthLine;
|
||||
radioButtonLengthArc = ui->radioButtonLengthArc;
|
||||
radioButtonLengthCurve = ui->radioButtonLengthSpline;
|
||||
plainTextEditFormula = ui->plainTextEditFormula;
|
||||
labelEditFormula = ui->labelEditFormula;
|
||||
InitFormulaUI(ui);
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
|
||||
this->formulaBaseHeight=ui->plainTextEditFormula->height();
|
||||
InitOkCancelApply(ui);
|
||||
|
||||
/* bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
|
||||
SCASSERT(bOk != nullptr);
|
||||
connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted);
|
||||
QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel);
|
||||
SCASSERT(bCansel != nullptr);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
|
||||
*/
|
||||
flagFormula = false;
|
||||
flagName = false;
|
||||
CheckState();
|
||||
|
||||
FillComboBoxPoints(ui->comboBoxCenter);
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
FillComboBoxPoints(ui->comboBoxCenter);
|
||||
|
||||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogPointOfContact::PutHere);
|
||||
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogPointOfContact::PutVal);
|
||||
|
|
|
@ -44,6 +44,7 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, QWi
|
|||
{
|
||||
ui->setupUi(this);
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
|
||||
InitOkCancel(ui);
|
||||
flagName = false;
|
||||
CheckState();
|
||||
|
|
|
@ -40,19 +40,15 @@
|
|||
*/
|
||||
DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogShoulderPoint), number(0), pointName(QString()),
|
||||
typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0), formulaBaseHeight(0)
|
||||
typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0),
|
||||
formulaBaseHeight(ui->plainTextEditFormula->height())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
number = 0;
|
||||
InitVariables(ui);
|
||||
labelResultCalculation = ui->labelResultCalculation;
|
||||
plainTextEditFormula = ui->plainTextEditFormula;
|
||||
labelEditFormula = ui->labelEditFormula;
|
||||
InitFormulaUI(ui);
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
|
||||
this->formulaBaseHeight=ui->plainTextEditFormula->height();
|
||||
|
||||
flagFormula = false;
|
||||
flagName = false;
|
||||
CheckState();
|
||||
|
|
|
@ -276,6 +276,17 @@ protected:
|
|||
SCASSERT(bCancel != nullptr);
|
||||
connect(bCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
|
||||
}
|
||||
template <typename T>
|
||||
/**
|
||||
* @brief InitFormulaUI initialise ui object for formula fild
|
||||
* @param ui Dialog container
|
||||
*/
|
||||
void InitFormulaUI(T *ui)
|
||||
{
|
||||
labelResultCalculation = ui->labelResultCalculation;
|
||||
plainTextEditFormula = ui->plainTextEditFormula;
|
||||
labelEditFormula = ui->labelEditFormula;
|
||||
}
|
||||
/**
|
||||
* @brief associatedTool vdrawtool associated with opened dialog.
|
||||
*/
|
||||
|
|
|
@ -43,6 +43,7 @@ DialogTriangle::DialogTriangle(const VContainer *data, QWidget *parent)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
|
||||
InitOkCancel(ui);
|
||||
flagName = false;
|
||||
CheckState();
|
||||
|
|
Loading…
Reference in New Issue
Block a user