Refactoring.

--HG--
branch : feature
This commit is contained in:
dismine 2014-03-06 15:28:46 +02:00
parent 9b78d1a0ab
commit eba24ec34b
23 changed files with 115 additions and 274 deletions

View File

@ -36,44 +36,27 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, QWidget *parent)
typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0) typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0)
{ {
ui->setupUi(this); ui->setupUi(this);
listWidget = ui->listWidget;
labelResultCalculation = ui->labelResultCalculation; labelResultCalculation = ui->labelResultCalculation;
labelDescription = ui->labelDescription;
radioButtonSizeGrowth = ui->radioButtonSizeGrowth;
radioButtonStandardTable = ui->radioButtonStandardTable;
radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
lineEditFormula = ui->lineEditFormula; lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula; labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint;
flagFormula = false; flagFormula = false;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogAlongLine::DialogAccepted);
flagName = false; flagName = false;
CheckState(); CheckState();
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); InitOkCansel(ui);
connect(bCansel, &QPushButton::clicked, this, &DialogAlongLine::DialogRejected);
FillComboBoxTypeLine(ui->comboBoxLineType); FillComboBoxTypeLine(ui->comboBoxLineType);
ui->comboBoxLineType->setCurrentIndex(0); ui->comboBoxLineType->setCurrentIndex(0);
FillComboBoxPoints(ui->comboBoxFirstPoint); FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint); FillComboBoxPoints(ui->comboBoxSecondPoint);
labelEditNamePoint = ui->labelEditNamePoint;
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogAlongLine::PutHere); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogAlongLine::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogAlongLine::PutVal);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogAlongLine::ValChenged);
ShowVariable(data->DataBase());
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogAlongLine::SizeGrowth);
connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogAlongLine::StandardTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogAlongLine::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogAlongLine::LengthLines);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogAlongLine::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogAlongLine::LengthCurves);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogAlongLine::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogAlongLine::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogAlongLine::NamePointChanged);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogAlongLine::EvalFormula);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogAlongLine::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogAlongLine::FormulaChanged);
InitVariables(ui);
connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogTool::PutVal);
} }
DialogAlongLine::~DialogAlongLine() DialogAlongLine::~DialogAlongLine()

View File

@ -47,38 +47,17 @@ DialogArc::DialogArc(const VContainer *data, QWidget *parent)
timerF2 = new QTimer(this); timerF2 = new QTimer(this);
connect(timerF2, &QTimer::timeout, this, &DialogArc::EvalF2); connect(timerF2, &QTimer::timeout, this, &DialogArc::EvalF2);
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); InitOkCansel(ui);
connect(bOk, &QPushButton::clicked, this, &DialogArc::DialogAccepted);
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogArc::DialogRejected);
FillComboBoxPoints(ui->comboBoxBasePoint); FillComboBoxPoints(ui->comboBoxBasePoint);
CheckState(); CheckState();
listWidget = ui->listWidget; InitVariables(ui);
labelDescription = ui->labelDescription;
radioButtonSizeGrowth = ui->radioButtonSizeGrowth;
radioButtonStandardTable = ui->radioButtonStandardTable;
radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
connect(ui->toolButtonPutHereRadius, &QPushButton::clicked, this, &DialogArc::PutRadius); connect(ui->toolButtonPutHereRadius, &QPushButton::clicked, this, &DialogArc::PutRadius);
connect(ui->toolButtonPutHereF1, &QPushButton::clicked, this, &DialogArc::PutF1); connect(ui->toolButtonPutHereF1, &QPushButton::clicked, this, &DialogArc::PutF1);
connect(ui->toolButtonPutHereF2, &QPushButton::clicked, this, &DialogArc::PutF2); connect(ui->toolButtonPutHereF2, &QPushButton::clicked, this, &DialogArc::PutF2);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
ShowVariable(data->DataBase());
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogArc::SizeGrowth);
connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogArc::StandardTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogArc::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogArc::LengthLines);
connect(ui->radioButtonLineAngles, &QRadioButton::clicked, this, &DialogArc::LineAngles);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogArc::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogArc::LengthCurves);
connect(ui->toolButtonEqualRadius, &QPushButton::clicked, this, &DialogArc::EvalRadius); connect(ui->toolButtonEqualRadius, &QPushButton::clicked, this, &DialogArc::EvalRadius);
connect(ui->toolButtonEqualF1, &QPushButton::clicked, this, &DialogArc::EvalF1); connect(ui->toolButtonEqualF1, &QPushButton::clicked, this, &DialogArc::EvalF1);

