From 182e0f42411e405b174cf73159205e807f1c2465 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 29 Apr 2015 20:54:03 +0300 Subject: [PATCH] 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