Refactoring. Delete repetitive code. Replace lineEdit by plainTextEdit.

--HG--
branch : feature
This commit is contained in:
dismine 2014-06-19 12:29:56 +03:00
parent e01b8b2164
commit 1884e302b4
37 changed files with 906 additions and 641 deletions

View file

@ -66,9 +66,6 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, QWidget *parent)
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogAlongLine::DeployFormulaTextEdit);
InitVariables(ui);
connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogTool::PutVal);
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
//---------------------------------------------------------------------------------------------------------------------
@ -80,20 +77,7 @@ void DialogAlongLine::FormulaTextChanged()
//---------------------------------------------------------------------------------------------------------------------
void DialogAlongLine::DeployFormulaTextEdit()
{
if (ui->plainTextEditFormula->height() < DIALOGALONLINE_MAX_FORMULA_HEIGHT)
{
ui->plainTextEditFormula->setFixedHeight(DIALOGALONLINE_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
}
else
{
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -31,7 +31,6 @@
#include "dialogtool.h"
#define DIALOGALONLINE_MAX_FORMULA_HEIGHT 64
namespace Ui
{
class DialogAlongLine;

View file

@ -160,6 +160,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
@ -189,8 +195,7 @@
<string/>
</property>
<property name="icon">
<iconset resource="../../share/resources/theme.qrc">
<normaloff>:/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png</normaloff>:/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png</iconset>
<iconset theme="go-down"/>
</property>
<property name="iconSize">
<size>
@ -468,7 +473,6 @@
</tabstops>
<resources>
<include location="../../share/resources/icon.qrc"/>
<include location="../../share/resources/theme.qrc"/>
</resources>
<connections>
<connection>

View file

@ -44,10 +44,14 @@
DialogArc::DialogArc(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false),
timerRadius(nullptr), timerF1(nullptr), timerF2(nullptr), center(0), radius(QString()), f1(QString()),
f2(QString()), formulaBaseHeight(0)
f2(QString()), formulaBaseHeight(0), formulaBaseHeightF1(0), formulaBaseHeightF2(0)
{
ui->setupUi(this);
InitVariables(ui);
plainTextEditFormula = ui->plainTextEditFormula;
timerRadius = new QTimer(this);
connect(timerRadius, &QTimer::timeout, this, &DialogArc::EvalRadius);
@ -60,13 +64,13 @@ DialogArc::DialogArc(const VContainer *data, QWidget *parent)
InitOkCancelApply(ui);
this->formulaBaseHeight=ui->plainTextEditFormula->height();
this->formulaBaseHeightF1=ui->plainTextEditF1->height();
this->formulaBaseHeightF2=ui->plainTextEditF2->height();
FillComboBoxPoints(ui->comboBoxBasePoint);
CheckState();
InitVariables(ui);
connect(ui->toolButtonPutHereRadius, &QPushButton::clicked, this, &DialogArc::PutRadius);
connect(ui->toolButtonPutHereF1, &QPushButton::clicked, this, &DialogArc::PutF1);
connect(ui->toolButtonPutHereF2, &QPushButton::clicked, this, &DialogArc::PutF2);
@ -76,31 +80,30 @@ DialogArc::DialogArc(const VContainer *data, QWidget *parent)
connect(ui->toolButtonEqualF2, &QPushButton::clicked, this, &DialogArc::EvalF2);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogArc::RadiusChanged);
connect(ui->lineEditF1, &QLineEdit::textChanged, this, &DialogArc::F1Changed);
connect(ui->lineEditF2, &QLineEdit::textChanged, this, &DialogArc::F2Changed);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogArc::DeployFormulaTextEdit);
connect(ui->plainTextEditF1, &QPlainTextEdit::textChanged, this, &DialogArc::F1Changed);
connect(ui->plainTextEditF2, &QPlainTextEdit::textChanged, this, &DialogArc::F2Changed);
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogArc::DeployFormulaTextEdit);
connect(ui->pushButtonGrowLengthF1, &QPushButton::clicked, this, &DialogArc::DeployF1TextEdit);
connect(ui->pushButtonGrowLengthF2, &QPushButton::clicked, this, &DialogArc::DeployF2TextEdit);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::DeployFormulaTextEdit()
{
if (ui->plainTextEditFormula->height() < DIALOGARC_MAX_FORMULA_HEIGHT)
{
ui->plainTextEditFormula->setFixedHeight(DIALOGARC_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
}
else
{
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::DeployF1TextEdit()
{
DeployFormula(ui->plainTextEditF1, ui->pushButtonGrowLengthF1, formulaBaseHeightF1);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::DeployF2TextEdit()
{
DeployFormula(ui->plainTextEditF2, ui->pushButtonGrowLengthF2, formulaBaseHeightF2);
}
//---------------------------------------------------------------------------------------------------------------------
@ -127,8 +130,13 @@ void DialogArc::SetCenter(const quint32 &value)
*/
void DialogArc::SetF2(const QString &value)
{
f2 = value;
ui->lineEditF2->setText(f2);
f2 = qApp->FormulaToUser(value);
// increase height if needed.
if (f2.length() > 80)
{
this->DeployF2TextEdit();
}
ui->plainTextEditF2->setPlainText(f2);
}
//---------------------------------------------------------------------------------------------------------------------
@ -138,8 +146,13 @@ void DialogArc::SetF2(const QString &value)
*/
void DialogArc::SetF1(const QString &value)
{
f1 = value;
ui->lineEditF1->setText(f1);
f1 = qApp->FormulaToUser(value);
// increase height if needed.
if (f1.length() > 80)
{
this->DeployF1TextEdit();
}
ui->plainTextEditF1->setPlainText(f1);
}
//---------------------------------------------------------------------------------------------------------------------
@ -197,8 +210,10 @@ void DialogArc::SaveData()
{
radius = ui->plainTextEditFormula->toPlainText();
radius.replace("\n", " ");
f1 = ui->lineEditF1->text();
f2 = ui->lineEditF2->text();
f1 = ui->plainTextEditF1->toPlainText();
f1.replace("\n", " ");
f2 = ui->plainTextEditF2->toPlainText();
f2.replace("\n", " ");
center = getCurrentObjectId(ui->comboBoxBasePoint);
}
@ -239,7 +254,7 @@ void DialogArc::PutRadius()
*/
void DialogArc::PutF1()
{
PutValHere(ui->lineEditF1, ui->listWidget);
PutValHere(ui->plainTextEditF1, ui->listWidget);
}
//---------------------------------------------------------------------------------------------------------------------
@ -248,7 +263,7 @@ void DialogArc::PutF1()
*/
void DialogArc::PutF2()
{
PutValHere(ui->lineEditF2, ui->listWidget);
PutValHere(ui->plainTextEditF2, ui->listWidget);
}
//---------------------------------------------------------------------------------------------------------------------
@ -278,7 +293,7 @@ void DialogArc::RadiusChanged()
void DialogArc::F1Changed()
{
labelEditFormula = ui->labelEditF1;
ValFormulaChanged(flagF1, ui->lineEditF1, timerF1);
ValFormulaChanged(flagF1, ui->plainTextEditF1, timerF1);
}
//---------------------------------------------------------------------------------------------------------------------
@ -288,7 +303,7 @@ void DialogArc::F1Changed()
void DialogArc::F2Changed()
{
labelEditFormula = ui->labelEditF2;
ValFormulaChanged(flagF2, ui->lineEditF2, timerF2);
ValFormulaChanged(flagF2, ui->plainTextEditF2, timerF2);
}
//---------------------------------------------------------------------------------------------------------------------
@ -320,7 +335,7 @@ void DialogArc::EvalRadius()
void DialogArc::EvalF1()
{
labelEditFormula = ui->labelEditF1;
Eval(ui->lineEditF1->text(), flagF1, timerF1, ui->labelResultF1);
Eval(ui->plainTextEditF1->toPlainText(), flagF1, timerF1, ui->labelResultF1);
}
//---------------------------------------------------------------------------------------------------------------------
@ -330,7 +345,7 @@ void DialogArc::EvalF1()
void DialogArc::EvalF2()
{
labelEditFormula = ui->labelEditF2;
Eval(ui->lineEditF2->text(), flagF2, timerF2, ui->labelResultF2);
Eval(ui->plainTextEditF2->toPlainText(), flagF2, timerF2, ui->labelResultF2);
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -31,7 +31,6 @@
#include "dialogtool.h"
#define DIALOGARC_MAX_FORMULA_HEIGHT 64
namespace Ui
{
class DialogArc;
@ -69,6 +68,8 @@ public slots:
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
void DeployFormulaTextEdit();
void DeployF1TextEdit();
void DeployF2TextEdit();
virtual void ValChenged(int row);
void PutRadius();
void PutF1();
@ -118,6 +119,8 @@ private:
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight;
int formulaBaseHeightF1;
int formulaBaseHeightF2;
void EvalRadius();
void EvalF1();

View file

@ -23,9 +23,6 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QLabel" name="labelEditRadius">
<property name="sizePolicy">
@ -77,50 +74,17 @@
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="maximumSize">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16777215</width>
<height>24</height>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonGrowLength">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="go-down.png">
<normaloff/>
</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHereRadius">
@ -186,6 +150,60 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonGrowLength">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="go-down"/>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
@ -239,17 +257,17 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditF1">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="toolTip">
<string>First angle of arc counterclockwise</string>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHereF1">
@ -315,6 +333,60 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QPlainTextEdit" name="plainTextEditF1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonGrowLengthF1">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="go-down"/>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
@ -368,17 +440,17 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditF2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="toolTip">
<string>Second angle of arc counterclockwise</string>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHereF2">
@ -444,6 +516,60 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QPlainTextEdit" name="plainTextEditF2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonGrowLengthF2">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="go-down"/>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
@ -623,8 +749,6 @@
</layout>
</widget>
<tabstops>
<tabstop>lineEditF1</tabstop>
<tabstop>lineEditF2</tabstop>
<tabstop>comboBoxBasePoint</tabstop>
<tabstop>radioButtonSizeGrowth</tabstop>
<tabstop>radioButtonStandardTable</tabstop>

View file

@ -68,9 +68,6 @@ DialogBisector::DialogBisector(const VContainer *data, QWidget *parent)
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogBisector::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogBisector::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogBisector::DeployFormulaTextEdit);
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
//---------------------------------------------------------------------------------------------------------------------
@ -82,20 +79,7 @@ void DialogBisector::FormulaTextChanged()
//---------------------------------------------------------------------------------------------------------------------
void DialogBisector::DeployFormulaTextEdit()
{
if (ui->plainTextEditFormula->height() < DIALOGBISECTOR_MAX_FORMULA_HEIGHT)
{
ui->plainTextEditFormula->setFixedHeight(DIALOGBISECTOR_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
}
else
{
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -31,7 +31,6 @@
#include "dialogtool.h"
#define DIALOGBISECTOR_MAX_FORMULA_HEIGHT 64
namespace Ui
{
class DialogBisector;

View file

@ -151,6 +151,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_formula">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
@ -180,7 +186,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="go-down.png"/>
<iconset theme="go-down"/>
</property>
<property name="iconSize">
<size>

View file

@ -64,9 +64,6 @@ DialogCutArc::DialogCutArc(const VContainer *data, QWidget *parent)
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutArc::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogCutArc::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogCutArc::DeployFormulaTextEdit);
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
//---------------------------------------------------------------------------------------------------------------------
@ -78,20 +75,7 @@ void DialogCutArc::FormulaTextChanged()
//---------------------------------------------------------------------------------------------------------------------
void DialogCutArc::DeployFormulaTextEdit()
{
if (ui->plainTextEditFormula->height() < DIALOGCUTARC_MAX_FORMULA_HEIGHT)
{
ui->plainTextEditFormula->setFixedHeight(DIALOGCUTARC_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
}
else
{
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -31,7 +31,6 @@
#include "dialogtool.h"
#define DIALOGCUTARC_MAX_FORMULA_HEIGHT 64
namespace Ui
{
class DialogCutArc;

View file

@ -144,6 +144,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_formula">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
@ -173,9 +179,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="go-down.png">
<normaloff/>
</iconset>
<iconset theme="go-down"/>
</property>
<property name="iconSize">
<size>

View file

@ -39,12 +39,13 @@
* @param parent parent widget
*/
DialogCutSpline::DialogCutSpline(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogCutSpline), pointName(QString()), formula(QString()), splineId(0)
:DialogTool(data, parent), ui(new Ui::DialogCutSpline), pointName(QString()), formula(QString()), splineId(0),
formulaBaseHeight(0)
{
ui->setupUi(this);
InitVariables(ui);
labelResultCalculation = ui->labelResultCalculation;
lineEditFormula = ui->lineEditFormula;
plainTextEditFormula = ui->plainTextEditFormula;
labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint;
InitOkCancel(ui);
@ -53,13 +54,16 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, QWidget *parent)
flagName = false;
CheckState();
this->formulaBaseHeight=ui->plainTextEditFormula->height();
FillComboBoxSplines(ui->comboBoxSpline);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSpline::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSpline::PutVal);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogCutSpline::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSpline::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutSpline::FormulaChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogCutSpline::FormulaChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogCutSpline::DeployFormulaTextEdit);
}
//---------------------------------------------------------------------------------------------------------------------
@ -87,7 +91,13 @@ void DialogCutSpline::setPointName(const QString &value)
void DialogCutSpline::setFormula(const QString &value)
{
formula = qApp->FormulaToUser(value);
ui->lineEditFormula->setText(formula);
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formula.length() > 80)
{
this->DeployFormulaTextEdit();
}
ui->plainTextEditFormula->setPlainText(formula);
}
//---------------------------------------------------------------------------------------------------------------------
@ -125,7 +135,14 @@ void DialogCutSpline::ChoosedObject(quint32 id, const SceneObject &type)
void DialogCutSpline::DialogAccepted()
{
pointName = ui->lineEditNamePoint->text();
formula = ui->lineEditFormula->text();
formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n", " ");
splineId = getCurrentObjectId(ui->comboBoxSpline);
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCutSpline::DeployFormulaTextEdit()
{
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}

View file

@ -61,6 +61,10 @@ public slots:
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
void DeployFormulaTextEdit();
private:
Q_DISABLE_COPY(DialogCutSpline)
@ -75,6 +79,9 @@ private:
/** @brief splineId keep id of spline */
quint32 splineId;
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight;
};
//---------------------------------------------------------------------------------------------------------------------

View file

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>520</width>
<width>665</width>
<height>546</height>
</rect>
</property>
@ -67,17 +67,17 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="toolTip">
<string>Formula for the calculation of the spline</string>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHere">
@ -140,6 +140,60 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonGrowLength">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="go-down"/>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>

View file

@ -40,12 +40,12 @@
*/
DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogCutSplinePath), pointName(QString()), formula(QString()),
splinePathId(0)
splinePathId(0), formulaBaseHeight(0)
{
ui->setupUi(this);
InitVariables(ui);
labelResultCalculation = ui->labelResultCalculation;
lineEditFormula = ui->lineEditFormula;
plainTextEditFormula = ui->plainTextEditFormula;
labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint;
@ -53,6 +53,7 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, QWidget *parent
flagFormula = false;
flagName = false;
CheckState();
this->formulaBaseHeight=ui->plainTextEditFormula->height();
FillComboBoxSplinesPath(ui->comboBoxSplinePath);
@ -60,7 +61,8 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, QWidget *parent
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSplinePath::PutVal);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogCutSplinePath::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSplinePath::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutSplinePath::FormulaChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogCutSplinePath::FormulaChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogCutSplinePath::DeployFormulaTextEdit);
}
//---------------------------------------------------------------------------------------------------------------------
@ -88,7 +90,13 @@ void DialogCutSplinePath::setPointName(const QString &value)
void DialogCutSplinePath::setFormula(const QString &value)
{
formula = qApp->FormulaToUser(value);
ui->lineEditFormula->setText(formula);
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formula.length() > 80)
{
this->DeployFormulaTextEdit();
}
ui->plainTextEditFormula->setPlainText(formula);
}
//---------------------------------------------------------------------------------------------------------------------
@ -126,7 +134,14 @@ void DialogCutSplinePath::ChoosedObject(quint32 id, const SceneObject &type)
void DialogCutSplinePath::DialogAccepted()
{
pointName = ui->lineEditNamePoint->text();
formula = ui->lineEditFormula->text();
formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n", " ");
splinePathId = getCurrentObjectId(ui->comboBoxSplinePath);
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCutSplinePath::DeployFormulaTextEdit()
{
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}

View file

@ -61,6 +61,10 @@ public slots:
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
void DeployFormulaTextEdit();
private:
Q_DISABLE_COPY(DialogCutSplinePath)
@ -75,6 +79,9 @@ private:
/** @brief splinePathId keep id of splinePath */
quint32 splinePathId;
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight;
};
//---------------------------------------------------------------------------------------------------------------------

View file

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>605</width>
<width>464</width>
<height>499</height>
</rect>
</property>
@ -67,17 +67,17 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="toolTip">
<string>Formula for the calculation of the curve length</string>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHere">
@ -140,6 +140,60 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonGrowLength">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="go-down"/>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>

View file

@ -31,24 +31,26 @@
//---------------------------------------------------------------------------------------------------------------------
DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogEditWrongFormula), formula(QString())
:DialogTool(data, parent), ui(new Ui::DialogEditWrongFormula), formula(QString()), formulaBaseHeight(0)
{
ui->setupUi(this);
InitVariables(ui);
labelResultCalculation = ui->labelResult;
lineEditFormula = ui->lineEditFormula;
plainTextEditFormula = ui->plainTextEditFormula;
labelEditFormula = ui->labelFormula;
InitOkCancel(ui);
flagFormula = false;
CheckState();
this->formulaBaseHeight=ui->plainTextEditFormula->height();
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogEditWrongFormula::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogEditWrongFormula::PutVal);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogEditWrongFormula::EvalFormula);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogEditWrongFormula::FormulaChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogEditWrongFormula::FormulaChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogEditWrongFormula::DeployFormulaTextEdit);
//Disable Qt::WaitCursor
#ifndef QT_NO_CURSOR
@ -68,7 +70,8 @@ DialogEditWrongFormula::~DialogEditWrongFormula()
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::DialogAccepted()
{
formula = ui->lineEditFormula->text();
formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n", " ");
emit DialogClosed(QDialog::Accepted);
accepted();
}
@ -80,6 +83,12 @@ void DialogEditWrongFormula::DialogRejected()
rejected();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::DeployFormulaTextEdit()
{
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::CheckState()
{
@ -91,7 +100,13 @@ void DialogEditWrongFormula::CheckState()
void DialogEditWrongFormula::setFormula(const QString &value)
{
formula = qApp->FormulaToUser(value);
ui->lineEditFormula->setText(formula);
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formula.length() > 80)
{
this->DeployFormulaTextEdit();
}
ui->plainTextEditFormula->setPlainText(formula);
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -56,6 +56,10 @@ public:
public slots:
virtual void DialogAccepted();
virtual void DialogRejected();
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
void DeployFormulaTextEdit();
protected:
virtual void CheckState();
private:
@ -64,6 +68,9 @@ private:
/** @brief formula string with formula */
QString formula;
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight;
};

View file

@ -6,305 +6,357 @@
<rect>
<x>0</x>
<y>0</y>
<width>607</width>
<width>507</width>
<height>535</height>
</rect>
</property>
<property name="windowTitle">
<string>Edit wrong formula</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="labelFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Formula</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>First angle of arc counterclockwise</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHere">
<property name="toolTip">
<string>Insert variable into formula</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/putHereLeft.png</normaloff>:/icon/24x24/putHereLeft.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonEqual">
<property name="toolTip">
<string>Calculate value</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/equal.png</normaloff>:/icon/24x24/equal.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelResult">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>87</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Value of first angle</string>
</property>
<property name="text">
<string>_</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Input data</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonSizeGrowth">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Size and height</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonStandardTable">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Standard table</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonIncrements">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Increments</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonLengthLine">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Length of lines</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonLengthArc">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Length of arcs</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonLengthSpline">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Length of curves</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonLineAngles">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Angle of lines</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>Variables</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="labelDescription">
<property name="text">
<string/>
<widget class="QLabel" name="labelFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="wordWrap">
<bool>true</bool>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Formula</string>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHere">
<property name="toolTip">
<string>Insert variable into formula</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/putHereLeft.png</normaloff>:/icon/24x24/putHereLeft.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonEqual">
<property name="toolTip">
<string>Calculate value</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/equal.png</normaloff>:/icon/24x24/equal.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelResult">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>87</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Value of first angle</string>
</property>
<property name="text">
<string>_</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonGrowLength">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="go-down">
<normaloff/>
</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Input data</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonSizeGrowth">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Size and height</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonStandardTable">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Standard table</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonIncrements">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Increments</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonLengthLine">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Length of lines</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonLengthArc">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Length of arcs</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonLengthSpline">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Length of curves</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonLineAngles">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Angle of lines</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>Variables</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="labelDescription">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>

View file

@ -67,10 +67,6 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent)
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogEndLine::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogEndLine::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogEndLine::DeployFormulaTextEdit);
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
//---------------------------------------------------------------------------------------------------------------------
@ -82,20 +78,7 @@ void DialogEndLine::FormulaTextChanged()
//---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::DeployFormulaTextEdit()
{
if (ui->plainTextEditFormula->height() < DIALOGENDLINE_MAX_FORMULA_HEIGHT)
{
ui->plainTextEditFormula->setFixedHeight(DIALOGENDLINE_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
}
else
{
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -31,8 +31,6 @@
#include "dialogtool.h"
#define DIALOGENDLINE_MAX_FORMULA_HEIGHT 64
namespace Ui
{
class DialogEndLine;

View file

@ -189,8 +189,7 @@
<string/>
</property>
<property name="icon">
<iconset resource="../../share/resources/theme.qrc">
<normaloff>:/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png</normaloff>:/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png</iconset>
<iconset theme="go-down"/>
</property>
<property name="iconSize">
<size>
@ -677,7 +676,6 @@
</tabstops>
<resources>
<include location="../../share/resources/icon.qrc"/>
<include location="../../share/resources/theme.qrc"/>
</resources>
<connections>
<connection>

View file

@ -65,9 +65,6 @@ DialogNormal::DialogNormal(const VContainer *data, QWidget *parent)
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogNormal::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogNormal::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogNormal::DeployFormulaTextEdit);
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
//---------------------------------------------------------------------------------------------------------------------
@ -79,18 +76,7 @@ void DialogNormal::FormulaTextChanged()
//---------------------------------------------------------------------------------------------------------------------
void DialogNormal::DeployFormulaTextEdit()
{
if (ui->plainTextEditFormula->height() < DIALOGNORMAL_MAX_FORMULA_HEIGHT)
{
ui->plainTextEditFormula->setFixedHeight(DIALOGNORMAL_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next"));
}
else
{
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down"));
}
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -31,7 +31,6 @@
#include "dialogtool.h"
#define DIALOGNORMAL_MAX_FORMULA_HEIGHT 64
namespace Ui
{
class DialogNormal;

View file

@ -154,6 +154,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_formula">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
@ -183,9 +189,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="go-down.png">
<normaloff/>
</iconset>
<iconset theme="go-down"/>
</property>
<property name="iconSize">
<size>

View file

@ -97,9 +97,6 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *pare
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfContact::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogPointOfContact::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogPointOfContact::DeployFormulaTextEdit);
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
//---------------------------------------------------------------------------------------------------------------------
@ -111,20 +108,7 @@ void DialogPointOfContact::FormulaTextChanged()
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfContact::DeployFormulaTextEdit()
{
if (ui->plainTextEditFormula->height() < DIALOGPOINTOFCONTACT_MAX_FORMULA_HEIGHT)
{
ui->plainTextEditFormula->setFixedHeight(DIALOGPOINTOFCONTACT_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
}
else
{
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -32,7 +32,6 @@
#include "ui_dialogpointofcontact.h"
#include "dialogtool.h"
#define DIALOGPOINTOFCONTACT_MAX_FORMULA_HEIGHT 64
namespace Ui
{
class DialogPointOfContact;

View file

@ -154,6 +154,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_formula">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
@ -183,9 +189,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="go-down.png">
<normaloff/>
</iconset>
<iconset theme="go-down"/>
</property>
<property name="iconSize">
<size>

View file

@ -68,9 +68,6 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogShoulderPoint::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogShoulderPoint::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogShoulderPoint::DeployFormulaTextEdit);
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
//---------------------------------------------------------------------------------------------------------------------
@ -82,20 +79,7 @@ void DialogShoulderPoint::FormulaTextChanged()
//---------------------------------------------------------------------------------------------------------------------
void DialogShoulderPoint::DeployFormulaTextEdit()
{
if (ui->plainTextEditFormula->height() < DIALOGSHOULDERPOINT_MAX_FORMULA_HEIGHT)
{
ui->plainTextEditFormula->setFixedHeight(DIALOGSHOULDERPOINT_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
}
else
{
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -31,7 +31,6 @@
#include "dialogtool.h"
#define DIALOGSHOULDERPOINT_MAX_FORMULA_HEIGHT 64
namespace Ui
{
class DialogShoulderPoint;

View file

@ -154,6 +154,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_formula">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
@ -183,9 +189,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="go-down.png">
<normaloff/>
</iconset>
<iconset theme="go-down"/>
</property>
<property name="iconSize">
<size>

View file

@ -41,7 +41,6 @@
#include <QShowEvent>
#include <QComboBox>
#include <QListWidgetItem>
#include <QLineEdit>
#include <QTextCursor>
#include <QPlainTextEdit>
#include <QLabel>
@ -51,6 +50,8 @@
#include <QListWidget>
#include <QRadioButton>
#define DIALOGARC_MAX_FORMULA_HEIGHT 64
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogTool create dialog
@ -59,7 +60,7 @@
*/
DialogTool::DialogTool(const VContainer *data, QWidget *parent)
:QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), timerFormula(nullptr),
bOk(nullptr), bApply(nullptr), spinBoxAngle(nullptr), lineEditFormula(nullptr), plainTextEditFormula(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),
@ -385,12 +386,6 @@ void DialogTool::PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidg
QTextCursor cursor = plainTextEdit->textCursor();
cursor.insertText(item->text());
plainTextEdit->setTextCursor(cursor);
/*
int pos = lineEdit->cursorPosition();
lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text()));
lineEdit->setFocus();
lineEdit->setCursorPosition(pos + item->text().size());
*/
}
//---------------------------------------------------------------------------------------------------------------------
@ -601,6 +596,27 @@ bool DialogTool::ChoosedPoint(const quint32 &id, QComboBox *box, const QString &
return false;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::DeployFormula(QPlainTextEdit *formula, QPushButton *buttonGrowLength, int formulaBaseHeight)
{
SCASSERT(formula != nullptr);
SCASSERT(buttonGrowLength != nullptr)
if (formula->height() < DIALOGARC_MAX_FORMULA_HEIGHT)
{
formula->setFixedHeight(DIALOGARC_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system)
buttonGrowLength->setIcon(QIcon::fromTheme("go-next",
QIcon(":/icons/win.icon.theme/16x16/actions/go-next.png")));
}
else
{
formula->setFixedHeight(formulaBaseHeight);
//Set icon from theme (internal for Windows system)
buttonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/16x16/actions/go-down.png")));
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief FillList fill combobox list
@ -700,7 +716,7 @@ void DialogTool::DialogRejected()
*/
void DialogTool::FormulaChanged()
{
QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
QPlainTextEdit* edit = qobject_cast<QPlainTextEdit*>(sender());
if (edit)
{
ValFormulaChanged(flagFormula, edit, timerFormula);
@ -897,12 +913,6 @@ void DialogTool::PutVal(QListWidgetItem *item)
QTextCursor cursor = plainTextEditFormula->textCursor();
cursor.insertText(item->text());
plainTextEditFormula->setTextCursor(cursor);
/*int pos = plainTextEditFormula->cursorPosition();
lineEditFormula->setText(lineEditFormula->text().insert(lineEditFormula->cursorPosition(),
item->text()));
lineEditFormula->setFocus();
lineEditFormula->setCursorPosition(pos + item->text().size());
*/
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -39,7 +39,6 @@ class QLabel;
class QRadioButton;
class QComboBox;
class QListWidgetItem;
class QLineEdit;
class QListWidget;
class VContainer;
class QPlainTextEdit;
@ -134,8 +133,7 @@ protected:
/** @brief spinBoxAngle spinbox for angle */
QDoubleSpinBox *spinBoxAngle;
/** @brief lineEditFormula linEdit for formula */
QLineEdit *lineEditFormula;
/** @brief plainTextEditFormula formula */
QPlainTextEdit *plainTextEditFormula;
/** @brief listWidget listWidget with variables */
QListWidget *listWidget;
@ -205,6 +203,7 @@ protected:
ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline) const;
quint32 getCurrentObjectId(QComboBox *box) const;
bool ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip);
void DeployFormula(QPlainTextEdit *formula, QPushButton *buttonGrowLength, int formulaBaseHeight);
template <typename T>
void InitArrow(T *ui)
{

View file

@ -40,5 +40,8 @@
<file alias="24x24/actions/edit-redo.png">icons/win.icon.theme/24x24/actions/edit-redo.png</file>
<file alias="32x32/actions/edit-redo.png">icons/win.icon.theme/32x32/actions/edit-redo.png</file>
<file alias="32x32/actions/edit-undo.png">icons/win.icon.theme/32x32/actions/edit-undo.png</file>
<file alias="16x16/actions/go-down.png">icons/win.icon.theme/16x16/actions/go-down.png</file>
<file alias="24x24/actions/go-down.png">icons/win.icon.theme/24x24/actions/go-down.png</file>
<file alias="32x32/actions/go-down.png">icons/win.icon.theme/32x32/actions/go-down.png</file>
</qresource>
</RCC>

View file

@ -164,41 +164,51 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QSt
VSplinePath *splPath1 = new VSplinePath();
VSplinePath *splPath2 = new VSplinePath();
for (qint32 i = 0; i < splPath->CountPoint(); i++)
{
if (i <= p1 && i < p2)
{
if (i == p1)
{
splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1()+180, spl1.GetKasm1(),
spl1.GetAngle1()));
VSplinePoint cutPoint;
if (typeCreation == Source::FromGui)
{
cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2(), spl1.GetAngle2()+180,
spl1.GetAngle2());
}
else
{
cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2(), spl2.GetKasm1(),
spl1.GetAngle2()+180);
}
splPath1->append(cutPoint);
continue;
}
splPath1->append(splPath->at(i));
}
else
{
if (i == p2)
{
const VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1()+180,
spl2.GetKasm1(), spl2.GetAngle1());
splPath2->append(cutPoint);
splPath2->append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetAngle2(), splP2.KAsm2(),
spl2.GetAngle2()+180));
continue;
}
splPath2->append(splPath->at(i));
}
}
splPath1->setMaxCountPoints(splPath->CountPoint());
splPath2->setMaxCountPoints(splPath->CountPoint());
if (typeCreation == Source::FromGui)
{
for (qint32 i = 0; i < splPath->CountPoint(); i++)
{
if (i <= p1 && i < p2)
{
if (i == p1)
{
splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1()+180, spl1.GetKasm1(),
spl1.GetAngle1()));
const VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2(),
spl1.GetAngle2()+180, spl1.GetAngle2());
splPath1->append(cutPoint);
continue;
}
splPath1->append(splPath->at(i));
}
else
{
if (i == p2)
{
const VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1()+180,
spl2.GetKasm1(), spl2.GetAngle1());
splPath2->append(cutPoint);
splPath2->append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetAngle2(), splP2.KAsm2(),
spl2.GetAngle2()+180));
continue;
}
splPath2->append(splPath->at(i));
}
}
splPath1->setMaxCountPoints(splPath->CountPoint());
splPath2->setMaxCountPoints(splPath->CountPoint());
splPath1id = data->AddGObject(splPath1);
data->AddLengthSpline(splPath1->name(), qApp->fromPixel(splPath1->GetLength()));
@ -207,39 +217,6 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QSt
}
else
{
for (qint32 i = 0; i < splPath->CountPoint(); i++)
{
if (i <= p1 && i < p2)
{
if (i == p1)
{
splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1()+180, spl1.GetKasm1(),
spl1.GetAngle1()));
const VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2(),
spl2.GetKasm1(), spl1.GetAngle2()+180);
splPath1->append(cutPoint);
continue;
}
splPath1->append(splPath->at(i));
}
else
{
if (i == p2)
{
const VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1()+180,
spl2.GetKasm1(), spl2.GetAngle1());
splPath2->append(cutPoint);
splPath2->append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetAngle2(), splP2.KAsm2(),
spl2.GetAngle2()+180));
continue;
}
splPath2->append(splPath->at(i));
}
}
splPath1->setMaxCountPoints(splPath->CountPoint());
splPath2->setMaxCountPoints(splPath->CountPoint());
data->UpdateGObject(splPath1id, splPath1);
data->AddLengthSpline(splPath1->name(), qApp->fromPixel(splPath1->GetLength()));
@ -251,6 +228,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QSt
doc->UpdateToolData(id, data);
}
}
VDrawTool::AddRecord(id, Tool::CutSplinePathTool, doc);
if (parse == Document::FullParse)
{