View File

@ -36,25 +36,15 @@ DialogBisector::DialogBisector(const VContainer *data, QWidget *parent)
typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0) typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0)
{ {
ui->setupUi(this); ui->setupUi(this);
listWidget = ui->listWidget; InitVariables(ui);
labelResultCalculation = ui->labelResultCalculation; labelResultCalculation = ui->labelResultCalculation;
labelDescription = ui->labelDescription;
radioButtonSizeGrowth = ui->radioButtonSizeGrowth;
radioButtonStandardTable = ui->radioButtonStandardTable;
radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
lineEditFormula = ui->lineEditFormula; lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula; labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint; labelEditNamePoint = ui->labelEditNamePoint;
InitOkCansel(ui);
flagFormula = false; flagFormula = false;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogBisector::DialogAccepted);
flagName = false; flagName = false;
CheckState(); CheckState();
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogBisector::DialogRejected);
FillComboBoxPoints(ui->comboBoxFirstPoint); FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint); FillComboBoxPoints(ui->comboBoxSecondPoint);
@ -62,16 +52,8 @@ DialogBisector::DialogBisector(const VContainer *data, QWidget *parent)
FillComboBoxTypeLine(ui->comboBoxLineType); FillComboBoxTypeLine(ui->comboBoxLineType);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogBisector::PutHere); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogBisector::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogBisector::PutVal); connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogBisector::PutVal);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogBisector::ValChenged);
ShowVariable(data->DataBase());
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogBisector::SizeGrowth);
connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogBisector::StandardTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogBisector::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogBisector::LengthLines);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogBisector::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogBisector::LengthCurves);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogBisector::EvalFormula); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogBisector::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogBisector::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogBisector::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogBisector::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogBisector::FormulaChanged);

View File

@ -33,39 +33,22 @@ DialogCutArc::DialogCutArc(const VContainer *data, QWidget *parent) :
DialogTool(data, parent), ui(new Ui::DialogCutArc), pointName(QString()), formula(QString()), arcId(0) DialogTool(data, parent), ui(new Ui::DialogCutArc), pointName(QString()), formula(QString()), arcId(0)
{ {
ui->setupUi(this); ui->setupUi(this);
listWidget = ui->listWidget; InitVariables(ui);
labelResultCalculation = ui->labelResultCalculation; labelResultCalculation = ui->labelResultCalculation;
labelDescription = ui->labelDescription;
radioButtonSizeGrowth = ui->radioButtonSizeGrowth;
radioButtonStandardTable = ui->radioButtonStandardTable;
radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
lineEditFormula = ui->lineEditFormula; lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula; labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint; labelEditNamePoint = ui->labelEditNamePoint;
InitOkCansel(ui);
flagFormula = false; flagFormula = false;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogCutArc::DialogAccepted);
flagName = false; flagName = false;
CheckState(); CheckState();
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogCutArc::DialogRejected);
FillComboBoxArcs(ui->comboBoxArc); FillComboBoxArcs(ui->comboBoxArc);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutArc::PutHere); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutArc::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutArc::PutVal); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutArc::PutVal);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogCutArc::ValChenged);
ShowVariable(data->DataBase());
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogCutArc::SizeGrowth);
connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogCutArc::StandardTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogCutArc::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogCutArc::LengthLines);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogCutArc::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogCutArc::LengthCurves);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogCutArc::EvalFormula); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogCutArc::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutArc::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutArc::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutArc::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutArc::FormulaChanged);

