From 7baefba76911ac30e5eedfcb6adc49d5f576b05a Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 29 Apr 2015 17:57:02 +0300 Subject: [PATCH 01/16] F(x) button for tool "Point at distance and angle". --HG-- branch : feature --- src/app/dialogs/tools/dialogdetail.cpp | 10 - src/app/dialogs/tools/dialogdetail.h | 1 - src/app/dialogs/tools/dialogendline.cpp | 41 +- src/app/dialogs/tools/dialogendline.h | 5 +- src/app/dialogs/tools/dialogendline.ui | 398 ++++++------------ src/app/dialogs/tools/dialogheight.cpp | 9 - src/app/dialogs/tools/dialogheight.h | 1 - src/app/dialogs/tools/dialogline.cpp | 9 - src/app/dialogs/tools/dialogline.h | 1 - src/app/dialogs/tools/dialoglineintersect.cpp | 9 - src/app/dialogs/tools/dialoglineintersect.h | 1 - .../tools/dialogpointofintersection.cpp | 9 - .../dialogs/tools/dialogpointofintersection.h | 1 - src/app/dialogs/tools/dialogsinglepoint.cpp | 9 - src/app/dialogs/tools/dialogsinglepoint.h | 1 - src/app/dialogs/tools/dialogspline.cpp | 9 - src/app/dialogs/tools/dialogspline.h | 1 - src/app/dialogs/tools/dialogsplinepath.cpp | 9 - src/app/dialogs/tools/dialogsplinepath.h | 1 - src/app/dialogs/tools/dialogtool.cpp | 39 -- src/app/dialogs/tools/dialogtool.h | 1 - src/app/dialogs/tools/dialogtriangle.cpp | 9 - src/app/dialogs/tools/dialogtriangle.h | 1 - src/app/dialogs/tools/dialoguniondetails.cpp | 9 - src/app/dialogs/tools/dialoguniondetails.h | 1 - src/app/mainwindow.cpp | 4 - src/app/share/resources/icon.qrc | 1 + src/app/share/resources/icon/24x24/fx.png | Bin 0 -> 742 bytes src/app/tools/drawTools/vabstractspline.cpp | 4 +- src/app/tools/drawTools/vdrawtool.cpp | 2 +- src/app/tools/drawTools/vdrawtool.h | 7 - src/app/tools/drawTools/vtoolheight.cpp | 2 - src/app/tools/drawTools/vtoolline.cpp | 1 - .../tools/drawTools/vtoollineintersect.cpp | 1 - .../drawTools/vtoolpointofintersection.cpp | 1 - src/app/tools/drawTools/vtoolsinglepoint.cpp | 1 - src/app/tools/drawTools/vtooltriangle.cpp | 1 - 37 files changed, 168 insertions(+), 442 deletions(-) create mode 100644 src/app/share/resources/icon/24x24/fx.png diff --git a/src/app/dialogs/tools/dialogdetail.cpp b/src/app/dialogs/tools/dialogdetail.cpp index 3fb553255..5db75df26 100644 --- a/src/app/dialogs/tools/dialogdetail.cpp +++ b/src/app/dialogs/tools/dialogdetail.cpp @@ -423,13 +423,3 @@ void DialogDetail::DeleteItem() ValidObjects(false); } } - - -//--------------------------------------------------------------------------------------------------------------------- -void DialogDetail::UpdateList() -{ - /* - * Does nothing. We redefine this slot because it is only one now way block update list of variable. - * This dialog doesn't work with formula. Don't delete. Help avoid crash. - */ -} diff --git a/src/app/dialogs/tools/dialogdetail.h b/src/app/dialogs/tools/dialogdetail.h index a3718d520..be864d9d2 100644 --- a/src/app/dialogs/tools/dialogdetail.h +++ b/src/app/dialogs/tools/dialogdetail.h @@ -54,7 +54,6 @@ public slots: void ClickedReverse(bool checked); void ObjectChanged(int row); void DeleteItem(); - virtual void UpdateList(); protected: /** * @brief SaveData Put dialog data in local variables diff --git a/src/app/dialogs/tools/dialogendline.cpp b/src/app/dialogs/tools/dialogendline.cpp index 0b04561b4..5bff42f5e 100644 --- a/src/app/dialogs/tools/dialogendline.cpp +++ b/src/app/dialogs/tools/dialogendline.cpp @@ -34,6 +34,7 @@ #include "../../visualization/vistoolendline.h" #include "../../widgets/vmaingraphicsscene.h" #include "../../tools/vabstracttool.h" +#include "dialogeditwrongformula.h" #include //--------------------------------------------------------------------------------------------------------------------- @@ -47,7 +48,6 @@ DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWid formulaLength(QString()), formulaAngle(QString()), formulaBaseHeight(0), formulaBaseHeightAngle(0), line(nullptr) { ui->setupUi(this); - InitVariables(ui); InitFormulaUI(ui); ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel)); labelEditNamePoint = ui->labelEditNamePoint; @@ -65,8 +65,8 @@ DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWid FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics()); FillComboBoxLineColors(ui->comboBoxLineColor); - connect(ui->toolButtonPutHereLength, &QPushButton::clicked, this, &DialogEndLine::PutHere); - connect(ui->toolButtonPutHereAngle, &QPushButton::clicked, this, &DialogEndLine::PutAngle); + connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogEndLine::FXLength); + connect(ui->toolButtonExprAngle, &QPushButton::clicked, this, &DialogEndLine::FXAngle); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogEndLine::NamePointChanged); @@ -81,15 +81,6 @@ DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWid line = new VisToolEndLine(data); } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief PutAngle put variable into formula of angle - */ -void DialogEndLine::PutAngle() -{ - PutValHere(ui->plainTextEditAngle, ui->listWidget); -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief EvalAngle calculate value of angle @@ -127,6 +118,32 @@ void DialogEndLine::DeployAngleTextEdit() DeployFormula(ui->plainTextEditAngle, ui->pushButtonGrowLengthAngle, formulaBaseHeightAngle); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogEndLine::FXAngle() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit angle")); + dialog->SetFormula(GetAngle()); + if (dialog->exec() == QDialog::Accepted) + { + SetAngle(dialog->GetFormula()); + } + delete dialog; +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogEndLine::FXLength() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit length")); + dialog->SetFormula(GetFormula()); + if (dialog->exec() == QDialog::Accepted) + { + SetFormula(dialog->GetFormula()); + } + delete dialog; +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. diff --git a/src/app/dialogs/tools/dialogendline.h b/src/app/dialogs/tools/dialogendline.h index d12a86e23..dfaf7b4c0 100644 --- a/src/app/dialogs/tools/dialogendline.h +++ b/src/app/dialogs/tools/dialogendline.h @@ -76,10 +76,13 @@ public slots: * @brief FormulaTextChanged when formula text changes for validation and calc */ void FormulaTextChanged(); - void PutAngle(); + void EvalAngle(); void AngleTextChanged(); void DeployAngleTextEdit(); + + void FXAngle(); + void FXLength(); protected: virtual void ShowVisualization(); /** diff --git a/src/app/dialogs/tools/dialogendline.ui b/src/app/dialogs/tools/dialogendline.ui index 0b67d0a75..73427619c 100644 --- a/src/app/dialogs/tools/dialogendline.ui +++ b/src/app/dialogs/tools/dialogendline.ui @@ -6,12 +6,12 @@ 0 0 - 417 - 571 + 358 + 323 - + 0 0 @@ -32,7 +32,7 @@ - + 0 0 @@ -84,6 +84,9 @@ Qt::Horizontal + + QSizePolicy::Expanding + 40 @@ -93,13 +96,19 @@ - + + + + 0 + 0 + + ... - :/icon/24x24/putHere.png:/icon/24x24/putHere.png + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -111,6 +120,12 @@ + + + 0 + 0 + + @@ -122,14 +137,14 @@ - + 0 0 - 87 + 60 0 @@ -210,7 +225,7 @@ - + 0 0 @@ -271,13 +286,19 @@ - + + + + 0 + 0 + + ... - :/icon/24x24/putHere.png:/icon/24x24/putHere.png + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -289,6 +310,12 @@ + + + 0 + 0 + + @@ -300,14 +327,14 @@ - + 0 0 - 87 + 60 0 @@ -384,252 +411,102 @@ - - - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - - 0 - 0 - - - - Base point - - - - - - - First point of line - - - - - - - - 0 - 0 - - - - Point label - - - - - - - - - - Type of line - - - - - - - - 80 - 0 - - - - - 110 - 16777215 - - - - Show line from first point to this point - - - - 80 - 14 - - - - - - - - Line color - - - - - - - - - - - - - - Input data - - - - - - - - 0 - 0 - - - - Size and height - - - true - - - - - - - - 0 - 0 - - - - Measurements - - - - - - - - 0 - 0 - - - - Increments - - - - - - - true - - - - 0 - 0 - - - - Length of lines - - - - - - - true - - - - 0 - 0 - - - - Length of arcs - - - - - - - true - - - - 0 - 0 - - - - Length of curves - - - - - - - true - - - - 0 - 0 - - - - Angle of lines - - - - - - + + + QFormLayout::AllNonFixedFieldsGrow + + + + + + 0 + 0 + + + + Base point + + - - - - - - Hide empty measurements - - - true - - - - - - - Variables - - - - + + + + First point of line + + + + + + + + 0 + 0 + + + + Point label + + + + + + + + + + + 0 + 0 + + + + Type of line + + + + + + + + 80 + 0 + + + + + 110 + 16777215 + + + + Show line from first point to this point + + + + 80 + 14 + + + + + + + + + 0 + 0 + + + + Line color + + + + + - - - - - 0 - 0 - - - - Qt::PlainText - - - true - - - @@ -644,23 +521,12 @@ plainTextEditFormula - toolButtonPutHereLength pushButtonGrowLength plainTextEditAngle - toolButtonPutHereAngle pushButtonGrowLengthAngle comboBoxBasePoint lineEditNamePoint comboBoxLineType - radioButtonSizeGrowth - radioButtonStandardTable - radioButtonIncrements - radioButtonLengthLine - radioButtonLengthArc - radioButtonLengthSpline - radioButtonAngleLine - checkBoxHideEmpty - listWidget buttonBox diff --git a/src/app/dialogs/tools/dialogheight.cpp b/src/app/dialogs/tools/dialogheight.cpp index fd704c880..68d26e5df 100644 --- a/src/app/dialogs/tools/dialogheight.cpp +++ b/src/app/dialogs/tools/dialogheight.cpp @@ -249,15 +249,6 @@ void DialogHeight::PointNameChanged() CheckState(); } -//--------------------------------------------------------------------------------------------------------------------- -void DialogHeight::UpdateList() -{ - /* - * Does nothing. We redefine this slot because it is only one now way block update list of variable. - * This dialog doesn't work with formula. Don't delete. Help avoid crash. - */ -} - //--------------------------------------------------------------------------------------------------------------------- void DialogHeight::ShowVisualization() { diff --git a/src/app/dialogs/tools/dialogheight.h b/src/app/dialogs/tools/dialogheight.h index da12d38b1..7f96cfffb 100644 --- a/src/app/dialogs/tools/dialogheight.h +++ b/src/app/dialogs/tools/dialogheight.h @@ -67,7 +67,6 @@ public: public slots: virtual void ChosenObject(quint32 id, const SceneObject &type); virtual void PointNameChanged(); - virtual void UpdateList(); protected: virtual void ShowVisualization(); /** diff --git a/src/app/dialogs/tools/dialogline.cpp b/src/app/dialogs/tools/dialogline.cpp index 7efe52b47..5bf1f6f45 100644 --- a/src/app/dialogs/tools/dialogline.cpp +++ b/src/app/dialogs/tools/dialogline.cpp @@ -140,15 +140,6 @@ void DialogLine::PointNameChanged() CheckState(); } -//--------------------------------------------------------------------------------------------------------------------- -void DialogLine::UpdateList() -{ - /* - * Does nothing. We redefine this slot because it is only one now way block update list of variables. - * This dialog doesn't work with formula. Don't delete. Help avoid crash. - */ -} - //--------------------------------------------------------------------------------------------------------------------- void DialogLine::ShowVisualization() { diff --git a/src/app/dialogs/tools/dialogline.h b/src/app/dialogs/tools/dialogline.h index 7922fdec8..bb07c9b1e 100644 --- a/src/app/dialogs/tools/dialogline.h +++ b/src/app/dialogs/tools/dialogline.h @@ -62,7 +62,6 @@ public: public slots: virtual void ChosenObject(quint32 id, const SceneObject &type); virtual void PointNameChanged(); - virtual void UpdateList(); protected: virtual void ShowVisualization(); /** diff --git a/src/app/dialogs/tools/dialoglineintersect.cpp b/src/app/dialogs/tools/dialoglineintersect.cpp index 4662085cd..1356f8798 100644 --- a/src/app/dialogs/tools/dialoglineintersect.cpp +++ b/src/app/dialogs/tools/dialoglineintersect.cpp @@ -224,15 +224,6 @@ void DialogLineIntersect::PointNameChanged() CheckState(); } -//--------------------------------------------------------------------------------------------------------------------- -void DialogLineIntersect::UpdateList() -{ - /* - * Does nothing. We redefine this slot because it is only one now way block update list of variable. - * This dialog doesn't work with formula. Don't delete. Help avoid crash. - */ -} - //--------------------------------------------------------------------------------------------------------------------- void DialogLineIntersect::ShowVisualization() { diff --git a/src/app/dialogs/tools/dialoglineintersect.h b/src/app/dialogs/tools/dialoglineintersect.h index 5777280cb..deedc9587 100644 --- a/src/app/dialogs/tools/dialoglineintersect.h +++ b/src/app/dialogs/tools/dialoglineintersect.h @@ -65,7 +65,6 @@ public slots: virtual void ChosenObject(quint32 id, const SceneObject &type); void PointChanged(); virtual void PointNameChanged(); - virtual void UpdateList(); protected: virtual void ShowVisualization(); /** diff --git a/src/app/dialogs/tools/dialogpointofintersection.cpp b/src/app/dialogs/tools/dialogpointofintersection.cpp index f45a41a2d..1dce53cbd 100644 --- a/src/app/dialogs/tools/dialogpointofintersection.cpp +++ b/src/app/dialogs/tools/dialogpointofintersection.cpp @@ -156,15 +156,6 @@ void DialogPointOfIntersection::PointNameChanged() CheckState(); } -//--------------------------------------------------------------------------------------------------------------------- -void DialogPointOfIntersection::UpdateList() -{ - /* - * Does nothing. We redefine this slot because it is only one now way block update list of variable. - * This dialog doesn't work with formula. Don't delete. Help avoid crash. - */ -} - //--------------------------------------------------------------------------------------------------------------------- void DialogPointOfIntersection::ShowVisualization() { diff --git a/src/app/dialogs/tools/dialogpointofintersection.h b/src/app/dialogs/tools/dialogpointofintersection.h index b9115c8cc..5b76bab47 100644 --- a/src/app/dialogs/tools/dialogpointofintersection.h +++ b/src/app/dialogs/tools/dialogpointofintersection.h @@ -58,7 +58,6 @@ public: public slots: virtual void ChosenObject(quint32 id, const SceneObject &type); virtual void PointNameChanged(); - virtual void UpdateList(); protected: virtual void ShowVisualization(); /** diff --git a/src/app/dialogs/tools/dialogsinglepoint.cpp b/src/app/dialogs/tools/dialogsinglepoint.cpp index f5fc1ca02..d883bbb0d 100644 --- a/src/app/dialogs/tools/dialogsinglepoint.cpp +++ b/src/app/dialogs/tools/dialogsinglepoint.cpp @@ -77,15 +77,6 @@ void DialogSinglePoint::SaveData() pointName = ui->lineEditName->text(); } -//--------------------------------------------------------------------------------------------------------------------- -void DialogSinglePoint::UpdateList() -{ - /* - * Does nothing. We redefine this slot because it is only one now way block update list of variable. - * This dialog doesn't work with formula. Don't delete. Help avoid crash. - */ -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief setData set name and point diff --git a/src/app/dialogs/tools/dialogsinglepoint.h b/src/app/dialogs/tools/dialogsinglepoint.h index f4bfdb947..c9d8098c1 100644 --- a/src/app/dialogs/tools/dialogsinglepoint.h +++ b/src/app/dialogs/tools/dialogsinglepoint.h @@ -51,7 +51,6 @@ public: public slots: void mousePress(const QPointF &scenePos); - virtual void UpdateList(); protected: /** * @brief SaveData Put dialog data in local variables diff --git a/src/app/dialogs/tools/dialogspline.cpp b/src/app/dialogs/tools/dialogspline.cpp index d5febb89e..bae4cea4c 100644 --- a/src/app/dialogs/tools/dialogspline.cpp +++ b/src/app/dialogs/tools/dialogspline.cpp @@ -180,15 +180,6 @@ void DialogSpline::PointNameChanged() CheckState(); } -//--------------------------------------------------------------------------------------------------------------------- -void DialogSpline::UpdateList() -{ - /* - * Does nothing. We redefine this slot because it is only one now way block update list of variable. - * This dialog doesn't work with formula. Don't delete. Help avoid crash. - */ -} - //--------------------------------------------------------------------------------------------------------------------- void DialogSpline::ShowVisualization() { diff --git a/src/app/dialogs/tools/dialogspline.h b/src/app/dialogs/tools/dialogspline.h index da7e8b790..0c65ee00e 100644 --- a/src/app/dialogs/tools/dialogspline.h +++ b/src/app/dialogs/tools/dialogspline.h @@ -74,7 +74,6 @@ public: public slots: virtual void ChosenObject(quint32 id, const SceneObject &type); virtual void PointNameChanged(); - virtual void UpdateList(); protected: virtual void ShowVisualization(); /** diff --git a/src/app/dialogs/tools/dialogsplinepath.cpp b/src/app/dialogs/tools/dialogsplinepath.cpp index 6cf0c431a..6f7f1954b 100644 --- a/src/app/dialogs/tools/dialogsplinepath.cpp +++ b/src/app/dialogs/tools/dialogsplinepath.cpp @@ -243,15 +243,6 @@ void DialogSplinePath::KAsm2Changed(qreal d) item->setData(Qt::UserRole, QVariant::fromValue(p)); } -//--------------------------------------------------------------------------------------------------------------------- -void DialogSplinePath::UpdateList() -{ - /* - * Does nothing. We redefine this slot because it is only one now way block update list of variable. - * This dialog doesn't work with formula. Don't delete. Help avoid crash. - */ -} - //--------------------------------------------------------------------------------------------------------------------- void DialogSplinePath::ShowDialog(bool click) { diff --git a/src/app/dialogs/tools/dialogsplinepath.h b/src/app/dialogs/tools/dialogsplinepath.h index 8d0b7eebf..2fc167716 100644 --- a/src/app/dialogs/tools/dialogsplinepath.h +++ b/src/app/dialogs/tools/dialogsplinepath.h @@ -62,7 +62,6 @@ public slots: void Angle2Changed( qreal index ); void KAsm1Changed(qreal d); void KAsm2Changed(qreal d); - virtual void UpdateList(); virtual void ShowDialog(bool click); void PathUpdated(const VSplinePath &path); protected: diff --git a/src/app/dialogs/tools/dialogtool.cpp b/src/app/dialogs/tools/dialogtool.cpp index 8c72395a4..d6d3c4b5d 100644 --- a/src/app/dialogs/tools/dialogtool.cpp +++ b/src/app/dialogs/tools/dialogtool.cpp @@ -1083,45 +1083,6 @@ void DialogTool::ValChenged(int row) } } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief UpdateList update lists of variables - */ -void DialogTool::UpdateList() -{ - SCASSERT(radioButtonSizeGrowth != nullptr); - SCASSERT(radioButtonStandardTable != nullptr); - SCASSERT(radioButtonIncrements != nullptr); - SCASSERT(radioButtonLengthLine != nullptr); - SCASSERT(radioButtonLengthArc != nullptr); - SCASSERT(radioButtonLengthCurve != nullptr); - - if (radioButtonSizeGrowth->isChecked()) - { - SizeHeight(); - } - if (radioButtonStandardTable->isChecked()) - { - ShowVariable(data->DataMeasurements()); - } - if (radioButtonIncrements->isChecked()) - { - ShowVariable(data->DataIncrements()); - } - if (radioButtonLengthLine->isChecked()) - { - ShowVariable(data->DataLengthLines()); - } - if (radioButtonLengthArc->isChecked()) - { - ShowVariable(data->DataLengthArcs()); - } - if (radioButtonLengthCurve->isChecked()) - { - ShowVariable(data->DataLengthSplines()); - } -} - //--------------------------------------------------------------------------------------------------------------------- // cppcheck-suppress unusedFunction quint32 DialogTool::GetToolId() const diff --git a/src/app/dialogs/tools/dialogtool.h b/src/app/dialogs/tools/dialogtool.h index e3abb054d..7c56a1858 100644 --- a/src/app/dialogs/tools/dialogtool.h +++ b/src/app/dialogs/tools/dialogtool.h @@ -121,7 +121,6 @@ public slots: void PutHere(); void PutVal(QListWidgetItem * item); virtual void ValChenged(int row); - virtual void UpdateList(); virtual void PointNameChanged(){} protected: Q_DISABLE_COPY(DialogTool) diff --git a/src/app/dialogs/tools/dialogtriangle.cpp b/src/app/dialogs/tools/dialogtriangle.cpp index 7caa7c885..62191096c 100644 --- a/src/app/dialogs/tools/dialogtriangle.cpp +++ b/src/app/dialogs/tools/dialogtriangle.cpp @@ -195,15 +195,6 @@ void DialogTriangle::PointNameChanged() CheckState(); } -//--------------------------------------------------------------------------------------------------------------------- -void DialogTriangle::UpdateList() -{ - /* - * Does nothing. We redefine this slot because it is only one now way block update list of variable. - * This dialog doesn't work with formula. Don't delete. Help avoid crash. - */ -} - //--------------------------------------------------------------------------------------------------------------------- void DialogTriangle::ShowVisualization() { diff --git a/src/app/dialogs/tools/dialogtriangle.h b/src/app/dialogs/tools/dialogtriangle.h index fa541722d..5a76914b4 100644 --- a/src/app/dialogs/tools/dialogtriangle.h +++ b/src/app/dialogs/tools/dialogtriangle.h @@ -64,7 +64,6 @@ public: public slots: virtual void ChosenObject(quint32 id, const SceneObject &type); virtual void PointNameChanged(); - virtual void UpdateList(); protected: virtual void ShowVisualization(); /** diff --git a/src/app/dialogs/tools/dialoguniondetails.cpp b/src/app/dialogs/tools/dialoguniondetails.cpp index b9ad8c05e..12a26c7e1 100644 --- a/src/app/dialogs/tools/dialoguniondetails.cpp +++ b/src/app/dialogs/tools/dialoguniondetails.cpp @@ -69,15 +69,6 @@ void DialogUnionDetails::ChosenObject(quint32 id, const SceneObject &type) } } -//--------------------------------------------------------------------------------------------------------------------- -void DialogUnionDetails::UpdateList() -{ - /* - * Does nothing. We redefine this slot because it is only one now way block update list of variable. - * This dialog doesn't work with formula. Don't delete. Help avoid crash. - */ -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief CheckObject check if detail contain this id diff --git a/src/app/dialogs/tools/dialoguniondetails.h b/src/app/dialogs/tools/dialoguniondetails.h index 9ad563022..5500a72b4 100644 --- a/src/app/dialogs/tools/dialoguniondetails.h +++ b/src/app/dialogs/tools/dialoguniondetails.h @@ -52,7 +52,6 @@ public: int getIndexD2() const; public slots: void ChosenObject(quint32 id, const SceneObject &type); - virtual void UpdateList(); private: Q_DISABLE_COPY(DialogUnionDetails) diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index 00b40e53b..a1d0c0eca 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -318,7 +318,6 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject); connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot); connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip); - connect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogTool::UpdateList); ui->view->itemClicked(nullptr); } else @@ -360,7 +359,6 @@ void MainWindow::SetToolButtonWithApply(bool checked, Tool t, const QString &cur connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot); connect(dialogTool, &DialogTool::DialogApplied, this, applyDialogSlot); connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip); - connect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogTool::UpdateList); connect(ui->view, &VMainGraphicsView::MouseRelease, this, &MainWindow::ClickEndVisualization); ui->view->itemClicked(nullptr); } @@ -685,8 +683,6 @@ void MainWindow::ToolUnionDetails(bool checked) { SetToolButton(checked, Tool::UnionDetails, ":/cursor/union_cursor.png", tr("Select detail"), &MainWindow::ClosedDialogUnionDetails); - //Must disconnect this signal here. - disconnect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogTool::UpdateList); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/share/resources/icon.qrc b/src/app/share/resources/icon.qrc index 439657321..13674f5d0 100644 --- a/src/app/share/resources/icon.qrc +++ b/src/app/share/resources/icon.qrc @@ -56,5 +56,6 @@ icon/16x16/portrait.png icon/16x16/template.png icon/32x32/pdf.png + icon/24x24/fx.png diff --git a/src/app/share/resources/icon/24x24/fx.png b/src/app/share/resources/icon/24x24/fx.png new file mode 100644 index 0000000000000000000000000000000000000000..ffe25095ea051a94608757b9d998a4121afe2685 GIT binary patch literal 742 zcmVq0}BjKISjkVq}fw4oG z&tHx&od;Emu~bsdGRD@y3Cs;3Y9;spmuV7$DTm!E8>q228nKb`#$R zMeK8dQLBS0*g^^7uprA)jNiy+=Wbz8Zr>d_q9{rn9c{B)Edy9}McI5N(gE#LC^H*Bx4Eh6nAI@U&4X9cj zG|@N-B@PM9d|~><>r5;fyoT5D2Em*8n$c)DC`o$8JHh#pC5c2^_lDaq>}qSQ6-BWRolOppKIRFE^!#@T-coxl zPz@3)9_NP_3ALTZ+yZOK8nCuD`&whsPzs*=w%673H9AY7Josh`{t(n}R#Vj$3NC4EWMrBDElX`0KrU()), sceneType(SceneObject::Unknown), isHovered(false), detailsMode(false) -{ - ignoreFullUpdate = true; -} +{} //--------------------------------------------------------------------------------------------------------------------- VAbstractSpline::~VAbstractSpline() diff --git a/src/app/tools/drawTools/vdrawtool.cpp b/src/app/tools/drawTools/vdrawtool.cpp index 14177beba..ad8e2fedd 100644 --- a/src/app/tools/drawTools/vdrawtool.cpp +++ b/src/app/tools/drawTools/vdrawtool.cpp @@ -46,7 +46,7 @@ qreal VDrawTool::factor = 1; * @param id object id in container. */ VDrawTool::VDrawTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent) - :VAbstractTool(doc, data, id, parent), ignoreFullUpdate(false), nameActivDraw(doc->GetNameActivPP()), + :VAbstractTool(doc, data, id, parent), nameActivDraw(doc->GetNameActivPP()), dialog(nullptr), typeLine(TypeLineLine), lineColor(ColorBlack), enabled(true) { connect(this->doc, &VPattern::ChangedActivPP, this, &VDrawTool::ChangedActivDraw); diff --git a/src/app/tools/drawTools/vdrawtool.h b/src/app/tools/drawTools/vdrawtool.h index c4e3d4586..28c64e8d4 100644 --- a/src/app/tools/drawTools/vdrawtool.h +++ b/src/app/tools/drawTools/vdrawtool.h @@ -72,9 +72,6 @@ public slots: virtual void EnableToolMove(bool move); protected: - /** @brief ignoreFullUpdate ignore or not full updates. */ - bool ignoreFullUpdate; - /** @brief nameActivDraw name of tool's pattern peace. */ QString nameActivDraw; @@ -142,10 +139,6 @@ protected: connect(dialog, &DialogTool::DialogClosed, tool, &Tool::FullUpdateFromGuiOk); connect(dialog, &DialogTool::DialogApplied, tool, &Tool::FullUpdateFromGuiApply); - if (ignoreFullUpdate == false) - { - connect(doc, &VPattern::FullUpdateFromFile, dialog, &DialogTool::UpdateList); - } tool->setDialog(); diff --git a/src/app/tools/drawTools/vtoolheight.cpp b/src/app/tools/drawTools/vtoolheight.cpp index 6a452a5d8..c40bbd6f4 100644 --- a/src/app/tools/drawTools/vtoolheight.cpp +++ b/src/app/tools/drawTools/vtoolheight.cpp @@ -52,7 +52,6 @@ VToolHeight::VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, con :VToolLinePoint(doc, data, id, typeLine, lineColor, QString(), basePointId, 0, parent), p1LineId(p1LineId), p2LineId(p2LineId) { - ignoreFullUpdate = true; if (typeCreation == Source::FromGui) { AddToFile(); @@ -95,7 +94,6 @@ VToolHeight* VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, SCASSERT(dialog != nullptr); DialogHeight *dialogTool = qobject_cast(dialog); SCASSERT(dialogTool != nullptr); - disconnect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogHeight::UpdateList); const QString pointName = dialogTool->getPointName(); const QString typeLine = dialogTool->GetTypeLine(); const QString lineColor = dialogTool->GetLineColor(); diff --git a/src/app/tools/drawTools/vtoolline.cpp b/src/app/tools/drawTools/vtoolline.cpp index 1f67a5221..640730468 100644 --- a/src/app/tools/drawTools/vtoolline.cpp +++ b/src/app/tools/drawTools/vtoolline.cpp @@ -54,7 +54,6 @@ VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstP { this->typeLine = typeLine; this->lineColor = lineColor; - ignoreFullUpdate = true; //Line const QSharedPointer first = data->GeometricObject(firstPoint); const QSharedPointer second = data->GeometricObject(secondPoint); diff --git a/src/app/tools/drawTools/vtoollineintersect.cpp b/src/app/tools/drawTools/vtoollineintersect.cpp index fa0358d35..ac3b19a00 100644 --- a/src/app/tools/drawTools/vtoollineintersect.cpp +++ b/src/app/tools/drawTools/vtoollineintersect.cpp @@ -53,7 +53,6 @@ VToolLineIntersect::VToolLineIntersect(VPattern *doc, VContainer *data, const qu :VToolPoint(doc, data, id, parent), p1Line1(p1Line1), p2Line1(p2Line1), p1Line2(p1Line2), p2Line2(p2Line2) { - ignoreFullUpdate = true; if (typeCreation == Source::FromGui) { AddToFile(); diff --git a/src/app/tools/drawTools/vtoolpointofintersection.cpp b/src/app/tools/drawTools/vtoolpointofintersection.cpp index bfc62e0a2..7888c27de 100644 --- a/src/app/tools/drawTools/vtoolpointofintersection.cpp +++ b/src/app/tools/drawTools/vtoolpointofintersection.cpp @@ -49,7 +49,6 @@ VToolPointOfIntersection::VToolPointOfIntersection(VPattern *doc, VContainer *da const Source &typeCreation, QGraphicsItem *parent) :VToolPoint(doc, data, id, parent), firstPointId(firstPointId), secondPointId(secondPointId) { - ignoreFullUpdate = true; if (typeCreation == Source::FromGui) { AddToFile(); diff --git a/src/app/tools/drawTools/vtoolsinglepoint.cpp b/src/app/tools/drawTools/vtoolsinglepoint.cpp index 68e6ddb42..7eb211a7a 100644 --- a/src/app/tools/drawTools/vtoolsinglepoint.cpp +++ b/src/app/tools/drawTools/vtoolsinglepoint.cpp @@ -54,7 +54,6 @@ VToolSinglePoint::VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id, { baseColor = Qt::red; this->setPen(QPen(baseColor, qApp->toPixel(qApp->widthHairLine())/factor)); - ignoreFullUpdate = true; this->setFlag(QGraphicsItem::ItemIsMovable, true); this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); this->setFlag(QGraphicsItem::ItemIsFocusable, false); diff --git a/src/app/tools/drawTools/vtooltriangle.cpp b/src/app/tools/drawTools/vtooltriangle.cpp index 7c940caf3..2b2f7b7b2 100644 --- a/src/app/tools/drawTools/vtooltriangle.cpp +++ b/src/app/tools/drawTools/vtooltriangle.cpp @@ -53,7 +53,6 @@ VToolTriangle::VToolTriangle(VPattern *doc, VContainer *data, const quint32 &id, :VToolPoint(doc, data, id, parent), axisP1Id(axisP1Id), axisP2Id(axisP2Id), firstPointId(firstPointId), secondPointId(secondPointId) { - ignoreFullUpdate = true; if (typeCreation == Source::FromGui) { AddToFile(); From 356f1f2e8545c2a02c34ed87ffce4afa212473ca Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 29 Apr 2015 17:59:43 +0300 Subject: [PATCH 02/16] Updated tooltip. --HG-- branch : feature --- src/app/dialogs/tools/dialogeditwrongformula.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/dialogs/tools/dialogeditwrongformula.ui b/src/app/dialogs/tools/dialogeditwrongformula.ui index 0c84e4d32..f724d9930 100644 --- a/src/app/dialogs/tools/dialogeditwrongformula.ui +++ b/src/app/dialogs/tools/dialogeditwrongformula.ui @@ -349,7 +349,7 @@ - Variables + Double click for add to formula From ce101c10f50969823d1f18dac59d1f6dc8e93f73 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 29 Apr 2015 19:35:38 +0300 Subject: [PATCH 03/16] F(x)button for tool "Point at distance along line". --HG-- branch : feature --- src/app/core/vapplication.cpp | 9 + src/app/dialogs/tools/dialogalongline.cpp | 18 +- src/app/dialogs/tools/dialogalongline.h | 2 + src/app/dialogs/tools/dialogalongline.ui | 353 ++++++---------------- 4 files changed, 121 insertions(+), 261 deletions(-) diff --git a/src/app/core/vapplication.cpp b/src/app/core/vapplication.cpp index 6c93bd068..daaf8c478 100644 --- a/src/app/core/vapplication.cpp +++ b/src/app/core/vapplication.cpp @@ -1803,6 +1803,10 @@ QString VApplication::PostfixOperator(const QString &name) const */ QString VApplication::FormulaFromUser(const QString &formula) { + if (formula.isEmpty()) + { + return formula; + } QString newFormula = formula;// Local copy for making changes Calculator *cal = new Calculator(formula);// Eval formula @@ -1901,6 +1905,11 @@ QString VApplication::FormulaFromUser(const QString &formula) */ QString VApplication::FormulaToUser(const QString &formula) { + if (formula.isEmpty()) + { + return formula; + } + QString newFormula = formula;// Local copy for making changes QMap tokens; diff --git a/src/app/dialogs/tools/dialogalongline.cpp b/src/app/dialogs/tools/dialogalongline.cpp index 54a8dd1dc..9d3cd576d 100644 --- a/src/app/dialogs/tools/dialogalongline.cpp +++ b/src/app/dialogs/tools/dialogalongline.cpp @@ -31,6 +31,7 @@ #include "../../visualization/vistoolalongline.h" #include "../../tools/vabstracttool.h" #include "../../widgets/vmaingraphicsscene.h" +#include "dialogeditwrongformula.h" #include @@ -45,7 +46,6 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, const quint32 &toolId, formula(QString()), formulaBaseHeight(0), line(nullptr) { ui->setupUi(this); - InitVariables(ui); InitFormulaUI(ui); ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel)); labelEditNamePoint = ui->labelEditNamePoint; @@ -62,11 +62,10 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, const quint32 &toolId, FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics()); FillComboBoxLineColors(ui->comboBoxLineColor); - connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogAlongLine::PutHere); + connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogAlongLine::FXLength); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogAlongLine::NamePointChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogAlongLine::FormulaTextChanged); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogAlongLine::DeployFormulaTextEdit); - connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogTool::PutVal); connect(ui->comboBoxFirstPoint, static_cast(&QComboBox::currentIndexChanged), this, &DialogAlongLine::PointChanged); connect(ui->comboBoxSecondPoint, static_cast(&QComboBox::currentIndexChanged), @@ -100,6 +99,19 @@ void DialogAlongLine::PointChanged() CheckState(); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogAlongLine::FXLength() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit length")); + dialog->SetFormula(GetFormula()); + if (dialog->exec() == QDialog::Accepted) + { + SetFormula(dialog->GetFormula()); + } + delete dialog; +} + //--------------------------------------------------------------------------------------------------------------------- void DialogAlongLine::ShowVisualization() { diff --git a/src/app/dialogs/tools/dialogalongline.h b/src/app/dialogs/tools/dialogalongline.h index b82f23350..1ba3605f2 100644 --- a/src/app/dialogs/tools/dialogalongline.h +++ b/src/app/dialogs/tools/dialogalongline.h @@ -75,6 +75,8 @@ public slots: */ void FormulaTextChanged(); void PointChanged(); + + void FXLength(); protected: virtual void ShowVisualization(); /** diff --git a/src/app/dialogs/tools/dialogalongline.ui b/src/app/dialogs/tools/dialogalongline.ui index ee68fb65e..a360a175b 100644 --- a/src/app/dialogs/tools/dialogalongline.ui +++ b/src/app/dialogs/tools/dialogalongline.ui @@ -6,8 +6,8 @@ 0 0 - 428 - 532 + 412 + 284 @@ -87,16 +87,13 @@ - - - Insert variable into the formula - + ... - :/icon/24x24/putHere.png:/icon/24x24/putHere.png + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -165,6 +162,9 @@ true + + + @@ -206,251 +206,98 @@ - - - - - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Point label - - - - - - - First point - - - - - - - First point of line - - - - - - - Second point - - - - - - - Second point of line - - - - - - - Type of line - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - 110 - 16777215 - - - - Show line from first point to this point - - - - 80 - 14 - - - - - - - - Line color - - - - - - - - - - - - - - - Input data - - - - - - - - 0 - 0 - - - - Size and height - - - true - - - - - - - - 0 - 0 - - - - Measurements - - - - - - - - 0 - 0 - - - - Increments - - - - - - - - 0 - 0 - - - - Length of lines - - - - - - - true - - - - 0 - 0 - - - - Length of arcs - - - - - - - true - - - - 0 - 0 - - - - Length of curves - - - - - - - true - - - - 0 - 0 - - - - Angle of lines - - - - - - + + + QFormLayout::AllNonFixedFieldsGrow + + + + + Point label + + - - - - - - Hide empty measurements - - - true - - - - - - - Variables - Click twice to insert into formula - - - - + + + + First point + + + + + + + First point of line + + + + + + + Second point + + + + + + + Second point of line + + + + + + + Type of line + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + + 110 + 16777215 + + + + Show line from first point to this point + + + + 80 + 14 + + + + + + + + Line color + + + + + + + + - - - - - - - true - - - @@ -465,21 +312,11 @@ plainTextEditFormula - toolButtonPutHere pushButtonGrowLength lineEditNamePoint comboBoxFirstPoint comboBoxSecondPoint comboBoxLineType - radioButtonSizeGrowth - radioButtonStandardTable - radioButtonIncrements - radioButtonLengthLine - radioButtonLengthArc - radioButtonLengthSpline - radioButtonAngleLine - checkBoxHideEmpty - listWidget buttonBox From 05ec6811362aa27a93c269f9d975b5b9b38864ec Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 29 Apr 2015 19:47:07 +0300 Subject: [PATCH 04/16] Math function icon in tool property browser. --HG-- branch : feature --- src/app/share/resources/icon.qrc | 1 + src/app/share/resources/icon/16x16/fx.png | Bin 0 -> 352 bytes src/app/widgets/vformulapropertyeditor.cpp | 1 + 3 files changed, 2 insertions(+) create mode 100644 src/app/share/resources/icon/16x16/fx.png diff --git a/src/app/share/resources/icon.qrc b/src/app/share/resources/icon.qrc index 13674f5d0..00a80c9e9 100644 --- a/src/app/share/resources/icon.qrc +++ b/src/app/share/resources/icon.qrc @@ -57,5 +57,6 @@ icon/16x16/template.png icon/32x32/pdf.png icon/24x24/fx.png + icon/16x16/fx.png diff --git a/src/app/share/resources/icon/16x16/fx.png b/src/app/share/resources/icon/16x16/fx.png new file mode 100644 index 0000000000000000000000000000000000000000..3a89f64f72b781fcb6e91414a0e02f5a1241715b GIT binary patch literal 352 zcmV-m0iXVfP)x2 z1fD(I+*qB@8pxYI#E|+etS~rBy~6-{Q%k=n)h=^Z#Dn@JhDWK7@X?2KPH~t|-DXO? zj}t@}m-S_q1>kmW5ND`h1bg-dlPDlSh&3F+VH`1Tam>1vjcWyy$^V=oMG!do)nPRn9DEpo}pD3`KelyJ%t&uXxk%85Et;jStk# yYpNo4iaGy83nhC#hXf1ANcKnN>stHnKk^NY*iYCmPqfbf0000setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); ToolButton->setText("..."); + ToolButton->setIcon(QIcon("://icon/16x16/fx.png")); ToolButton->setFixedWidth(20); ToolButton->installEventFilter(this); setFocusProxy(ToolButton); // Make the ToolButton the focus proxy From 7e4aea059f7e229a26bee58056ccdf8a689867cd Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 29 Apr 2015 20:02:03 +0300 Subject: [PATCH 05/16] Disable cursor-arrow-openhand cursor before delete a item. --HG-- branch : feature --- src/app/tools/drawTools/vtoolsinglepoint.cpp | 7 ++++++ src/app/tools/drawTools/vtoolsinglepoint.h | 1 + src/app/tools/drawTools/vtoolspline.cpp | 5 +++- src/app/tools/drawTools/vtoolsplinepath.cpp | 7 ++++++ src/app/tools/drawTools/vtoolsplinepath.h | 25 ++++++++++--------- src/app/visualization/vcontrolpointspline.cpp | 7 ++++++ src/app/visualization/vcontrolpointspline.h | 1 + .../visualization/vgraphicssimpletextitem.cpp | 7 ++++++ .../visualization/vgraphicssimpletextitem.h | 1 + 9 files changed, 48 insertions(+), 13 deletions(-) diff --git a/src/app/tools/drawTools/vtoolsinglepoint.cpp b/src/app/tools/drawTools/vtoolsinglepoint.cpp index 7eb211a7a..f2885fde1 100644 --- a/src/app/tools/drawTools/vtoolsinglepoint.cpp +++ b/src/app/tools/drawTools/vtoolsinglepoint.cpp @@ -68,6 +68,13 @@ VToolSinglePoint::VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id, } } +//--------------------------------------------------------------------------------------------------------------------- +VToolSinglePoint::~VToolSinglePoint() +{ + //Disable cursor-arrow-openhand + VApplication::restoreOverrideCursor(cursorArrowOpenHand); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief setDialog set dialog when user want change tool option. diff --git a/src/app/tools/drawTools/vtoolsinglepoint.h b/src/app/tools/drawTools/vtoolsinglepoint.h index 3e10d950d..ffc611a00 100644 --- a/src/app/tools/drawTools/vtoolsinglepoint.h +++ b/src/app/tools/drawTools/vtoolsinglepoint.h @@ -41,6 +41,7 @@ class VToolSinglePoint : public VToolPoint public: VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, const QString &namePP, const QString &mPath, QGraphicsItem * parent = nullptr ); + virtual ~VToolSinglePoint(); virtual void setDialog(); static const QString ToolType; virtual int type() const {return Type;} diff --git a/src/app/tools/drawTools/vtoolspline.cpp b/src/app/tools/drawTools/vtoolspline.cpp index 4246da5b1..7579a2935 100644 --- a/src/app/tools/drawTools/vtoolspline.cpp +++ b/src/app/tools/drawTools/vtoolspline.cpp @@ -97,7 +97,10 @@ VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const QStr //--------------------------------------------------------------------------------------------------------------------- VToolSpline::~VToolSpline() -{} +{ + //Disable cursor-arrow-openhand + VApplication::restoreOverrideCursor(cursorArrowOpenHand); +} //--------------------------------------------------------------------------------------------------------------------- /** diff --git a/src/app/tools/drawTools/vtoolsplinepath.cpp b/src/app/tools/drawTools/vtoolsplinepath.cpp index 6a3b0f158..414becdaa 100644 --- a/src/app/tools/drawTools/vtoolsplinepath.cpp +++ b/src/app/tools/drawTools/vtoolsplinepath.cpp @@ -97,6 +97,13 @@ VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, co } } +//--------------------------------------------------------------------------------------------------------------------- +VToolSplinePath::~VToolSplinePath() +{ + //Disable cursor-arrow-openhand + VApplication::restoreOverrideCursor(cursorArrowOpenHand); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief setDialog set dialog when user want change tool option. diff --git a/src/app/tools/drawTools/vtoolsplinepath.h b/src/app/tools/drawTools/vtoolsplinepath.h index 0e057644c..268803eb8 100644 --- a/src/app/tools/drawTools/vtoolsplinepath.h +++ b/src/app/tools/drawTools/vtoolsplinepath.h @@ -40,20 +40,21 @@ class VToolSplinePath:public VAbstractSpline public: VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const QString &color, const Source &typeCreation, QGraphicsItem * parent = nullptr); - virtual void setDialog(); - static VToolSplinePath *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); - static VToolSplinePath *Create(const quint32 _id, VSplinePath *path, const QString &color, - VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse, - const Source &typeCreation); - static const QString ToolType; - static void UpdatePathPoint(VPattern *doc, QDomNode& node, const VSplinePath &path); - virtual int type() const {return Type;} - enum { Type = UserType + static_cast(Tool::SplinePath)}; + virtual ~VToolSplinePath(); + virtual void setDialog(); + static VToolSplinePath *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); + static VToolSplinePath *Create(const quint32 _id, VSplinePath *path, const QString &color, + VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse, + const Source &typeCreation); + static const QString ToolType; + static void UpdatePathPoint(VPattern *doc, QDomNode& node, const VSplinePath &path); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::SplinePath)}; - VSplinePath getSplinePath()const; - void setSplinePath(const VSplinePath &splPath); + VSplinePath getSplinePath()const; + void setSplinePath(const VSplinePath &splPath); - virtual void ShowVisualization(bool show); + virtual void ShowVisualization(bool show); signals: /** * @brief RefreshLine refresh control line. diff --git a/src/app/visualization/vcontrolpointspline.cpp b/src/app/visualization/vcontrolpointspline.cpp index 1842124f6..11cc17cd0 100644 --- a/src/app/visualization/vcontrolpointspline.cpp +++ b/src/app/visualization/vcontrolpointspline.cpp @@ -69,6 +69,13 @@ VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePointP controlLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true); } +//--------------------------------------------------------------------------------------------------------------------- +VControlPointSpline::~VControlPointSpline() +{ + //Disable cursor-arrow-openhand + VApplication::restoreOverrideCursor(cursorArrowOpenHand); +} + //--------------------------------------------------------------------------------------------------------------------- void VControlPointSpline::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { diff --git a/src/app/visualization/vcontrolpointspline.h b/src/app/visualization/vcontrolpointspline.h index cb9b16b05..759965e65 100644 --- a/src/app/visualization/vcontrolpointspline.h +++ b/src/app/visualization/vcontrolpointspline.h @@ -42,6 +42,7 @@ class VControlPointSpline : public QObject, public QGraphicsEllipseItem public: VControlPointSpline(const qint32 &indexSpline, SplinePointPosition position, const QPointF &controlPoint, const QPointF &splinePoint, QGraphicsItem * parent = nullptr); + virtual ~VControlPointSpline(); virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0); virtual int type() const {return Type;} enum { Type = UserType + static_cast(Vis::ControlPointSpline)}; diff --git a/src/app/visualization/vgraphicssimpletextitem.cpp b/src/app/visualization/vgraphicssimpletextitem.cpp index dc8d4d25e..a34a0610a 100644 --- a/src/app/visualization/vgraphicssimpletextitem.cpp +++ b/src/app/visualization/vgraphicssimpletextitem.cpp @@ -70,6 +70,13 @@ VGraphicsSimpleTextItem::VGraphicsSimpleTextItem( const QString & text, QGraphic this->setAcceptHoverEvents(true); } +//--------------------------------------------------------------------------------------------------------------------- +VGraphicsSimpleTextItem::~VGraphicsSimpleTextItem() +{ + //Disable cursor-arrow-openhand + VApplication::restoreOverrideCursor(cursorArrowOpenHand); +} + //--------------------------------------------------------------------------------------------------------------------- void VGraphicsSimpleTextItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { diff --git a/src/app/visualization/vgraphicssimpletextitem.h b/src/app/visualization/vgraphicssimpletextitem.h index 76fd29a07..607413d08 100644 --- a/src/app/visualization/vgraphicssimpletextitem.h +++ b/src/app/visualization/vgraphicssimpletextitem.h @@ -42,6 +42,7 @@ class VGraphicsSimpleTextItem : public QObject, public QGraphicsSimpleTextItem public: VGraphicsSimpleTextItem(QGraphicsItem *parent = nullptr); VGraphicsSimpleTextItem( const QString & text, QGraphicsItem *parent = nullptr ); + virtual ~VGraphicsSimpleTextItem(); qint32 FontSize()const; virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); From 1f3fce60de8a5202a624d441c83a35f67214db87 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 29 Apr 2015 20:32:27 +0300 Subject: [PATCH 06/16] F(x) buttons for tool Arc. --HG-- branch : feature --- src/app/dialogs/tools/dialogarc.cpp | 106 +++++------- src/app/dialogs/tools/dialogarc.h | 10 +- src/app/dialogs/tools/dialogarc.ui | 251 ++++------------------------ 3 files changed, 84 insertions(+), 283 deletions(-) diff --git a/src/app/dialogs/tools/dialogarc.cpp b/src/app/dialogs/tools/dialogarc.cpp index f6deed1fa..e58e11a9b 100644 --- a/src/app/dialogs/tools/dialogarc.cpp +++ b/src/app/dialogs/tools/dialogarc.cpp @@ -36,6 +36,7 @@ #include "../../container/vcontainer.h" #include "../../libs/ifc/xml/vdomdocument.h" #include "../../visualization/vistoolarc.h" +#include "dialogeditwrongformula.h" //--------------------------------------------------------------------------------------------------------------------- /** @@ -51,8 +52,6 @@ DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *par { ui->setupUi(this); - InitVariables(ui); - plainTextEditFormula = ui->plainTextEditFormula; this->formulaBaseHeight = ui->plainTextEditFormula->height(); this->formulaBaseHeightF1 = ui->plainTextEditF1->height(); @@ -78,9 +77,9 @@ DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *par CheckState(); - connect(ui->toolButtonPutHereRadius, &QPushButton::clicked, this, &DialogArc::PutRadius); - connect(ui->toolButtonPutHereF1, &QPushButton::clicked, this, &DialogArc::PutF1); - connect(ui->toolButtonPutHereF2, &QPushButton::clicked, this, &DialogArc::PutF2); + connect(ui->toolButtonExprRadius, &QPushButton::clicked, this, &DialogArc::FXRadius); + connect(ui->toolButtonExprF1, &QPushButton::clicked, this, &DialogArc::FXF1); + connect(ui->toolButtonExprF2, &QPushButton::clicked, this, &DialogArc::FXF2); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogArc::RadiusChanged); connect(ui->plainTextEditF1, &QPlainTextEdit::textChanged, this, &DialogArc::F1Changed); @@ -259,43 +258,6 @@ void DialogArc::closeEvent(QCloseEvent *event) DialogTool::closeEvent(event); } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief PutRadius put variable into formula of radius - */ -void DialogArc::PutRadius() -{ - PutValHere(ui->plainTextEditFormula, ui->listWidget); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief PutF1 put variable into formula of first angle - */ -void DialogArc::PutF1() -{ - PutValHere(ui->plainTextEditF1, ui->listWidget); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief PutF2 put variable into formula of second angle - */ -void DialogArc::PutF2() -{ - PutValHere(ui->plainTextEditF2, ui->listWidget); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief LineAngles show variable angles of lines - */ -// cppcheck-suppress unusedFunction -void DialogArc::LineAngles() -{ - ShowLineAngles(); -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief RadiusChanged after change formula of radius calculate value and show result @@ -329,6 +291,45 @@ void DialogArc::F2Changed() ValFormulaChanged(flagF2, ui->plainTextEditF2, timerF2); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogArc::FXRadius() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit radius")); + dialog->SetFormula(GetRadius()); + if (dialog->exec() == QDialog::Accepted) + { + SetRadius(dialog->GetFormula()); + } + delete dialog; +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogArc::FXF1() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit first angle")); + dialog->SetFormula(GetF1()); + if (dialog->exec() == QDialog::Accepted) + { + SetF1(dialog->GetFormula()); + } + delete dialog; +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogArc::FXF2() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit second angle")); + dialog->SetFormula(GetF2()); + if (dialog->exec() == QDialog::Accepted) + { + SetF2(dialog->GetFormula()); + } + delete dialog; +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief CheckState if all is right enable button ok @@ -377,27 +378,6 @@ void DialogArc::EvalF() CheckAngles(); } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ShowLineAngles show varibles angles of lines - */ -void DialogArc::ShowLineAngles() -{ - ui->listWidget->blockSignals(true); - ui->listWidget->clear(); - ui->listWidget->blockSignals(false); - const QMap > lineAnglesTable = data->DataAngleLines(); - QMap >::const_iterator i; - for (i = lineAnglesTable.constBegin(); i != lineAnglesTable.constEnd(); ++i) - { - QListWidgetItem *item = new QListWidgetItem(i.key()); - - item->setFont(QFont("Times", 12, QFont::Bold)); - ui->listWidget->addItem(item); - } - ui->listWidget->setCurrentRow (0); -} - //--------------------------------------------------------------------------------------------------------------------- void DialogArc::CheckAngles() { diff --git a/src/app/dialogs/tools/dialogarc.h b/src/app/dialogs/tools/dialogarc.h index 25143bcfd..d361e1579 100644 --- a/src/app/dialogs/tools/dialogarc.h +++ b/src/app/dialogs/tools/dialogarc.h @@ -70,14 +70,13 @@ public slots: void DeployFormulaTextEdit(); void DeployF1TextEdit(); void DeployF2TextEdit(); - void PutRadius(); - void PutF1(); - void PutF2(); - // cppcheck-suppress unusedFunction - void LineAngles(); void RadiusChanged(); void F1Changed(); void F2Changed(); + + void FXRadius(); + void FXF1(); + void FXF2(); protected: virtual void CheckState(); virtual void ShowVisualization(); @@ -131,7 +130,6 @@ private: void EvalRadius(); void EvalF(); - void ShowLineAngles(); void CheckAngles(); }; diff --git a/src/app/dialogs/tools/dialogarc.ui b/src/app/dialogs/tools/dialogarc.ui index 74bb663a3..f74c2598c 100644 --- a/src/app/dialogs/tools/dialogarc.ui +++ b/src/app/dialogs/tools/dialogarc.ui @@ -7,7 +7,7 @@ 0 0 425 - 577 + 329 @@ -87,16 +87,13 @@ - - - Insert variable into the formula - + ... - :/icon/24x24/putHere.png:/icon/24x24/putHere.png + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -265,16 +262,13 @@ - - - Insert variable into formula - + ... - :/icon/24x24/putHere.png:/icon/24x24/putHere.png + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -443,16 +437,13 @@ - - - Insert marked variable into formula - + - ... + ... - :/icon/24x24/putHere.png:/icon/24x24/putHere.png + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -556,195 +547,39 @@ - - - - - - - - - - - - 0 - 0 - - - - Center point - - - - - - - Select point of center of arc - - - - - - - - - - Color - - - - - - - - - Input data - - - - - - - - 0 - 0 - - - - Size and height - - - true - - - - - - - - 0 - 0 - - - - Measurements - - - - - - - - 0 - 0 - - - - Increments - - - - - - - true - - - - 0 - 0 - - - - Length of lines - - - - - - - true - - - - 0 - 0 - - - - Length of arcs - - - - - - - true - - - - 0 - 0 - - - - Length of curves - - - - - - - true - - - - 0 - 0 - - - - Angle of lines - - - - - - + + + + + + 0 + 0 + + + + Center point + + - - - - - - Hide empty measurements - - - true - - - - - - - Variables - - - - + + + + Select point of center of arc + + + + + + + + + + Color + + - - - - - - - true - - - @@ -759,23 +594,11 @@ plainTextEditFormula - toolButtonPutHereRadius pushButtonGrowLength plainTextEditF1 - toolButtonPutHereF1 pushButtonGrowLengthF1 plainTextEditF2 - toolButtonPutHereF2 pushButtonGrowLengthF2 - radioButtonSizeGrowth - radioButtonStandardTable - radioButtonIncrements - radioButtonLengthLine - radioButtonLengthArc - radioButtonLengthSpline - radioButtonAngleLine - checkBoxHideEmpty - listWidget comboBoxBasePoint comboBoxColor From 4221eb75ffef0b960d421388ba06e8980174a924 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 29 Apr 2015 20:42:03 +0300 Subject: [PATCH 07/16] F(x) button for tool Point along bisector. --HG-- branch : feature --- src/app/dialogs/tools/dialogbisector.cpp | 19 +- src/app/dialogs/tools/dialogbisector.h | 1 + src/app/dialogs/tools/dialogbisector.ui | 409 +++++++---------------- 3 files changed, 136 insertions(+), 293 deletions(-) diff --git a/src/app/dialogs/tools/dialogbisector.cpp b/src/app/dialogs/tools/dialogbisector.cpp index 3320e63ba..c6bca1bca 100644 --- a/src/app/dialogs/tools/dialogbisector.cpp +++ b/src/app/dialogs/tools/dialogbisector.cpp @@ -34,6 +34,7 @@ #include "../../visualization/vistoolbisector.h" #include "../../widgets/vmaingraphicsscene.h" #include "../../tools/vabstracttool.h" +#include "dialogeditwrongformula.h" //--------------------------------------------------------------------------------------------------------------------- /** @@ -46,7 +47,6 @@ DialogBisector::DialogBisector(const VContainer *data, const quint32 &toolId, QW line(nullptr) { ui->setupUi(this); - InitVariables(ui); InitFormulaUI(ui); ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel)); labelEditNamePoint = ui->labelEditNamePoint; @@ -63,9 +63,7 @@ DialogBisector::DialogBisector(const VContainer *data, const quint32 &toolId, QW FillComboBoxPoints(ui->comboBoxThirdPoint); FillComboBoxLineColors(ui->comboBoxLineColor); - connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogBisector::PutHere); - connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogBisector::PutVal); - + connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogBisector::FXLength); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogBisector::NamePointChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogBisector::FormulaTextChanged); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogBisector::DeployFormulaTextEdit); @@ -110,6 +108,19 @@ void DialogBisector::PointNameChanged() CheckState(); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogBisector::FXLength() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit length")); + dialog->SetFormula(GetFormula()); + if (dialog->exec() == QDialog::Accepted) + { + SetFormula(dialog->GetFormula()); + } + delete dialog; +} + //--------------------------------------------------------------------------------------------------------------------- void DialogBisector::ShowVisualization() { diff --git a/src/app/dialogs/tools/dialogbisector.h b/src/app/dialogs/tools/dialogbisector.h index b1a2d2316..1ff6df5b3 100644 --- a/src/app/dialogs/tools/dialogbisector.h +++ b/src/app/dialogs/tools/dialogbisector.h @@ -79,6 +79,7 @@ public slots: */ void FormulaTextChanged(); virtual void PointNameChanged(); + void FXLength(); protected: virtual void ShowVisualization(); /** diff --git a/src/app/dialogs/tools/dialogbisector.ui b/src/app/dialogs/tools/dialogbisector.ui index ad16c980b..6020f5b99 100644 --- a/src/app/dialogs/tools/dialogbisector.ui +++ b/src/app/dialogs/tools/dialogbisector.ui @@ -7,7 +7,7 @@ 0 0 428 - 565 + 317 @@ -84,16 +84,13 @@ - - - Insert marked variable into the formula - + ... - :/icon/24x24/putHere.png:/icon/24x24/putHere.png + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -200,283 +197,127 @@ - - - - - - - - - - - - 0 - 0 - - - - Point label - - - - - - - - - - - 0 - 0 - - - - First point - - - - - - - First point of angle - - - - - - - - 0 - 0 - - - - Second point - - - - - - - Second point of angle - - - - - - - - 0 - 0 - - - - Third point - - - - - - - Third point of angle - - - - - - - Type of line - - - - - - - - 80 - 0 - - - - - 110 - 16777215 - - - - Show line from second point to this point - - - - 80 - 14 - - - - - - - - Line color - - - - - - - - - - - - Input data - - - - - - - - 0 - 0 - - - - Size and height - - - true - - - - - - - - 0 - 0 - - - - Measurements - - - - - - - - 0 - 0 - - - - Increments - - - - - - - true - - - - 0 - 0 - - - - Length of lines - - - - - - - true - - - - 0 - 0 - - - - Length of arcs - - - - - - - true - - - - 0 - 0 - - - - Length of curves - - - - - - - true - - - - 0 - 0 - - - - Angle of lines - - - - - - + + + + + + 0 + 0 + + + + Point label + + - - - - - - Hide empty measurements - - - true - - - - - - - Variables - Click twice to insert into formula - - - - + + + + + + + + 0 + 0 + + + + First point + + + + + + + First point of angle + + + + + + + + 0 + 0 + + + + Second point + + + + + + + Second point of angle + + + + + + + + 0 + 0 + + + + Third point + + + + + + + Third point of angle + + + + + + + Type of line + + + + + + + + 80 + 0 + + + + + 110 + 16777215 + + + + Show line from second point to this point + + + + 80 + 14 + + + + + + + + Line color + + + + + - - - - - - - true - - - @@ -494,22 +335,12 @@ plainTextEditFormula - toolButtonPutHere pushButtonGrowLength lineEditNamePoint comboBoxFirstPoint comboBoxSecondPoint comboBoxThirdPoint comboBoxLineType - radioButtonSizeGrowth - radioButtonStandardTable - radioButtonIncrements - radioButtonLengthLine - radioButtonLengthArc - radioButtonLengthSpline - radioButtonAngleLine - checkBoxHideEmpty - listWidget buttonBox From d4403c1714901bb06f9e4da14d31e9ac7fdf01de Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 29 Apr 2015 20:46:53 +0300 Subject: [PATCH 08/16] F(x) button for tool Point intersect curve and axis. --HG-- branch : feature --- .../tools/dialogcurveintersectaxis.cpp | 25 +- .../dialogs/tools/dialogcurveintersectaxis.h | 2 +- .../dialogs/tools/dialogcurveintersectaxis.ui | 392 +++++------------- 3 files changed, 127 insertions(+), 292 deletions(-) diff --git a/src/app/dialogs/tools/dialogcurveintersectaxis.cpp b/src/app/dialogs/tools/dialogcurveintersectaxis.cpp index 350815bda..7467df612 100644 --- a/src/app/dialogs/tools/dialogcurveintersectaxis.cpp +++ b/src/app/dialogs/tools/dialogcurveintersectaxis.cpp @@ -34,6 +34,8 @@ #include "../../visualization/vistoolcurveintersectaxis.h" #include "../../widgets/vmaingraphicsscene.h" #include "../../tools/vabstracttool.h" +#include "dialogeditwrongformula.h" + #include //--------------------------------------------------------------------------------------------------------------------- @@ -43,7 +45,6 @@ DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, const { ui->setupUi(this); - InitVariables(ui); InitFormulaUI(ui); ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel)); labelEditNamePoint = ui->labelEditNamePoint; @@ -59,8 +60,7 @@ DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, const FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics()); FillComboBoxLineColors(ui->comboBoxLineColor); - connect(ui->toolButtonPutHereAngle, &QPushButton::clicked, this, &DialogCurveIntersectAxis::PutAngle); - connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogCurveIntersectAxis::PutVal); + connect(ui->toolButtonExprAngle, &QPushButton::clicked, this, &DialogCurveIntersectAxis::FXAngle); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCurveIntersectAxis::NamePointChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogCurveIntersectAxis::AngleTextChanged); connect(ui->pushButtonGrowLengthAngle, &QPushButton::clicked, this, &DialogCurveIntersectAxis::DeployAngleTextEdit); @@ -221,12 +221,6 @@ void DialogCurveIntersectAxis::ChosenObject(quint32 id, const SceneObject &type) } } -//--------------------------------------------------------------------------------------------------------------------- -void DialogCurveIntersectAxis::PutAngle() -{ - PutValHere(ui->plainTextEditFormula, ui->listWidget); -} - //--------------------------------------------------------------------------------------------------------------------- void DialogCurveIntersectAxis::EvalAngle() { @@ -245,6 +239,19 @@ void DialogCurveIntersectAxis::DeployAngleTextEdit() DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLengthAngle, formulaBaseHeightAngle); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogCurveIntersectAxis::FXAngle() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit angle")); + dialog->SetFormula(GetAngle()); + if (dialog->exec() == QDialog::Accepted) + { + SetAngle(dialog->GetFormula()); + } + delete dialog; +} + //--------------------------------------------------------------------------------------------------------------------- void DialogCurveIntersectAxis::ShowVisualization() { diff --git a/src/app/dialogs/tools/dialogcurveintersectaxis.h b/src/app/dialogs/tools/dialogcurveintersectaxis.h index 49c2aa8df..16e0d4246 100644 --- a/src/app/dialogs/tools/dialogcurveintersectaxis.h +++ b/src/app/dialogs/tools/dialogcurveintersectaxis.h @@ -66,10 +66,10 @@ public: virtual void ShowDialog(bool click); public slots: virtual void ChosenObject(quint32 id, const SceneObject &type); - void PutAngle(); void EvalAngle(); void AngleTextChanged(); void DeployAngleTextEdit(); + void FXAngle(); protected: virtual void ShowVisualization(); /** diff --git a/src/app/dialogs/tools/dialogcurveintersectaxis.ui b/src/app/dialogs/tools/dialogcurveintersectaxis.ui index 31a240bba..c0332731f 100644 --- a/src/app/dialogs/tools/dialogcurveintersectaxis.ui +++ b/src/app/dialogs/tools/dialogcurveintersectaxis.ui @@ -7,7 +7,7 @@ 0 0 419 - 532 + 284 @@ -84,13 +84,13 @@ - + ... - :/icon/24x24/putHere.png:/icon/24x24/putHere.png + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -197,279 +197,117 @@ - - - - - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - - 0 - 0 - - - - Axis point - - - - - - - Axis Point - - - - - - - - 0 - 0 - - - - Curve - - - - - - - Curve - - - - - - - - 0 - 0 - - - - Point label - - - - - - - - 0 - 0 - - - - - - - - Type of line - - - - - - - - 80 - 0 - - - - - 110 - 16777215 - - - - Show line from first point to this point - - - - 80 - 14 - - - - - - - - Line color - - - - - - - - - - - - Input data - - - - - - - - 0 - 0 - - - - Size and height - - - true - - - - - - - - 0 - 0 - - - - Measurements - - - - - - - - 0 - 0 - - - - Increments - - - - - - - true - - - - 0 - 0 - - - - Length of lines - - - - - - - true - - - - 0 - 0 - - - - Length of arcs - - - - - - - true - - - - 0 - 0 - - - - Length of curves - - - - - - - true - - - - 0 - 0 - - - - Angle of lines - - - - - - + + + QFormLayout::AllNonFixedFieldsGrow + + + + + + 0 + 0 + + + + Axis point + + - - - - - - Hide empty measurements - - - true - - - - - - - Variables - - - - + + + + Axis Point + + + + + + + + 0 + 0 + + + + Curve + + + + + + + Curve + + + + + + + + 0 + 0 + + + + Point label + + + + + + + + 0 + 0 + + + + + + + + Type of line + + + + + + + + 80 + 0 + + + + + 110 + 16777215 + + + + Show line from first point to this point + + + + 80 + 14 + + + + + + + + Line color + + + + + - - - - - 0 - 0 - - - - Qt::PlainText - - - true - - - @@ -484,21 +322,11 @@ plainTextEditFormula - toolButtonPutHereAngle pushButtonGrowLengthAngle comboBoxAxisPoint comboBoxCurve lineEditNamePoint comboBoxLineType - radioButtonSizeGrowth - radioButtonStandardTable - radioButtonIncrements - radioButtonLengthLine - radioButtonLengthArc - radioButtonLengthSpline - radioButtonAngleLine - checkBoxHideEmpty - listWidget buttonBox From 3af87c2260efa922b501c0d514aac7c88794f54a Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 29 Apr 2015 20:50:15 +0300 Subject: [PATCH 09/16] F(x) button for tool Segment an arc. --HG-- branch : feature --- src/app/dialogs/tools/dialogcutarc.cpp | 19 +- src/app/dialogs/tools/dialogcutarc.h | 1 + src/app/dialogs/tools/dialogcutarc.ui | 262 +++++-------------------- 3 files changed, 64 insertions(+), 218 deletions(-) diff --git a/src/app/dialogs/tools/dialogcutarc.cpp b/src/app/dialogs/tools/dialogcutarc.cpp index 42ebb92f0..a59819920 100644 --- a/src/app/dialogs/tools/dialogcutarc.cpp +++ b/src/app/dialogs/tools/dialogcutarc.cpp @@ -34,6 +34,7 @@ #include "../../visualization/vistoolcutarc.h" #include "../../widgets/vmaingraphicsscene.h" #include "../../xml/vpattern.h" +#include "dialogeditwrongformula.h" //--------------------------------------------------------------------------------------------------------------------- /** @@ -46,7 +47,6 @@ DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidge path(nullptr) { ui->setupUi(this); - InitVariables(ui); InitFormulaUI(ui); ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel)); labelEditNamePoint = ui->labelEditNamePoint; @@ -60,9 +60,7 @@ DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidge FillComboBoxArcs(ui->comboBoxArc); FillComboBoxLineColors(ui->comboBoxColor); - connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutArc::PutHere); - connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutArc::PutVal); - + connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutArc::FXLength); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutArc::NamePointChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogCutArc::FormulaTextChanged); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogCutArc::DeployFormulaTextEdit); @@ -76,6 +74,19 @@ void DialogCutArc::FormulaTextChanged() this->FormulaChangedPlainText(); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogCutArc::FXLength() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit length")); + dialog->SetFormula(GetFormula()); + if (dialog->exec() == QDialog::Accepted) + { + SetFormula(dialog->GetFormula()); + } + delete dialog; +} + //--------------------------------------------------------------------------------------------------------------------- void DialogCutArc::ShowVisualization() { diff --git a/src/app/dialogs/tools/dialogcutarc.h b/src/app/dialogs/tools/dialogcutarc.h index 68df14c06..5e426cd55 100644 --- a/src/app/dialogs/tools/dialogcutarc.h +++ b/src/app/dialogs/tools/dialogcutarc.h @@ -69,6 +69,7 @@ public slots: * @brief FormulaTextChanged when formula text changes for validation and calc */ void FormulaTextChanged(); + void FXLength(); protected: virtual void ShowVisualization(); /** diff --git a/src/app/dialogs/tools/dialogcutarc.ui b/src/app/dialogs/tools/dialogcutarc.ui index 16732646b..cc3e2753e 100644 --- a/src/app/dialogs/tools/dialogcutarc.ui +++ b/src/app/dialogs/tools/dialogcutarc.ui @@ -7,7 +7,7 @@ 0 0 412 - 466 + 218 @@ -84,13 +84,13 @@ - + ... - :/icon/24x24/putHere.png:/icon/24x24/putHere.png + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -197,211 +197,55 @@ - - - - - - - - - - - - 0 - 0 - - - - Arc - - - - - - - Selected arc - - - - - - - - 0 - 0 - - - - Point label - - - - - - - - - - Color - - - - - - - - - - - - Input data - - - - - - - - 0 - 0 - - - - Size and height - - - true - - - - - - - - 0 - 0 - - - - Measurements - - - - - - - - 0 - 0 - - - - Increments - - - - - - - true - - - - 0 - 0 - - - - Length of lines - - - - - - - true - - - - 0 - 0 - - - - Length of arcs - - - - - - - true - - - - 0 - 0 - - - - Length of curves - - - - - - - true - - - - 0 - 0 - - - - Angle of lines - - - - - - + + + + + + 0 + 0 + + + + Arc + + - - - - - - Hide empty measurements - - - true - - - - - - - Variables - Click twice to insert into formula - - - - + + + + Selected arc + + + + + + + + 0 + 0 + + + + Point label + + + + + + + + + + Color + + + + + - - - - - - - true - - - @@ -416,19 +260,9 @@ plainTextEditFormula - toolButtonPutHere pushButtonGrowLength comboBoxArc lineEditNamePoint - radioButtonSizeGrowth - radioButtonStandardTable - radioButtonIncrements - radioButtonLengthLine - radioButtonLengthArc - radioButtonLengthSpline - radioButtonAngleLine - checkBoxHideEmpty - listWidget buttonBox From 182e0f42411e405b174cf73159205e807f1c2465 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 29 Apr 2015 20:54:03 +0300 Subject: [PATCH 10/16] F(x) button for tool Segmenting a simple curve. --HG-- branch : feature --- src/app/dialogs/tools/dialogcutspline.cpp | 18 +- src/app/dialogs/tools/dialogcutspline.h | 1 + src/app/dialogs/tools/dialogcutspline.ui | 262 ++++------------------ 3 files changed, 64 insertions(+), 217 deletions(-) diff --git a/src/app/dialogs/tools/dialogcutspline.cpp b/src/app/dialogs/tools/dialogcutspline.cpp index e1bb786a1..273ec7e54 100644 --- a/src/app/dialogs/tools/dialogcutspline.cpp +++ b/src/app/dialogs/tools/dialogcutspline.cpp @@ -33,6 +33,7 @@ #include "../../container/vcontainer.h" #include "../../xml/vpattern.h" #include "../../visualization/vistoolcutspline.h" +#include "dialogeditwrongformula.h" //--------------------------------------------------------------------------------------------------------------------- /** @@ -45,7 +46,6 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId, path(nullptr) { ui->setupUi(this); - InitVariables(ui); InitFormulaUI(ui); ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel)); labelEditNamePoint = ui->labelEditNamePoint; @@ -59,8 +59,7 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId, FillComboBoxSplines(ui->comboBoxSpline); FillComboBoxLineColors(ui->comboBoxColor); - connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSpline::PutHere); - connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSpline::PutVal); + connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutSpline::FXLength); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSpline::NamePointChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogCutSpline::FormulaChanged); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogCutSpline::DeployFormulaTextEdit); @@ -179,6 +178,19 @@ void DialogCutSpline::DeployFormulaTextEdit() DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogCutSpline::FXLength() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit length")); + dialog->SetFormula(GetFormula()); + if (dialog->exec() == QDialog::Accepted) + { + SetFormula(dialog->GetFormula()); + } + delete dialog; +} + //--------------------------------------------------------------------------------------------------------------------- void DialogCutSpline::ShowVisualization() { diff --git a/src/app/dialogs/tools/dialogcutspline.h b/src/app/dialogs/tools/dialogcutspline.h index 590788d14..740ebc746 100644 --- a/src/app/dialogs/tools/dialogcutspline.h +++ b/src/app/dialogs/tools/dialogcutspline.h @@ -64,6 +64,7 @@ public slots: * @brief DeployFormulaTextEdit grow or shrink formula input */ void DeployFormulaTextEdit(); + void FXLength(); protected: virtual void ShowVisualization(); /** diff --git a/src/app/dialogs/tools/dialogcutspline.ui b/src/app/dialogs/tools/dialogcutspline.ui index 04eb98776..d0e1bc041 100644 --- a/src/app/dialogs/tools/dialogcutspline.ui +++ b/src/app/dialogs/tools/dialogcutspline.ui @@ -7,7 +7,7 @@ 0 0 412 - 466 + 218 @@ -84,13 +84,13 @@ - + ... - :/icon/24x24/putHere.png:/icon/24x24/putHere.png + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -197,211 +197,55 @@ - - - - - - - - - - - - 0 - 0 - - - - Curve - - - - - - - Selected curve - - - - - - - - 0 - 0 - - - - Point label - - - - - - - - - - Color - - - - - - - - - - - - Input data - - - - - - - - 0 - 0 - - - - Size and height - - - true - - - - - - - - 0 - 0 - - - - Measurements - - - - - - - - 0 - 0 - - - - Increments - - - - - - - true - - - - 0 - 0 - - - - Length of lines - - - - - - - true - - - - 0 - 0 - - - - Length of arcs - - - - - - - true - - - - 0 - 0 - - - - Length of curves - - - - - - - true - - - - 0 - 0 - - - - Angle of lines - - - - - - + + + + + + 0 + 0 + + + + Curve + + - - - - - - Hide empty measurements - - - true - - - - - - - Variables - Click twice to insert into formula - - - - + + + + Selected curve + + + + + + + + 0 + 0 + + + + Point label + + + + + + + + + + Color + + + + + - - - - - - - true - - - @@ -416,19 +260,9 @@ plainTextEditFormula - toolButtonPutHere pushButtonGrowLength comboBoxSpline lineEditNamePoint - radioButtonSizeGrowth - radioButtonStandardTable - radioButtonIncrements - radioButtonLengthLine - radioButtonLengthArc - radioButtonLengthSpline - radioButtonAngleLine - checkBoxHideEmpty - listWidget buttonBox From 483b9c28bab540b1477f29f62a558b83e0d2a15d Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 29 Apr 2015 21:11:17 +0300 Subject: [PATCH 11/16] F(x) button for tool Segment a curved path. --HG-- branch : feature --- src/app/dialogs/tools/dialogcutsplinepath.cpp | 18 +- src/app/dialogs/tools/dialogcutsplinepath.h | 1 + src/app/dialogs/tools/dialogcutsplinepath.ui | 274 ++++-------------- 3 files changed, 70 insertions(+), 223 deletions(-) diff --git a/src/app/dialogs/tools/dialogcutsplinepath.cpp b/src/app/dialogs/tools/dialogcutsplinepath.cpp index 0626b3252..84dac8632 100644 --- a/src/app/dialogs/tools/dialogcutsplinepath.cpp +++ b/src/app/dialogs/tools/dialogcutsplinepath.cpp @@ -33,6 +33,7 @@ #include "../../container/vcontainer.h" #include "../../xml/vpattern.h" #include "../../visualization/vistoolcutsplinepath.h" +#include "dialogeditwrongformula.h" //--------------------------------------------------------------------------------------------------------------------- /** @@ -45,7 +46,6 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 & path(nullptr) { ui->setupUi(this); - InitVariables(ui); InitFormulaUI(ui); ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel)); labelEditNamePoint = ui->labelEditNamePoint; @@ -59,8 +59,7 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 & FillComboBoxSplinesPath(ui->comboBoxSplinePath); FillComboBoxLineColors(ui->comboBoxColor); - connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSplinePath::PutHere); - connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSplinePath::PutVal); + connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutSplinePath::FXLength); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSplinePath::NamePointChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogCutSplinePath::FormulaChanged); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogCutSplinePath::DeployFormulaTextEdit); @@ -179,6 +178,19 @@ void DialogCutSplinePath::DeployFormulaTextEdit() DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogCutSplinePath::FXLength() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit length")); + dialog->SetFormula(GetFormula()); + if (dialog->exec() == QDialog::Accepted) + { + SetFormula(dialog->GetFormula()); + } + delete dialog; +} + //--------------------------------------------------------------------------------------------------------------------- void DialogCutSplinePath::ShowVisualization() { diff --git a/src/app/dialogs/tools/dialogcutsplinepath.h b/src/app/dialogs/tools/dialogcutsplinepath.h index 396dc73db..892b70e33 100644 --- a/src/app/dialogs/tools/dialogcutsplinepath.h +++ b/src/app/dialogs/tools/dialogcutsplinepath.h @@ -64,6 +64,7 @@ public slots: * @brief DeployFormulaTextEdit grow or shrink formula input */ void DeployFormulaTextEdit(); + void FXLength(); protected: virtual void ShowVisualization(); /** diff --git a/src/app/dialogs/tools/dialogcutsplinepath.ui b/src/app/dialogs/tools/dialogcutsplinepath.ui index 9638d9f63..8707ac9c8 100644 --- a/src/app/dialogs/tools/dialogcutsplinepath.ui +++ b/src/app/dialogs/tools/dialogcutsplinepath.ui @@ -7,7 +7,7 @@ 0 0 412 - 466 + 218 @@ -84,13 +84,13 @@ - + ... - :/icon/24x24/putHere.png:/icon/24x24/putHere.png + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -197,217 +197,61 @@ - - - - - - - - - - - - 0 - 0 - - - - Curve - - - - - - - Selected curve path - - - - - - - - 0 - 0 - - - - Point label - - - - - - - - - - - 0 - 0 - - - - Color - - - - - - - - - - - - Input data - - - - - - - - 0 - 0 - - - - Size and height - - - true - - - - - - - - 0 - 0 - - - - Measurements - - - - - - - - 0 - 0 - - - - Increments - - - - - - - true - - - - 0 - 0 - - - - Length of lines - - - - - - - true - - - - 0 - 0 - - - - Length of arcs - - - - - - - true - - - - 0 - 0 - - - - Length of curves - - - - - - - true - - - - 0 - 0 - - - - Angle of lines - - - - - - + + + + + + 0 + 0 + + + + Curve + + - - - - - - Hide empty measurements - - - true - - - - - - - Variables - Click twice to insert into formula - - - - + + + + Selected curve path + + + + + + + + 0 + 0 + + + + Point label + + + + + + + + + + + 0 + 0 + + + + Color + + + + + - - - - - - - true - - - @@ -422,19 +266,9 @@ plainTextEditFormula - toolButtonPutHere pushButtonGrowLength comboBoxSplinePath lineEditNamePoint - radioButtonSizeGrowth - radioButtonStandardTable - radioButtonIncrements - radioButtonLengthLine - radioButtonLengthArc - radioButtonLengthSpline - radioButtonAngleLine - checkBoxHideEmpty - listWidget buttonBox From 85403594442116f15b41988dc92b5507a8a3f0b7 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 29 Apr 2015 21:15:26 +0300 Subject: [PATCH 12/16] F(x) button for tool Point intersect line and axis. --HG-- branch : feature --- .../dialogs/tools/dialoglineintersectaxis.cpp | 25 +- .../dialogs/tools/dialoglineintersectaxis.h | 2 +- .../dialogs/tools/dialoglineintersectaxis.ui | 426 ++++++------------ 3 files changed, 144 insertions(+), 309 deletions(-) diff --git a/src/app/dialogs/tools/dialoglineintersectaxis.cpp b/src/app/dialogs/tools/dialoglineintersectaxis.cpp index 60f5d5f4e..ed6ef5a94 100644 --- a/src/app/dialogs/tools/dialoglineintersectaxis.cpp +++ b/src/app/dialogs/tools/dialoglineintersectaxis.cpp @@ -34,6 +34,8 @@ #include "../../visualization/vistoollineintersectaxis.h" #include "../../widgets/vmaingraphicsscene.h" #include "../../tools/vabstracttool.h" +#include "dialogeditwrongformula.h" + #include //--------------------------------------------------------------------------------------------------------------------- @@ -42,7 +44,6 @@ DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const q formulaBaseHeightAngle(0), line(nullptr) { ui->setupUi(this); - InitVariables(ui); InitFormulaUI(ui); ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel)); labelEditNamePoint = ui->labelEditNamePoint; @@ -59,8 +60,7 @@ DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const q FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics()); FillComboBoxLineColors(ui->comboBoxLineColor); - connect(ui->toolButtonPutHereAngle, &QPushButton::clicked, this, &DialogLineIntersectAxis::PutAngle); - connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogLineIntersectAxis::PutVal); + connect(ui->toolButtonExprAngle, &QPushButton::clicked, this, &DialogLineIntersectAxis::FXAngle); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogLineIntersectAxis::NamePointChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogLineIntersectAxis::AngleTextChanged); connect(ui->pushButtonGrowLengthAngle, &QPushButton::clicked, this, &DialogLineIntersectAxis::DeployAngleTextEdit); @@ -260,12 +260,6 @@ void DialogLineIntersectAxis::ChosenObject(quint32 id, const SceneObject &type) } } -//--------------------------------------------------------------------------------------------------------------------- -void DialogLineIntersectAxis::PutAngle() -{ - PutValHere(ui->plainTextEditFormula, ui->listWidget); -} - //--------------------------------------------------------------------------------------------------------------------- void DialogLineIntersectAxis::EvalAngle() { @@ -309,6 +303,19 @@ void DialogLineIntersectAxis::PointNameChanged() CheckState(); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogLineIntersectAxis::FXAngle() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit angle")); + dialog->SetFormula(GetAngle()); + if (dialog->exec() == QDialog::Accepted) + { + SetAngle(dialog->GetFormula()); + } + delete dialog; +} + //--------------------------------------------------------------------------------------------------------------------- void DialogLineIntersectAxis::ShowVisualization() { diff --git a/src/app/dialogs/tools/dialoglineintersectaxis.h b/src/app/dialogs/tools/dialoglineintersectaxis.h index 978e8a7e6..f9aaa4dfb 100644 --- a/src/app/dialogs/tools/dialoglineintersectaxis.h +++ b/src/app/dialogs/tools/dialoglineintersectaxis.h @@ -69,11 +69,11 @@ public: virtual void ShowDialog(bool click); public slots: virtual void ChosenObject(quint32 id, const SceneObject &type); - void PutAngle(); void EvalAngle(); void AngleTextChanged(); void DeployAngleTextEdit(); virtual void PointNameChanged(); + void FXAngle(); protected: virtual void ShowVisualization(); /** diff --git a/src/app/dialogs/tools/dialoglineintersectaxis.ui b/src/app/dialogs/tools/dialoglineintersectaxis.ui index 731310611..3186a2aef 100644 --- a/src/app/dialogs/tools/dialoglineintersectaxis.ui +++ b/src/app/dialogs/tools/dialoglineintersectaxis.ui @@ -7,7 +7,7 @@ 0 0 457 - 565 + 317 @@ -84,13 +84,13 @@ - + ... - :/icon/24x24/putHere.png:/icon/24x24/putHere.png + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -197,296 +197,134 @@ - - - - - - - - - - - - 0 - 0 - - - - Axis point - - - - - - - Axis Point - - - - - - - - 0 - 0 - - - - First line point - - - - - - - First point of line - - - - - - - - 0 - 0 - - - - Second line point - - - - - - - Second point of line - - - - - - - - 0 - 0 - - - - Point label - - - - - - - - 0 - 0 - - - - - - - - Type of line - - - - - - - - 80 - 0 - - - - - 110 - 16777215 - - - - Show line from first point to this point - - - - 80 - 14 - - - - - - - - Line color - - - - - - - - - - - - Input data - - - - - - - - 0 - 0 - - - - Size and height - - - true - - - - - - - - 0 - 0 - - - - Measurements - - - - - - - - 0 - 0 - - - - Increments - - - - - - - true - - - - 0 - 0 - - - - Length of lines - - - - - - - true - - - - 0 - 0 - - - - Length of arcs - - - - - - - true - - - - 0 - 0 - - - - Length of curves - - - - - - - true - - - - 0 - 0 - - - - Angle of lines - - - - - - + + + + + + 0 + 0 + + + + Axis point + + - - - - - - Hide empty measurements - - - true - - - - - - - Variables - - - - + + + + Axis Point + + + + + + + + 0 + 0 + + + + First line point + + + + + + + First point of line + + + + + + + + 0 + 0 + + + + Second line point + + + + + + + Second point of line + + + + + + + + 0 + 0 + + + + Point label + + + + + + + + 0 + 0 + + + + + + + + Type of line + + + + + + + + 80 + 0 + + + + + 110 + 16777215 + + + + Show line from first point to this point + + + + 80 + 14 + + + + + + + + Line color + + + + + - - - - - 0 - 0 - - - - Qt::PlainText - - - true - - - @@ -501,22 +339,12 @@ plainTextEditFormula - toolButtonPutHereAngle pushButtonGrowLengthAngle comboBoxAxisPoint comboBoxFirstLinePoint comboBoxSecondLinePoint lineEditNamePoint comboBoxLineType - radioButtonSizeGrowth - radioButtonStandardTable - radioButtonIncrements - radioButtonLengthLine - radioButtonLengthArc - radioButtonLengthSpline - radioButtonAngleLine - checkBoxHideEmpty - listWidget buttonBox From 09fd789659d9c7203a28bd85815388c36712ead3 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 29 Apr 2015 21:19:57 +0300 Subject: [PATCH 13/16] F(x) button for tool Point along perpendicular. --HG-- branch : feature --- src/app/dialogs/tools/dialognormal.cpp | 18 +- src/app/dialogs/tools/dialognormal.h | 1 + src/app/dialogs/tools/dialognormal.ui | 761 ++++++++++--------------- 3 files changed, 310 insertions(+), 470 deletions(-) diff --git a/src/app/dialogs/tools/dialognormal.cpp b/src/app/dialogs/tools/dialognormal.cpp index f56b1e8c7..960bac439 100644 --- a/src/app/dialogs/tools/dialognormal.cpp +++ b/src/app/dialogs/tools/dialognormal.cpp @@ -31,6 +31,7 @@ #include "../visualization/vistoolnormal.h" #include "../widgets/vmaingraphicsscene.h" #include "../../tools/vabstracttool.h" +#include "dialogeditwrongformula.h" //--------------------------------------------------------------------------------------------------------------------- /** @@ -43,7 +44,6 @@ DialogNormal::DialogNormal(const VContainer *data, const quint32 &toolId, QWidge line(nullptr) { ui->setupUi(this); - InitVariables(ui); InitFormulaUI(ui); ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel)); labelEditNamePoint = ui->labelEditNamePoint; @@ -61,8 +61,7 @@ DialogNormal::DialogNormal(const VContainer *data, const quint32 &toolId, QWidge InitArrow(ui); - connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogNormal::PutHere); - connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogNormal::PutVal); + connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogNormal::FXLength); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogNormal::NamePointChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogNormal::FormulaTextChanged); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogNormal::DeployFormulaTextEdit); @@ -99,6 +98,19 @@ void DialogNormal::PointNameChanged() CheckState(); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogNormal::FXLength() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit length")); + dialog->SetFormula(GetFormula()); + if (dialog->exec() == QDialog::Accepted) + { + SetFormula(dialog->GetFormula()); + } + delete dialog; +} + //--------------------------------------------------------------------------------------------------------------------- void DialogNormal::ShowVisualization() { diff --git a/src/app/dialogs/tools/dialognormal.h b/src/app/dialogs/tools/dialognormal.h index 4cf31b9df..39c1fbb55 100644 --- a/src/app/dialogs/tools/dialognormal.h +++ b/src/app/dialogs/tools/dialognormal.h @@ -78,6 +78,7 @@ public slots: */ void FormulaTextChanged(); virtual void PointNameChanged(); + void FXLength(); protected: virtual void ShowVisualization(); /** diff --git a/src/app/dialogs/tools/dialognormal.ui b/src/app/dialogs/tools/dialognormal.ui index 42ae2e583..2cb96c91c 100644 --- a/src/app/dialogs/tools/dialognormal.ui +++ b/src/app/dialogs/tools/dialognormal.ui @@ -7,7 +7,7 @@ 0 0 517 - 678 + 428 @@ -87,16 +87,13 @@ - - - Insert variable into formula - + ... - :/icon/24x24/putHere.png:/icon/24x24/putHere.png + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -200,457 +197,261 @@ - + + + + + + 0 + 0 + + + + Point label + + + + + + + + + + + 0 + 0 + + + + First point + + + + + + + First point of line + + + + + + + + 0 + 0 + + + + Second point + + + + + + + Second point of line + + + + + + + - - - - - - - - 0 - 0 - - - - Point label - - - - - - - - - - - 0 - 0 - - - - First point - - - - - - - First point of line - - - - - - - - 0 - 0 - - - - Second point - - - - - - - Second point of line - - - - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Additional angle degrees - - - true - - - - - - - QLayout::SetMinimumSize - - - 29 - - - 6 - - - - - ... - - - - :/icon/32x32/arrowRightUp.png:/icon/32x32/arrowRightUp.png - - - - 32 - 32 - - - - - - - - ... - - - - :/icon/32x32/arrowLeftUp.png:/icon/32x32/arrowLeftUp.png - - - - 32 - 32 - - - - - - - - ... - - - - :/icon/32x32/arrowLeft.png:/icon/32x32/arrowLeft.png - - - - 32 - 32 - - - - - - - - ... - - - - :/icon/32x32/arrowRight.png:/icon/32x32/arrowRight.png - - - - 32 - 32 - - - - - - - - - 0 - 0 - - - - ... - - - - :/icon/32x32/arrowUp.png:/icon/32x32/arrowUp.png - - - - 32 - 32 - - - - - - - - ... - - - - :/icon/32x32/arrowDown.png:/icon/32x32/arrowDown.png - - - - 32 - 32 - - - - - - - - ... - - - - :/icon/32x32/arrowLeftDown.png:/icon/32x32/arrowLeftDown.png - - - - 32 - 32 - - - - - - - - ... - - - - :/icon/32x32/arrowRightDown.png:/icon/32x32/arrowRightDown.png - - - - 32 - 32 - - - - - - - - - 0 - 0 - - - - - 56 - 0 - - - - -360.000000000000000 - - - 360.000000000000000 - - - - - - - - - - - - - - - - - Type of line - - - - - - - - 80 - 0 - - - - - 110 - 16777215 - - - - Show line from first point to this point - - - - 80 - 14 - - - - - - - - - - - Line color - - - - - - - - - Input data - - - - - - - - 0 - 0 - - - - Size and height - - - true - - - - - - - - 0 - 0 - - - - Measurements - - - - - - - - 0 - 0 - - - - Increments - - - - - - - true - - - - 0 - 0 - - - - Length of lines - - - - - - - true - - - - 0 - 0 - - - - Length of arcs - - - - - - - true - - - - 0 - 0 - - - - Length of curves - - - - - - - true - - - - 0 - 0 - - - - Angle of lines - - - - - - + + + + 0 + 0 + + + + + 0 + 0 + + + + Additional angle degrees + + + true + + - - - + + + QLayout::SetMinimumSize + + + 29 + + + 6 + + + - Hide empty measurements + ... - - true + + + :/icon/32x32/arrowRight.png:/icon/32x32/arrowRight.png + + + + 32 + 32 + - - - - Variables - Click twice to insert into formula + + + + + 0 + 0 + + + + + 56 + 0 + + + + -360.000000000000000 + + + 360.000000000000000 + + + + + + + ... + + + + :/icon/32x32/arrowLeftUp.png:/icon/32x32/arrowLeftUp.png + + + + 32 + 32 + + + + + + + + ... + + + + :/icon/32x32/arrowRightUp.png:/icon/32x32/arrowRightUp.png + + + + 32 + 32 + + + + + + + + + 0 + 0 + + + + ... + + + + :/icon/32x32/arrowUp.png:/icon/32x32/arrowUp.png + + + + 32 + 32 + + + + + + + + ... + + + + :/icon/32x32/arrowLeft.png:/icon/32x32/arrowLeft.png + + + + 32 + 32 + + + + + + + + ... + + + + :/icon/32x32/arrowLeftDown.png:/icon/32x32/arrowLeftDown.png + + + + 32 + 32 + + + + + + + + ... + + + + :/icon/32x32/arrowDown.png:/icon/32x32/arrowDown.png + + + + 32 + 32 + + + + + + + + ... + + + + :/icon/32x32/arrowRightDown.png:/icon/32x32/arrowRightDown.png + + + + 32 + 32 + @@ -659,14 +460,50 @@ - - - - - - true - - + + + + + Type of line + + + + + + + + 80 + 0 + + + + + 110 + 16777215 + + + + Show line from first point to this point + + + + 80 + 14 + + + + + + + + + + + Line color + + + + @@ -682,7 +519,6 @@ plainTextEditFormula - toolButtonPutHere pushButtonGrowLength lineEditNamePoint comboBoxFirstPoint @@ -696,15 +532,6 @@ toolButtonArrowLeftDown toolButtonArrowLeft toolButtonArrowLeftUp - radioButtonSizeGrowth - radioButtonStandardTable - radioButtonIncrements - radioButtonLengthLine - radioButtonLengthArc - radioButtonLengthSpline - radioButtonAngleLine - checkBoxHideEmpty - listWidget buttonBox From e90398e77e245ffb6bb5202539e106dbd6375320 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 29 Apr 2015 21:26:32 +0300 Subject: [PATCH 14/16] F(x) button for tool Point at intersection of arc and line. --HG-- branch : feature --- .../dialogs/tools/dialogpointofcontact.cpp | 34 +- src/app/dialogs/tools/dialogpointofcontact.h | 1 + src/app/dialogs/tools/dialogpointofcontact.ui | 409 +++++------------- 3 files changed, 136 insertions(+), 308 deletions(-) diff --git a/src/app/dialogs/tools/dialogpointofcontact.cpp b/src/app/dialogs/tools/dialogpointofcontact.cpp index 8476ea8ec..16ea78527 100644 --- a/src/app/dialogs/tools/dialogpointofcontact.cpp +++ b/src/app/dialogs/tools/dialogpointofcontact.cpp @@ -33,6 +33,7 @@ #include "../../visualization/vistoolpointofcontact.h" #include "../../widgets/vmaingraphicsscene.h" #include "../../xml/vpattern.h" +#include "dialogeditwrongformula.h" //--------------------------------------------------------------------------------------------------------------------- /** @@ -45,7 +46,6 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, const quint32 radius(QString()), formulaBaseHeight(0), line(nullptr) { ui->setupUi(this); - InitVariables(ui); InitFormulaUI(ui); ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel)); labelEditNamePoint = ui->labelEditNamePoint; @@ -60,24 +60,7 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, const quint32 FillComboBoxPoints(ui->comboBoxSecondPoint); FillComboBoxPoints(ui->comboBoxCenter); - connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogPointOfContact::PutHere); - connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogPointOfContact::PutVal); - - if (qApp->patternType() == MeasurementsType::Standard) - { - SizeHeight(); - connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeHeight); - } - else - { - radioButtonSizeGrowth->setVisible(false); - Measurements(); - } - connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogPointOfContact::Measurements); - connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogPointOfContact::Increments); - connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogPointOfContact::LengthLines); - connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogPointOfContact::LengthArcs); - connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogPointOfContact::LengthCurves); + connect(ui->toolButtonExprRadius, &QPushButton::clicked, this, &DialogPointOfContact::FXRadius); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfContact::NamePointChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogPointOfContact::FormulaTextChanged); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogPointOfContact::DeployFormulaTextEdit); @@ -132,6 +115,19 @@ void DialogPointOfContact::PointNameChanged() CheckState(); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogPointOfContact::FXRadius() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit radius")); + dialog->SetFormula(getRadius()); + if (dialog->exec() == QDialog::Accepted) + { + setRadius(dialog->GetFormula()); + } + delete dialog; +} + //--------------------------------------------------------------------------------------------------------------------- void DialogPointOfContact::ShowVisualization() { diff --git a/src/app/dialogs/tools/dialogpointofcontact.h b/src/app/dialogs/tools/dialogpointofcontact.h index 54ec9fdcf..d3d59f51b 100644 --- a/src/app/dialogs/tools/dialogpointofcontact.h +++ b/src/app/dialogs/tools/dialogpointofcontact.h @@ -73,6 +73,7 @@ public slots: */ void FormulaTextChanged(); virtual void PointNameChanged(); + void FXRadius(); protected: virtual void ShowVisualization(); /** diff --git a/src/app/dialogs/tools/dialogpointofcontact.ui b/src/app/dialogs/tools/dialogpointofcontact.ui index 8dee56fac..5f3aa5cad 100644 --- a/src/app/dialogs/tools/dialogpointofcontact.ui +++ b/src/app/dialogs/tools/dialogpointofcontact.ui @@ -7,7 +7,7 @@ 0 0 498 - 499 + 251 @@ -87,16 +87,13 @@ - - - Insert variable into formula - + ... - :/icon/24x24/putHere.png:/icon/24x24/putHere.png + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -200,283 +197,127 @@ - - - - - - - - - - - - 0 - 0 - - - - Point label - - - - - - - - - - - 0 - 0 - - - - Center of arc - - - - - - - - 0 - 0 - - - - - 145 - 0 - - - - Select point of center of arc - - - - - - - - 0 - 0 - - - - Top of the line - - - - - - - - 0 - 0 - - - - - 143 - 0 - - - - - - - - - 0 - 0 - - - - End of the line - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - 110 - 16777215 - - - - - 80 - 14 - - - - - - - - - - Input data - - - - - - - - 0 - 0 - - - - Size and height - - - true - - - - - - - - 0 - 0 - - - - Measurements - - - - - - - - 0 - 0 - - - - Increments - - - - - - - true - - - - 0 - 0 - - - - Length of lines - - - - - - - true - - - - 0 - 0 - - - - Length of arcs - - - - - - - true - - - - 0 - 0 - - - - Length of curves - - - - - - - true - - - - 0 - 0 - - - - Angle of lines - - - - - - + + + + + + 0 + 0 + + + + Point label + + - - - - - - Hide empty measurements - - - true - - - - - - - Variables - Click twice to insert into formula. - - - - + + + + + + + + 0 + 0 + + + + Center of arc + + + + + + + + 0 + 0 + + + + + 145 + 0 + + + + Select point of center of arc + + + + + + + + 0 + 0 + + + + Top of the line + + + + + + + + 0 + 0 + + + + + 143 + 0 + + + + + + + + + 0 + 0 + + + + End of the line + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + + 110 + 16777215 + + + + + 80 + 14 + + + - - - - - - - true - - - @@ -491,21 +332,11 @@ plainTextEditFormula - toolButtonPutHere pushButtonGrowLength lineEditNamePoint comboBoxCenter comboBoxFirstPoint comboBoxSecondPoint - radioButtonSizeGrowth - radioButtonStandardTable - radioButtonIncrements - radioButtonLengthLine - radioButtonLengthArc - radioButtonLengthSpline - radioButtonAngleLine - checkBoxHideEmpty - listWidget buttonBox From 225c1b219b4645f0ef360c4f1e779402221abbb6 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 29 Apr 2015 21:30:44 +0300 Subject: [PATCH 15/16] F(x) button for tool Special point on shoulder. --HG-- branch : feature --- src/app/dialogs/tools/dialogshoulderpoint.cpp | 18 +- src/app/dialogs/tools/dialogshoulderpoint.h | 1 + src/app/dialogs/tools/dialogshoulderpoint.ui | 487 ++++++------------ 3 files changed, 175 insertions(+), 331 deletions(-) diff --git a/src/app/dialogs/tools/dialogshoulderpoint.cpp b/src/app/dialogs/tools/dialogshoulderpoint.cpp index 428aba82a..6e14f08d8 100644 --- a/src/app/dialogs/tools/dialogshoulderpoint.cpp +++ b/src/app/dialogs/tools/dialogshoulderpoint.cpp @@ -34,6 +34,7 @@ #include "../../visualization/vistoolshoulderpoint.h" #include "../../widgets/vmaingraphicsscene.h" #include "../../tools/vabstracttool.h" +#include "dialogeditwrongformula.h" //--------------------------------------------------------------------------------------------------------------------- /** @@ -46,7 +47,6 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, const quint32 & formulaBaseHeight(0), line (nullptr) { ui->setupUi(this); - InitVariables(ui); InitFormulaUI(ui); ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel)); labelEditNamePoint = ui->labelEditNamePoint; @@ -63,8 +63,7 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, const quint32 & FillComboBoxPoints(ui->comboBoxP3); FillComboBoxLineColors(ui->comboBoxLineColor); - connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogShoulderPoint::PutHere); - connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogShoulderPoint::PutVal); + connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogShoulderPoint::FXLength); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogShoulderPoint::NamePointChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogShoulderPoint::FormulaTextChanged); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogShoulderPoint::DeployFormulaTextEdit); @@ -109,6 +108,19 @@ void DialogShoulderPoint::PointNameChanged() CheckState(); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogShoulderPoint::FXLength() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit length")); + dialog->SetFormula(GetFormula()); + if (dialog->exec() == QDialog::Accepted) + { + SetFormula(dialog->GetFormula()); + } + delete dialog; +} + //--------------------------------------------------------------------------------------------------------------------- void DialogShoulderPoint::ShowVisualization() { diff --git a/src/app/dialogs/tools/dialogshoulderpoint.h b/src/app/dialogs/tools/dialogshoulderpoint.h index c2b2de437..6360d75cf 100644 --- a/src/app/dialogs/tools/dialogshoulderpoint.h +++ b/src/app/dialogs/tools/dialogshoulderpoint.h @@ -78,6 +78,7 @@ public slots: */ void FormulaTextChanged(); virtual void PointNameChanged(); + void FXLength(); protected: virtual void ShowVisualization(); /** diff --git a/src/app/dialogs/tools/dialogshoulderpoint.ui b/src/app/dialogs/tools/dialogshoulderpoint.ui index 0bc344bb6..4c730548c 100644 --- a/src/app/dialogs/tools/dialogshoulderpoint.ui +++ b/src/app/dialogs/tools/dialogshoulderpoint.ui @@ -7,7 +7,7 @@ 0 0 488 - 565 + 317 @@ -87,16 +87,13 @@ - - - Insert variable into formula - + ... - :/icon/24x24/putHere.png:/icon/24x24/putHere.png + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -200,322 +197,166 @@ - - - - - - - - - - - - 0 - 0 - - - - Point label - - - - - - - - - - - 0 - 0 - - - - First point - - - - - - - - 0 - 0 - - - - - 145 - 0 - - - - - - - - - 0 - 0 - - - - Second point - - - - - - - - 0 - 0 - - - - - 143 - 0 - - - - - - - - - 0 - 0 - - - - Third point - - - - - - - - 0 - 0 - - - - - 145 - 0 - - - - - - - - - 0 - 0 - - - - Type of line - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - 110 - 16777215 - - - - Show line from first point to our point - - - - 80 - 14 - - - - - - - - Line color - - - - - - - - - - - - Input data - - - - - - - - 0 - 0 - - - - Size and height - - - true - - - - - - - - 0 - 0 - - - - Measurements - - - - - - - - 0 - 0 - - - - Increments - - - - - - - true - - - - 0 - 0 - - - - Length of lines - - - - - - - true - - - - 0 - 0 - - - - Length of arcs - - - - - - - true - - - - 0 - 0 - - - - Length of curves - - - - - - - true - - - - 0 - 0 - - - - Angle of lines - - - - - - + + + + + + 0 + 0 + + + + Point label + + - - - - - - Hide empty measurements - - - true - - - - - - - Variables - Click twice to insert into formula - - - - + + + + + + + + 0 + 0 + + + + First point + + + + + + + + 0 + 0 + + + + + 145 + 0 + + + + + + + + + 0 + 0 + + + + Second point + + + + + + + + 0 + 0 + + + + + 143 + 0 + + + + + + + + + 0 + 0 + + + + Third point + + + + + + + + 0 + 0 + + + + + 145 + 0 + + + + + + + + + 0 + 0 + + + + Type of line + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + + 110 + 16777215 + + + + Show line from first point to our point + + + + 80 + 14 + + + + + + + + Line color + + + + + - - - - - - - true - - - @@ -530,22 +371,12 @@ plainTextEditFormula - toolButtonPutHere pushButtonGrowLength lineEditNamePoint comboBoxP1Line comboBoxP2Line comboBoxP3 comboBoxLineType - radioButtonSizeGrowth - radioButtonStandardTable - radioButtonIncrements - radioButtonLengthLine - radioButtonLengthArc - radioButtonLengthSpline - radioButtonAngleLine - checkBoxHideEmpty - listWidget buttonBox From 9fb1e972c508b6074f96e103763c8c984fab5c5f Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 30 Apr 2015 14:08:54 +0300 Subject: [PATCH 16/16] Refactoring. Move method to class DialogEditWrongFormula. --HG-- branch : feature --- .../dialogs/tools/dialogeditwrongformula.cpp | 248 +++++++++++++++- .../dialogs/tools/dialogeditwrongformula.h | 16 ++ src/app/dialogs/tools/dialogtool.cpp | 272 +----------------- src/app/dialogs/tools/dialogtool.h | 77 +---- 4 files changed, 265 insertions(+), 348 deletions(-) diff --git a/src/app/dialogs/tools/dialogeditwrongformula.cpp b/src/app/dialogs/tools/dialogeditwrongformula.cpp index 63bc747a0..ad1386994 100644 --- a/src/app/dialogs/tools/dialogeditwrongformula.cpp +++ b/src/app/dialogs/tools/dialogeditwrongformula.cpp @@ -28,6 +28,7 @@ #include "dialogeditwrongformula.h" #include "ui_dialogeditwrongformula.h" +#include "../../container/vcontainer.h" //--------------------------------------------------------------------------------------------------------------------- DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, const quint32 &toolId, QWidget *parent) @@ -35,7 +36,7 @@ DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, const qui checkZero(false), postfix(QString()), restoreCursor(false) { ui->setupUi(this); - InitVariables(ui); + InitVariables(); InitFormulaUI(ui); this->formulaBaseHeight = ui->plainTextEditFormula->height(); ui->plainTextEditFormula->installEventFilter(this); @@ -105,6 +106,195 @@ void DialogEditWrongFormula::EvalFormula() Eval(plainTextEditFormula->toPlainText(), flagFormula, labelResultCalculation, postfix, checkZero); } +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief ValChenged show description when current variable changed + * @param row number of row + */ +void DialogEditWrongFormula::ValChenged(int row) +{ + if (ui->listWidget->count() == 0) + { + ui->labelDescription->setText(""); + return; + } + QListWidgetItem *item = ui->listWidget->item( row ); + if (ui->radioButtonSizeGrowth->isChecked()) + { + if (item->text()==data->HeightName()) + { + QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->height()).arg(tr("Height")); + ui->labelDescription->setText(desc); + } + if (item->text()==data->SizeName()) + { + QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->size()).arg(tr("Size")); + ui->labelDescription->setText(desc); + } + return; + } + if (ui->radioButtonStandardTable->isChecked()) + { + QString name = qApp->VarFromUser(item->text()); + QSharedPointer stable = data->GetVariable(name); + QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetTableValue(name)) + .arg(stable->GetGuiText()); + ui->labelDescription->setText(desc); + return; + } + if (ui->radioButtonIncrements->isChecked()) + { + QSharedPointer incr = data->GetVariable(item->text()); + QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetTableValue(item->text())) + .arg(incr->GetDescription()); + ui->labelDescription->setText(desc); + return; + } + if (ui->radioButtonLengthLine->isChecked()) + { + QString desc = QString("%1(%2) - %3").arg(item->text()) + .arg(*data->GetVariable(qApp->VarFromUser(item->text()))->GetValue()) + .arg(tr("Line length")); + ui->labelDescription->setText(desc); + return; + } + if (ui->radioButtonLengthArc->isChecked()) + { + QString desc = QString("%1(%2) - %3").arg(item->text()) + .arg(*data->GetVariable(qApp->VarFromUser(item->text()))->GetValue()) + .arg(tr("Arc length")); + ui->labelDescription->setText(desc); + return; + } + if (ui->radioButtonLengthSpline->isChecked()) + { + QString desc = QString("%1(%2) - %3").arg(item->text()) + .arg(*data->GetVariable(qApp->VarFromUser(item->text()))->GetValue()) + .arg(tr("Curve length")); + ui->labelDescription->setText(desc); + return; + } + if (ui->radioButtonAngleLine->isChecked()) + { + QString desc = QString("%1(%2) - %3").arg(item->text()) + .arg(*data->GetVariable(qApp->VarFromUser(item->text()))->GetValue()) + .arg(tr("Line Angle")); + ui->labelDescription->setText(desc); + return; + } +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief SizeHeight show in list base variables + */ +void DialogEditWrongFormula::SizeHeight() +{ + ui->checkBoxHideEmpty->setEnabled(false); + + ui->listWidget->blockSignals(true); + ui->listWidget->clear(); + + { + QListWidgetItem *item = new QListWidgetItem(data->HeightName()); + item->setFont(QFont("Times", 12, QFont::Bold)); + ui->listWidget->addItem(item); + } + + QListWidgetItem *item = new QListWidgetItem(data->SizeName()); + item->setFont(QFont("Times", 12, QFont::Bold)); + ui->listWidget->addItem(item); + + ui->listWidget->blockSignals(false); + ui->listWidget->setCurrentRow (0); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief PutHere put variable into edit + */ +void DialogEditWrongFormula::PutHere() +{ + const QListWidgetItem *item = ui->listWidget->currentItem(); + if (item != nullptr) + { + QTextCursor cursor = ui->plainTextEditFormula->textCursor(); + cursor.insertText(item->text()); + ui->plainTextEditFormula->setTextCursor(cursor); + ui->plainTextEditFormula->setFocus(); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief PutVal put variable into edit + * @param item chosen item of list widget + */ +void DialogEditWrongFormula::PutVal(QListWidgetItem *item) +{ + SCASSERT(item != nullptr); + QTextCursor cursor = ui->plainTextEditFormula->textCursor(); + cursor.insertText(item->text()); + ui->plainTextEditFormula->setTextCursor(cursor); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief Measurements show in list measurements + */ +void DialogEditWrongFormula::Measurements() +{ + ui->checkBoxHideEmpty->setEnabled(true); + ShowVariable(data->DataMeasurements()); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief LengthLines show in list lengths of lines variables + */ +void DialogEditWrongFormula::LengthLines() +{ + ui->checkBoxHideEmpty->setEnabled(false); + ShowVariable(data->DataLengthLines()); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief LengthArcs show in list lengths of arcs variables + */ +void DialogEditWrongFormula::LengthArcs() +{ + ui->checkBoxHideEmpty->setEnabled(false); + ShowVariable(data->DataLengthArcs()); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief LengthCurves show in list lengths of curves variables + */ +void DialogEditWrongFormula::LengthCurves() +{ + ui->checkBoxHideEmpty->setEnabled(false); + ShowVariable(data->DataLengthSplines()); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogEditWrongFormula::AngleLines() +{ + ui->checkBoxHideEmpty->setEnabled(false); + ShowVariable(data->DataAngleLines()); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief Increments show in list increment variables + */ +void DialogEditWrongFormula::Increments() +{ + ui->checkBoxHideEmpty->setEnabled(false); + ShowVariable(data->DataIncrements()); +} + //--------------------------------------------------------------------------------------------------------------------- void DialogEditWrongFormula::CheckState() { @@ -150,3 +340,59 @@ QString DialogEditWrongFormula::GetFormula() const { return qApp->FormulaFromUser(formula); } + +//--------------------------------------------------------------------------------------------------------------------- +void DialogEditWrongFormula::InitVariables() +{ + connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogEditWrongFormula::ValChenged); + + if (qApp->patternType() == MeasurementsType::Standard) + { + SizeHeight(); + connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogEditWrongFormula::SizeHeight); + } + else + { + ui->radioButtonSizeGrowth->setEnabled(false); + ui->radioButtonStandardTable->setChecked(true); + Measurements(); + } + connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogEditWrongFormula::Measurements); + connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogEditWrongFormula::Increments); + connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogEditWrongFormula::LengthLines); + connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogEditWrongFormula::LengthArcs); + connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogEditWrongFormula::LengthCurves); + connect(ui->radioButtonAngleLine, &QRadioButton::clicked, this, &DialogEditWrongFormula::AngleLines); + connect(ui->checkBoxHideEmpty, &QCheckBox::stateChanged, this, &DialogEditWrongFormula::Measurements); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief ShowVariable show variables in list + * @param var container with variables + */ +template +void DialogEditWrongFormula::ShowVariable(const QMap var) +{ + ui->listWidget->blockSignals(true); + ui->listWidget->clear(); + ui->labelDescription->setText(""); + + QMapIterator iMap(var); + while (iMap.hasNext()) + { + iMap.next(); + if (ui->checkBoxHideEmpty->isEnabled() && ui->checkBoxHideEmpty->isChecked() && iMap.value()->IsNotUsed()) + { + continue; //skip this measurement + } + if (iMap.value()->Filter(toolId) == false) + {// If we create this variable don't show + QListWidgetItem *item = new QListWidgetItem(iMap.key()); + item->setFont(QFont("Times", 12, QFont::Bold)); + ui->listWidget->addItem(item); + } + } + ui->listWidget->blockSignals(false); + ui->listWidget->setCurrentRow (0); +} diff --git a/src/app/dialogs/tools/dialogeditwrongformula.h b/src/app/dialogs/tools/dialogeditwrongformula.h index faaa436ae..fc6f9d16a 100644 --- a/src/app/dialogs/tools/dialogeditwrongformula.h +++ b/src/app/dialogs/tools/dialogeditwrongformula.h @@ -63,6 +63,17 @@ public slots: */ void DeployFormulaTextEdit(); virtual void EvalFormula(); + void ValChenged(int row); + void SizeHeight(); + void PutHere(); + void PutVal(QListWidgetItem * item); + + void Measurements(); + void LengthLines(); + void LengthArcs(); + void LengthCurves(); + void AngleLines(); + void Increments(); protected: virtual void CheckState(); virtual void closeEvent(QCloseEvent *event); @@ -79,6 +90,11 @@ private: bool checkZero; QString postfix; bool restoreCursor; + + void InitVariables(); + + template + void ShowVariable(const QMap var); }; diff --git a/src/app/dialogs/tools/dialogtool.cpp b/src/app/dialogs/tools/dialogtool.cpp index d6d3c4b5d..64e305016 100644 --- a/src/app/dialogs/tools/dialogtool.cpp +++ b/src/app/dialogs/tools/dialogtool.cpp @@ -60,10 +60,7 @@ Q_LOGGING_CATEGORY(vDialog, "v.dialog") DialogTool::DialogTool(const VContainer *data, const quint32 &toolId, QWidget *parent) :QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), flagError(true), timerFormula(nullptr), bOk(nullptr), bApply(nullptr), spinBoxAngle(nullptr), plainTextEditFormula(nullptr), - listWidget(nullptr), labelResultCalculation(nullptr), labelDescription(nullptr), labelEditNamePoint(nullptr), - labelEditFormula(nullptr), radioButtonSizeGrowth(nullptr), radioButtonStandardTable(nullptr), - radioButtonIncrements(nullptr), radioButtonLengthLine(nullptr), radioButtonLengthArc(nullptr), - radioButtonLengthCurve(nullptr), radioButtonAngleLine(nullptr), checkBoxHideEmpty(nullptr), + labelResultCalculation(nullptr), labelEditNamePoint(nullptr), labelEditFormula(nullptr), okColor(QColor(76, 76, 76)), errorColor(Qt::red), associatedTool(nullptr), toolId(toolId), prepare(false), pointName(QString()), number(0) { @@ -348,41 +345,6 @@ void DialogTool::ChangeCurrentData(QComboBox *box, const QVariant &value) const } } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief PutValHere put variable into line edit from list - * @param lineEdit lineEdit - * @param listWidget listWidget - */ -void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget) -{ - SCASSERT(lineEdit != nullptr); - SCASSERT(listWidget != nullptr); - QListWidgetItem *item = listWidget->currentItem(); - if (item != nullptr) - { - int pos = lineEdit->cursorPosition(); - lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text())); - lineEdit->setFocus(); - lineEdit->setCursorPosition(pos + item->text().size()); - } -} - -//--------------------------------------------------------------------------------------------------------------------- -void DialogTool::PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidget) -{ - SCASSERT(plainTextEdit != nullptr); - SCASSERT(listWidget != nullptr); - QListWidgetItem *item = listWidget->currentItem(); - if (item != nullptr) - { - QTextCursor cursor = plainTextEdit->textCursor(); - cursor.insertText(item->text()); - plainTextEdit->setTextCursor(cursor); - plainTextEdit->setFocus(); - } -} - //--------------------------------------------------------------------------------------------------------------------- void DialogTool::MoveCursorToEnd(QPlainTextEdit *plainTextEdit) { @@ -884,205 +846,6 @@ void DialogTool::EvalFormula() Eval(plainTextEditFormula->toPlainText(), flagFormula, labelResultCalculation, postfix, false); } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief SizeHeight show in list base variables - */ -void DialogTool::SizeHeight() -{ - SCASSERT(checkBoxHideEmpty != nullptr); - checkBoxHideEmpty->setEnabled(false); - - SCASSERT(listWidget != nullptr); - listWidget->blockSignals(true); - listWidget->clear(); - - { - QListWidgetItem *item = new QListWidgetItem(data->HeightName()); - item->setFont(QFont("Times", 12, QFont::Bold)); - listWidget->addItem(item); - } - - QListWidgetItem *item = new QListWidgetItem(data->SizeName()); - item->setFont(QFont("Times", 12, QFont::Bold)); - listWidget->addItem(item); - - listWidget->blockSignals(false); - listWidget->setCurrentRow (0); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief Measurements show in list measurements - */ -void DialogTool::Measurements() -{ - SCASSERT(checkBoxHideEmpty != nullptr); - checkBoxHideEmpty->setEnabled(true); - ShowVariable(data->DataMeasurements()); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief LengthLines show in list lengths of lines variables - */ -void DialogTool::LengthLines() -{ - SCASSERT(checkBoxHideEmpty != nullptr); - checkBoxHideEmpty->setEnabled(false); - ShowVariable(data->DataLengthLines()); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief LengthArcs show in list lengths of arcs variables - */ -void DialogTool::LengthArcs() -{ - SCASSERT(checkBoxHideEmpty != nullptr); - checkBoxHideEmpty->setEnabled(false); - ShowVariable(data->DataLengthArcs()); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief LengthCurves show in list lengths of curves variables - */ -void DialogTool::LengthCurves() -{ - SCASSERT(checkBoxHideEmpty != nullptr); - checkBoxHideEmpty->setEnabled(false); - ShowVariable(data->DataLengthSplines()); -} - -//--------------------------------------------------------------------------------------------------------------------- -void DialogTool::AngleLines() -{ - SCASSERT(checkBoxHideEmpty != nullptr); - checkBoxHideEmpty->setEnabled(false); - ShowVariable(data->DataAngleLines()); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief Increments show in list increment variables - */ -void DialogTool::Increments() -{ - SCASSERT(checkBoxHideEmpty != nullptr); - checkBoxHideEmpty->setEnabled(false); - ShowVariable(data->DataIncrements()); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief PutHere put variable into edit - */ -void DialogTool::PutHere() -{ - PutValHere(plainTextEditFormula, listWidget); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief PutVal put variable into edit - * @param item chosen item of list widget - */ -void DialogTool::PutVal(QListWidgetItem *item) -{ - SCASSERT(plainTextEditFormula != nullptr); - SCASSERT(item != nullptr); - QTextCursor cursor = plainTextEditFormula->textCursor(); - cursor.insertText(item->text()); - plainTextEditFormula->setTextCursor(cursor); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ValChenged show description when current variable changed - * @param row number of row - */ -void DialogTool::ValChenged(int row) -{ - SCASSERT(listWidget != nullptr); - SCASSERT(labelDescription != nullptr); - SCASSERT(radioButtonSizeGrowth != nullptr); - SCASSERT(radioButtonStandardTable != nullptr); - SCASSERT(radioButtonIncrements != nullptr); - SCASSERT(radioButtonLengthLine != nullptr); - SCASSERT(radioButtonLengthArc != nullptr); - SCASSERT(radioButtonLengthCurve != nullptr); - if (listWidget->count() == 0) - { - labelDescription->setText(""); - return; - } - QListWidgetItem *item = listWidget->item( row ); - if (radioButtonSizeGrowth->isChecked()) - { - if (item->text()==data->HeightName()) - { - QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->height()).arg(tr("Height")); - labelDescription->setText(desc); - } - if (item->text()==data->SizeName()) - { - QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->size()).arg(tr("Size")); - labelDescription->setText(desc); - } - return; - } - if (radioButtonStandardTable->isChecked()) - { - QString name = qApp->VarFromUser(item->text()); - QSharedPointer stable = data->GetVariable(name); - QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetTableValue(name)) - .arg(stable->GetGuiText()); - labelDescription->setText(desc); - return; - } - if (radioButtonIncrements->isChecked()) - { - QSharedPointer incr = data->GetVariable(item->text()); - QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetTableValue(item->text())) - .arg(incr->GetDescription()); - labelDescription->setText(desc); - return; - } - if (radioButtonLengthLine->isChecked()) - { - QString desc = QString("%1(%2) - %3").arg(item->text()) - .arg(*data->GetVariable(qApp->VarFromUser(item->text()))->GetValue()) - .arg(tr("Line length")); - labelDescription->setText(desc); - return; - } - if (radioButtonLengthArc->isChecked()) - { - QString desc = QString("%1(%2) - %3").arg(item->text()) - .arg(*data->GetVariable(qApp->VarFromUser(item->text()))->GetValue()) - .arg(tr("Arc length")); - labelDescription->setText(desc); - return; - } - if (radioButtonLengthCurve->isChecked()) - { - QString desc = QString("%1(%2) - %3").arg(item->text()) - .arg(*data->GetVariable(qApp->VarFromUser(item->text()))->GetValue()) - .arg(tr("Curve length")); - labelDescription->setText(desc); - return; - } - if (radioButtonAngleLine->isChecked()) - { - QString desc = QString("%1(%2) - %3").arg(item->text()) - .arg(*data->GetVariable(qApp->VarFromUser(item->text()))->GetValue()) - .arg(tr("Line Angle")); - labelDescription->setText(desc); - return; - } -} - //--------------------------------------------------------------------------------------------------------------------- // cppcheck-suppress unusedFunction quint32 DialogTool::GetToolId() const @@ -1102,39 +865,6 @@ QString DialogTool::getPointName() const return pointName; } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ShowVariable show variables in list - * @param var container with variables - */ -template -void DialogTool::ShowVariable(const QMap var) -{ - SCASSERT(listWidget != nullptr); - SCASSERT(checkBoxHideEmpty != nullptr); - listWidget->blockSignals(true); - listWidget->clear(); - labelDescription->setText(""); - - QMapIterator iMap(var); - while (iMap.hasNext()) - { - iMap.next(); - if (checkBoxHideEmpty->isEnabled() && checkBoxHideEmpty->isChecked() && iMap.value()->IsNotUsed()) - { - continue; //skip this measurement - } - if (iMap.value()->Filter(toolId) == false) - {// If we create this variable don't show - QListWidgetItem *item = new QListWidgetItem(iMap.key()); - item->setFont(QFont("Times", 12, QFont::Bold)); - listWidget->addItem(item); - } - } - listWidget->blockSignals(false); - listWidget->setCurrentRow (0); -} - //--------------------------------------------------------------------------------------------------------------------- void DialogTool::ShowVisToolTip(const QString &toolTip) { diff --git a/src/app/dialogs/tools/dialogtool.h b/src/app/dialogs/tools/dialogtool.h index 7c56a1858..dd00c108a 100644 --- a/src/app/dialogs/tools/dialogtool.h +++ b/src/app/dialogs/tools/dialogtool.h @@ -111,16 +111,7 @@ public slots: void ArrowRightUp(); void ArrowRightDown(); virtual void EvalFormula(); - void SizeHeight(); - void Measurements(); - void LengthLines(); - void LengthArcs(); - void LengthCurves(); - void AngleLines(); - void Increments(); - void PutHere(); - void PutVal(QListWidgetItem * item); - virtual void ValChenged(int row); + virtual void PointNameChanged(){} protected: Q_DISABLE_COPY(DialogTool) @@ -159,43 +150,16 @@ protected: /** @brief plainTextEditFormula formula */ QPlainTextEdit *plainTextEditFormula; - /** @brief listWidget listWidget with variables */ - QListWidget *listWidget; /** @brief labelResultCalculation label with result of calculation */ QLabel *labelResultCalculation; - /** @brief labelDescription description of variable */ - QLabel *labelDescription; - /** @brief labelEditNamePoint label used when need show wrong name of point */ QLabel *labelEditNamePoint; /** @brief labelEditFormula label used when need show wrong formula */ QLabel *labelEditFormula; - /** @brief radioButtonSizeGrowth radio button for base variables */ - QRadioButton *radioButtonSizeGrowth; - - /** @brief radioButtonStandardTable radio button for standard table variables */ - QRadioButton *radioButtonStandardTable; - - /** @brief radioButtonIncrements radio button for increments variables */ - QRadioButton *radioButtonIncrements; - - /** @brief radioButtonLengthLine radio button for lengths od lines variables */ - QRadioButton *radioButtonLengthLine; - - /** @brief radioButtonLengthArc radio button for lengths of arcs variables */ - QRadioButton *radioButtonLengthArc; - - /** @brief radioButtonLengthCurve radio button for lengths of curves variables */ - QRadioButton *radioButtonLengthCurve; - - QRadioButton *radioButtonAngleLine; - - QCheckBox *checkBoxHideEmpty; - const QColor okColor; const QColor errorColor; /** @@ -227,11 +191,7 @@ protected: virtual void CheckState(); QString GetComboBoxCurrentData(const QComboBox *box)const; - template - void ShowVariable(const QMap var); void ChangeCurrentData(QComboBox *box, const QVariant &value) const; - void PutValHere(QLineEdit *lineEdit, QListWidget *listWidget); - void PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidget); void ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer * timer); void ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer * timer); qreal Eval(const QString &text, bool &flag, QLabel *label, const QString &postfix, @@ -262,41 +222,6 @@ protected: connect(ui->toolButtonArrowRightDown, &QPushButton::clicked, this, &DialogTool::ArrowRightDown); } template - 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; - radioButtonAngleLine = ui->radioButtonAngleLine; - checkBoxHideEmpty = ui->checkBoxHideEmpty; - - connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); - - if (qApp->patternType() == MeasurementsType::Standard) - { - SizeHeight(); - connect(radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeHeight); - } - else - { - radioButtonSizeGrowth->setEnabled(false); - radioButtonStandardTable->setChecked(true); - Measurements(); - } - connect(radioButtonStandardTable, &QRadioButton::clicked, this, &DialogTool::Measurements); - 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); - connect(radioButtonAngleLine, &QRadioButton::clicked, this, &DialogTool::AngleLines); - connect(checkBoxHideEmpty, &QCheckBox::stateChanged, this, &DialogTool::Measurements); - } - template /** * @brief InitOkCancelApply initialise OK / Cancel and Apply buttons * @param ui Dialog container