From 483b9c28bab540b1477f29f62a558b83e0d2a15d Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 29 Apr 2015 21:11:17 +0300 Subject: [PATCH] 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