View File

@ -33,39 +33,21 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogCutSpline), pointName(QString()), formula(QString()), splineId(0) :DialogTool(data, parent), ui(new Ui::DialogCutSpline), pointName(QString()), formula(QString()), splineId(0)
{ {
ui->setupUi(this); ui->setupUi(this);
listWidget = ui->listWidget; InitVariables(ui);
labelResultCalculation = ui->labelResultCalculation; labelResultCalculation = ui->labelResultCalculation;
labelDescription = ui->labelDescription;
radioButtonSizeGrowth = ui->radioButtonSizeGrowth;
radioButtonStandardTable = ui->radioButtonStandardTable;
radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
lineEditFormula = ui->lineEditFormula; lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula; labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint; labelEditNamePoint = ui->labelEditNamePoint;
InitOkCansel(ui);
flagFormula = false; flagFormula = false;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogCutSpline::DialogAccepted);
flagName = false; flagName = false;
CheckState(); CheckState();
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogCutSpline::DialogRejected);
FillComboBoxSplines(ui->comboBoxSpline); FillComboBoxSplines(ui->comboBoxSpline);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSpline::PutHere); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSpline::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSpline::PutVal); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSpline::PutVal);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogCutSpline::ValChenged);
ShowVariable(data->DataBase());
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogCutSpline::SizeGrowth);
connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogCutSpline::StandardTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogCutSpline::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogCutSpline::LengthLines);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogCutSpline::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogCutSpline::LengthCurves);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogCutSpline::EvalFormula); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogCutSpline::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSpline::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSpline::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutSpline::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutSpline::FormulaChanged);

View File

@ -34,39 +34,21 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, QWidget *parent
splinePathId(0) splinePathId(0)
{ {
ui->setupUi(this); ui->setupUi(this);
listWidget = ui->listWidget; InitVariables(ui);
labelResultCalculation = ui->labelResultCalculation; labelResultCalculation = ui->labelResultCalculation;
labelDescription = ui->labelDescription;
radioButtonSizeGrowth = ui->radioButtonSizeGrowth;
radioButtonStandardTable = ui->radioButtonStandardTable;
radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
lineEditFormula = ui->lineEditFormula; lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula; labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint; labelEditNamePoint = ui->labelEditNamePoint;
InitOkCansel(ui);
flagFormula = false; flagFormula = false;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogCutSplinePath::DialogAccepted);
flagName = false; flagName = false;
CheckState(); CheckState();
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogCutSplinePath::DialogRejected);
FillComboBoxSplinesPath(ui->comboBoxSplinePath); FillComboBoxSplinesPath(ui->comboBoxSplinePath);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSplinePath::PutHere); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSplinePath::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSplinePath::PutVal); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSplinePath::PutVal);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogCutSplinePath::ValChenged);
ShowVariable(data->DataBase());
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogCutSplinePath::SizeGrowth);
connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogCutSplinePath::StandardTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogCutSplinePath::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogCutSplinePath::LengthLines);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogCutSplinePath::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogCutSplinePath::LengthCurves);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogCutSplinePath::EvalFormula); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogCutSplinePath::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSplinePath::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSplinePath::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutSplinePath::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutSplinePath::FormulaChanged);

View File

@ -36,8 +36,13 @@ DialogDetail::DialogDetail(const VContainer *data, QWidget *parent)
{ {
ui.setupUi(this); ui.setupUi(this);
labelEditNamePoint = ui.labelEditNameDetail; labelEditNamePoint = ui.labelEditNameDetail;
bOk = ui.buttonBox->button(QDialogButtonBox::Ok); bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogDetail::DialogAccepted); Q_CHECK_PTR(bOk);
connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted);
QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel);
Q_CHECK_PTR(bCansel);
connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
flagName = true;//We have default name of detail. flagName = true;//We have default name of detail.
QPalette palette = labelEditNamePoint->palette(); QPalette palette = labelEditNamePoint->palette();
@ -45,9 +50,6 @@ DialogDetail::DialogDetail(const VContainer *data, QWidget *parent)
labelEditNamePoint->setPalette(palette); labelEditNamePoint->setPalette(palette);
CheckState(); CheckState();
QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogDetail::DialogRejected);
connect(ui.listWidget, &QListWidget::currentRowChanged, this, &DialogDetail::ObjectChanged); connect(ui.listWidget, &QListWidget::currentRowChanged, this, &DialogDetail::ObjectChanged);
connect(ui.spinBoxBiasX, static_cast<void (QSpinBox::*)(qint32)>(&QSpinBox::valueChanged), connect(ui.spinBoxBiasX, static_cast<void (QSpinBox::*)(qint32)>(&QSpinBox::valueChanged),
this, &DialogDetail::BiasXChanged); this, &DialogDetail::BiasXChanged);

View File

@ -36,43 +36,24 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent)
formula(QString()), angle(0), basePointId(0) formula(QString()), angle(0), basePointId(0)
{ {
ui->setupUi(this); ui->setupUi(this);
listWidget = ui->listWidget; InitVariables(ui);
labelResultCalculation = ui->labelResultCalculation; labelResultCalculation = ui->labelResultCalculation;
labelDescription = ui->labelDescription;
radioButtonSizeGrowth = ui->radioButtonSizeGrowth;
radioButtonStandardTable = ui->radioButtonStandardTable;
radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
lineEditFormula = ui->lineEditFormula; lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula; labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint; labelEditNamePoint = ui->labelEditNamePoint;
InitOkCansel(ui);
flagFormula = false; flagFormula = false;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogEndLine::DialogAccepted);
flagName = false; flagName = false;
CheckState(); CheckState();
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogEndLine::DialogRejected);
FillComboBoxPoints(ui->comboBoxBasePoint); FillComboBoxPoints(ui->comboBoxBasePoint);
FillComboBoxTypeLine(ui->comboBoxLineType); FillComboBoxTypeLine(ui->comboBoxLineType);
InitArrow(ui); InitArrow(ui);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogEndLine::PutHere); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogEndLine::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogEndLine::PutVal); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogEndLine::PutVal);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogEndLine::ValChenged);
ShowVariable(data->DataBase());
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogEndLine::SizeGrowth);
connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogEndLine::StandardTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogEndLine::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogEndLine::LengthLines);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogEndLine::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogEndLine::LengthCurves);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogEndLine::EvalFormula); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogEndLine::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogEndLine::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogEndLine::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogEndLine::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogEndLine::FormulaChanged);

View File

@ -37,12 +37,9 @@ DialogHeight::DialogHeight(const VContainer *data, QWidget *parent)
{ {
ui->setupUi(this); ui->setupUi(this);
labelEditNamePoint = ui->labelEditNamePoint; labelEditNamePoint = ui->labelEditNamePoint;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); InitOkCansel(ui);
connect(bOk, &QPushButton::clicked, this, &DialogHeight::DialogAccepted);
flagName = false; flagName = false;
CheckState(); CheckState();
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogHeight::DialogRejected);
FillComboBoxPoints(ui->comboBoxBasePoint); FillComboBoxPoints(ui->comboBoxBasePoint);
FillComboBoxPoints(ui->comboBoxP1Line); FillComboBoxPoints(ui->comboBoxP1Line);

View File

@ -35,10 +35,7 @@ DialogLine::DialogLine(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0), typeLine(QString()) :DialogTool(data, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0), typeLine(QString())
{ {
ui->setupUi(this); ui->setupUi(this);
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); InitOkCansel(ui);
connect(bOk, &QPushButton::clicked, this, &DialogLine::DialogAccepted);
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogLine::DialogRejected);
FillComboBoxPoints(ui->comboBoxFirstPoint); FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint); FillComboBoxPoints(ui->comboBoxSecondPoint);

View File

@ -37,12 +37,9 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, QWidget *parent
{ {
ui->setupUi(this); ui->setupUi(this);
number = 0; number = 0;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); InitOkCansel(ui);
connect(bOk, &QPushButton::clicked, this, &DialogLineIntersect::DialogAccepted);
labelEditNamePoint = ui->labelEditNamePoint; labelEditNamePoint = ui->labelEditNamePoint;
flagName = false; flagName = false;
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogLineIntersect::DialogRejected);
FillComboBoxPoints(ui->comboBoxP1Line1); FillComboBoxPoints(ui->comboBoxP1Line1);
FillComboBoxPoints(ui->comboBoxP2Line1); FillComboBoxPoints(ui->comboBoxP2Line1);

View File

@ -36,25 +36,16 @@ DialogNormal::DialogNormal(const VContainer *data, QWidget *parent)
typeLine(QString()), formula(QString()), angle(0), firstPointId(0), secondPointId(0) typeLine(QString()), formula(QString()), angle(0), firstPointId(0), secondPointId(0)
{ {
ui->setupUi(this); ui->setupUi(this);
listWidget = ui->listWidget; InitVariables(ui);
labelResultCalculation = ui->labelResultCalculation; labelResultCalculation = ui->labelResultCalculation;
labelDescription = ui->labelDescription;
radioButtonSizeGrowth = ui->radioButtonSizeGrowth;
radioButtonStandardTable = ui->radioButtonStandardTable;
radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
lineEditFormula = ui->lineEditFormula; lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula; labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint; labelEditNamePoint = ui->labelEditNamePoint;
InitOkCansel(ui);
flagFormula = false; flagFormula = false;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogNormal::DialogAccepted);
flagName = false; flagName = false;
CheckState(); CheckState();
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogNormal::DialogRejected);
FillComboBoxPoints(ui->comboBoxFirstPoint); FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint); FillComboBoxPoints(ui->comboBoxSecondPoint);
@ -64,15 +55,6 @@ DialogNormal::DialogNormal(const VContainer *data, QWidget *parent)
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogNormal::PutHere); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogNormal::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogNormal::PutVal); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogNormal::PutVal);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogNormal::ValChenged);
ShowVariable(data->DataBase());
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogNormal::SizeGrowth);
connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogNormal::StandardTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogNormal::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogNormal::LengthLines);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogNormal::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogNormal::LengthCurves);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogNormal::EvalFormula); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogNormal::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogNormal::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogNormal::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogNormal::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogNormal::FormulaChanged);

View File

@ -47,13 +47,17 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *pare
lineEditFormula = ui.lineEditFormula; lineEditFormula = ui.lineEditFormula;
labelEditFormula = ui.labelEditFormula; labelEditFormula = ui.labelEditFormula;
labelEditNamePoint = ui.labelEditNamePoint; labelEditNamePoint = ui.labelEditNamePoint;
flagFormula = false;
bOk = ui.buttonBox->button(QDialogButtonBox::Ok); bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogPointOfContact::DialogAccepted); Q_CHECK_PTR(bOk);
connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted);
QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel);
Q_CHECK_PTR(bCansel);
connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
flagFormula = false;
flagName = false; flagName = false;
CheckState(); CheckState();
QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogPointOfContact::DialogRejected);
FillComboBoxPoints(ui.comboBoxCenter); FillComboBoxPoints(ui.comboBoxCenter);
FillComboBoxPoints(ui.comboBoxFirstPoint); FillComboBoxPoints(ui.comboBoxFirstPoint);

View File

@ -37,12 +37,9 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, QWi
{ {
ui->setupUi(this); ui->setupUi(this);
labelEditNamePoint = ui->labelEditNamePoint; labelEditNamePoint = ui->labelEditNamePoint;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); InitOkCansel(ui);
connect(bOk, &QPushButton::clicked, this, &DialogPointOfIntersection::DialogAccepted);
flagName = false; flagName = false;
CheckState(); CheckState();
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogPointOfIntersection::DialogRejected);
FillComboBoxPoints(ui->comboBoxFirstPoint); FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint); FillComboBoxPoints(ui->comboBoxSecondPoint);

View File

@ -37,42 +37,24 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent
{ {
ui->setupUi(this); ui->setupUi(this);
number = 0; number = 0;
listWidget = ui->listWidget; InitVariables(ui);
labelResultCalculation = ui->labelResultCalculation; labelResultCalculation = ui->labelResultCalculation;
labelDescription = ui->labelDescription;
radioButtonSizeGrowth = ui->radioButtonSizeGrowth;
radioButtonStandardTable = ui->radioButtonStandardTable;
radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
lineEditFormula = ui->lineEditFormula; lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula; labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint; labelEditNamePoint = ui->labelEditNamePoint;
InitOkCansel(ui);
flagFormula = false; flagFormula = false;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogShoulderPoint::DialogAccepted);
flagName = false; flagName = false;
CheckState(); CheckState();
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogShoulderPoint::DialogRejected);
FillComboBoxTypeLine(ui->comboBoxLineType);
FillComboBoxTypeLine(ui->comboBoxLineType);
FillComboBoxPoints(ui->comboBoxP1Line); FillComboBoxPoints(ui->comboBoxP1Line);
FillComboBoxPoints(ui->comboBoxP2Line); FillComboBoxPoints(ui->comboBoxP2Line);
FillComboBoxPoints(ui->comboBoxPShoulder); FillComboBoxPoints(ui->comboBoxPShoulder);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogShoulderPoint::PutHere); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogShoulderPoint::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogShoulderPoint::PutVal); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogShoulderPoint::PutVal);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogShoulderPoint::ValChenged);
ShowVariable(data->DataBase());
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogShoulderPoint::SizeGrowth);
connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogShoulderPoint::StandardTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogShoulderPoint::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogShoulderPoint::LengthLines);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogShoulderPoint::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogShoulderPoint::LengthCurves);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogShoulderPoint::EvalFormula); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogShoulderPoint::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogShoulderPoint::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogShoulderPoint::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogShoulderPoint::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogShoulderPoint::FormulaChanged);

View File

@ -38,13 +38,12 @@ DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent)
ui->setupUi(this); ui->setupUi(this);
ui->doubleSpinBoxX->setRange(0, toMM(SceneSize)); ui->doubleSpinBoxX->setRange(0, toMM(SceneSize));
ui->doubleSpinBoxY->setRange(0, toMM(SceneSize)); ui->doubleSpinBoxY->setRange(0, toMM(SceneSize));
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
labelEditNamePoint = ui->labelEditName; labelEditNamePoint = ui->labelEditName;
InitOkCansel(ui);
flagName = false; flagName = false;
CheckState(); CheckState();
connect(bOk, &QPushButton::clicked, this, &DialogSinglePoint::DialogAccepted);
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogSinglePoint::DialogRejected);
connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogSinglePoint::NamePointChanged); connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogSinglePoint::NamePointChanged);
} }

View File

@ -36,11 +36,7 @@ DialogSpline::DialogSpline(const VContainer *data, QWidget *parent)
kAsm1(1), kAsm2(1), kCurve(1) kAsm1(1), kAsm2(1), kCurve(1)
{ {
ui->setupUi(this); ui->setupUi(this);
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); InitOkCansel(ui);
connect(bOk, &QPushButton::clicked, this, &DialogSpline::DialogAccepted);
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogSpline::DialogRejected);
FillComboBoxPoints(ui->comboBoxP1); FillComboBoxPoints(ui->comboBoxP1);
FillComboBoxPoints(ui->comboBoxP4); FillComboBoxPoints(ui->comboBoxP4);

View File

@ -36,13 +36,9 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogSplinePath), path(VSplinePath()) :DialogTool(data, parent), ui(new Ui::DialogSplinePath), path(VSplinePath())
{ {
ui->setupUi(this); ui->setupUi(this);
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); InitOkCansel(ui);
connect(bOk, &QPushButton::clicked, this, &DialogSplinePath::DialogAccepted);
bOk->setEnabled(false); bOk->setEnabled(false);
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogSplinePath::DialogRejected);
FillComboBoxPoints(ui->comboBoxPoint); FillComboBoxPoints(ui->comboBoxPoint);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogSplinePath::PointChanged); connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogSplinePath::PointChanged);

View File

@ -35,6 +35,7 @@
#include <QLabel> #include <QLabel>
#include <QListWidgetItem> #include <QListWidgetItem>
#include <QRadioButton> #include <QRadioButton>
#include <QDialogButtonBox>
#include "../../container/vcontainer.h" #include "../../container/vcontainer.h"
namespace ComboMode namespace ComboMode
@ -413,6 +414,39 @@ protected:
connect(ui->toolButtonArrowRightUp, &QPushButton::clicked, this, &DialogTool::ArrowRightUp); connect(ui->toolButtonArrowRightUp, &QPushButton::clicked, this, &DialogTool::ArrowRightUp);
connect(ui->toolButtonArrowRightDown, &QPushButton::clicked, this, &DialogTool::ArrowRightDown); connect(ui->toolButtonArrowRightDown, &QPushButton::clicked, this, &DialogTool::ArrowRightDown);
} }
template <typename T>
void InitVariables(T *ui)
{
listWidget = ui->listWidget;
labelDescription = ui->labelDescription;
radioButtonSizeGrowth = ui->radioButtonSizeGrowth;
radioButtonStandardTable = ui->radioButtonStandardTable;
radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
ShowVariable(data->DataBase());
connect(radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeGrowth);
connect(radioButtonStandardTable, &QRadioButton::clicked, this, &DialogTool::StandardTable);
connect(radioButtonIncrements, &QRadioButton::clicked, this, &DialogTool::Increments);
connect(radioButtonLengthLine, &QRadioButton::clicked, this, &DialogTool::LengthLines);
connect(radioButtonLengthArc, &QRadioButton::clicked, this, &DialogTool::LengthArcs);
connect(radioButtonLengthCurve, &QRadioButton::clicked, this, &DialogTool::LengthCurves);
}
template <typename T>
void InitOkCansel(T *ui)
{
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
Q_CHECK_PTR(bOk);
connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted);
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
Q_CHECK_PTR(bCansel);
connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
}
private: private:
/** /**
* @brief FillList fill combobox list * @brief FillList fill combobox list

View File

@ -37,12 +37,9 @@ DialogTriangle::DialogTriangle(const VContainer *data, QWidget *parent)
{ {
ui->setupUi(this); ui->setupUi(this);
labelEditNamePoint = ui->labelEditNamePoint; labelEditNamePoint = ui->labelEditNamePoint;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); InitOkCansel(ui);
connect(bOk, &QPushButton::clicked, this, &DialogTriangle::DialogAccepted);
flagName = false; flagName = false;
CheckState(); CheckState();
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogTriangle::DialogRejected);
FillComboBoxPoints(ui->comboBoxAxisP1); FillComboBoxPoints(ui->comboBoxAxisP1);
FillComboBoxPoints(ui->comboBoxAxisP2); FillComboBoxPoints(ui->comboBoxAxisP2);

View File

@ -34,10 +34,7 @@ DialogUnionDetails::DialogUnionDetails(const VContainer *data, QWidget *parent)
numberP(0), p1(0), p2(0) numberP(0), p1(0), p2(0)
{ {
ui->setupUi(this); ui->setupUi(this);
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); InitOkCansel(ui);
connect(bOk, &QPushButton::clicked, this, &DialogUnionDetails::DialogAccepted);
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogUnionDetails::DialogRejected);
} }
DialogUnionDetails::~DialogUnionDetails() DialogUnionDetails::~DialogUnionDetails()

View File

@ -488,21 +488,7 @@ void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDeta
{ {
do do
{ {
if (pointsD2 == 0) FindJ(pointsD2, d2, indexD2, j);
{
VNodeDetail node1;
VNodeDetail node2;
d2.NodeOnEdge(indexD2, node1, node2);
ptrdiff_t k = d2.RemoveEdge(indexD2).indexOfNode(node2.getId());
if (k == d2.RemoveEdge(indexD2).CountNode()-1)
{
j = 0;
}
else
{
j = d2.RemoveEdge(indexD2).indexOfNode(node2.getId())+1;
}
}
if (pointsD2 == d2.RemoveEdge(indexD2).CountNode() -2) if (pointsD2 == d2.RemoveEdge(indexD2).CountNode() -2)
{ {
break; break;
@ -546,21 +532,7 @@ void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDeta
{ {
do do
{ {
if (pointsD2 == 0) FindJ(pointsD2, d2, indexD2, j);
{
VNodeDetail node1;
VNodeDetail node2;
d2.NodeOnEdge(indexD2, node1, node2);
ptrdiff_t k = d2.RemoveEdge(indexD2).indexOfNode(node2.getId());
if (k == d2.RemoveEdge(indexD2).CountNode()-1)
{
j = 0;
}
else
{
j = d2.RemoveEdge(indexD2).indexOfNode(node2.getId())+1;
}
}
if (pointsD2 == d2.RemoveEdge(indexD2).CountNode()-2) if (pointsD2 == d2.RemoveEdge(indexD2).CountNode()-2)
{ {
break; break;
@ -587,6 +559,25 @@ void VToolUnionDetails::PointsOnEdge(const VDetail &d, const qint32 &index, VPoi
p2 = VPointF(*data->GeometricObject<const VPointF *>(det2p2.getId())); p2 = VPointF(*data->GeometricObject<const VPointF *>(det2p2.getId()));
} }
void VToolUnionDetails::FindJ(const qint32 &pointsD2, const VDetail &d2, const qint32 &indexD2, qint32 &j)
{
if (pointsD2 == 0)
{
VNodeDetail node1;
VNodeDetail node2;
d2.NodeOnEdge(indexD2, node1, node2);
ptrdiff_t k = d2.RemoveEdge(indexD2).indexOfNode(node2.getId());
if (k == d2.RemoveEdge(indexD2).CountNode()-1)
{
j = 0;
}
else
{
j = d2.RemoveEdge(indexD2).indexOfNode(node2.getId())+1;
}
}
}
QVector<VDetail> VToolUnionDetails::GetDetailFromFile(VPattern *doc, const QDomElement &domElement) QVector<VDetail> VToolUnionDetails::GetDetailFromFile(VPattern *doc, const QDomElement &domElement)
{ {
QVector<VDetail> vector; QVector<VDetail> vector;

View File

@ -85,6 +85,7 @@ public:
VPattern *doc, VContainer *data, const Document::Documents &parse, VPattern *doc, VContainer *data, const Document::Documents &parse,
const Tool::Sources &typeCreation); const Tool::Sources &typeCreation);
static void PointsOnEdge(const VDetail &d, const qint32 &index, VPointF &p1, VPointF &p2, VContainer *data); static void PointsOnEdge(const VDetail &d, const qint32 &index, VPointF &p1, VPointF &p2, VContainer *data);
static void FindJ(const qint32 &pointsD2, const VDetail &d2, const qint32 &indexD2, qint32 &j);
/** /**
* @brief GetDetailFromFile parse detail from file. * @brief GetDetailFromFile parse detail from file.
* @param doc dom document container. * @param doc dom document container.