DialogCutArc change + start code cleaning

--HG--
branch : DialogTools
This commit is contained in:
Patrick Proy 2014-06-09 18:37:11 +02:00
parent be8b8c9c95
commit 26067c3636
26 changed files with 211 additions and 82 deletions

View File

@ -69,9 +69,7 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, QWidget *parent)
//---------------------------------------------------------------------------------------------------------------------
void DialogAlongLine::FormulaTextChanged()
{
// TODO issue #79 : back to FormulaChanged when full update
// Also remove this function if only one function called here
this->FormulaChanged2();
this->FormulaChangedPlainText();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -48,7 +48,7 @@ DialogArc::DialogArc(const VContainer *data, QWidget *parent)
timerF2 = new QTimer(this);
connect(timerF2, &QTimer::timeout, this, &DialogArc::EvalF2);
InitOkCancelApply(ui);
InitOkCancel(ui);
FillComboBoxPoints(ui->comboBoxBasePoint);

View File

@ -70,9 +70,7 @@ DialogBisector::DialogBisector(const VContainer *data, QWidget *parent)
//---------------------------------------------------------------------------------------------------------------------
void DialogBisector::FormulaTextChanged()
{
// TODO issue #79 : back to FormulaChanged when full update
// Also remove this function if only one function called here
this->FormulaChanged2();
this->FormulaChangedPlainText();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -41,7 +41,7 @@ DialogCutArc::DialogCutArc(const VContainer *data, QWidget *parent) :
ui->setupUi(this);
InitVariables(ui);
labelResultCalculation = ui->labelResultCalculation;
lineEditFormula = ui->lineEditFormula;
plainTextEditFormula = ui->plainTextEditFormula;
labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint;
@ -49,6 +49,7 @@ DialogCutArc::DialogCutArc(const VContainer *data, QWidget *parent) :
flagFormula = false;
flagName = false;
CheckState();
this->formulaBaseHeight=ui->plainTextEditFormula->height();
FillComboBoxArcs(ui->comboBoxArc);
@ -57,7 +58,36 @@ DialogCutArc::DialogCutArc(const VContainer *data, QWidget *parent) :
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogCutArc::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutArc::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutArc::FormulaChanged);
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")));
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCutArc::FormulaTextChanged()
{
this->FormulaChangedPlainText();
}
//---------------------------------------------------------------------------------------------------------------------
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")));
}
}
//---------------------------------------------------------------------------------------------------------------------
@ -89,12 +119,25 @@ void DialogCutArc::ChoosedObject(quint32 id, const Valentina::Scenes &type)
*/
void DialogCutArc::DialogAccepted()
{
pointName = ui->lineEditNamePoint->text();
formula = ui->lineEditFormula->text();
arcId = getCurrentObjectId(ui->comboBoxArc);
this->SaveData();
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCutArc::DialogApply()
{
this->SaveData();
emit DialogApplied();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCutArc::SaveData()
{
pointName = ui->lineEditNamePoint->text();
formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n"," ");
arcId = getCurrentObjectId(ui->comboBoxArc);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief setArcId set id of arc
@ -114,7 +157,12 @@ void DialogCutArc::setArcId(const quint32 &value, const quint32 &id)
void DialogCutArc::setFormula(const QString &value)
{
formula = qApp->FormulaToUser(value);
ui->lineEditFormula->setText(formula);
// increase height if needed.
if (formula.length() > 80)
{
this->DeployFormulaTextEdit();
}
ui->plainTextEditFormula->setPlainText(formula);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -31,6 +31,7 @@
#include "dialogtool.h"
#define DIALOGCUTARC_MAX_FORMULA_HEIGHT 64
namespace Ui
{
class DialogCutArc;
@ -55,12 +56,24 @@ public:
public slots:
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
/**
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
virtual void DialogApply();
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
void DeployFormulaTextEdit();
/**
* @brief FormulaTextChanged when formula text changes for validation and calc
*/
void FormulaTextChanged();
private:
Q_DISABLE_COPY(DialogCutArc)
/**
* @brief SaveData Put dialog data in local variables
*/
void SaveData();
/**
* @brief ui keeps information about user interface
*/
@ -77,6 +90,10 @@ private:
* @brief arcId keep id of arc
*/
quint32 arcId;
/**
* @brief formulaBaseHeight base height defined by dialogui
*/
int formulaBaseHeight;
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -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,56 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_formula">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<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.png">
<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_2">
<item>
@ -353,7 +403,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>

View File

@ -39,7 +39,7 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, QWidget *parent)
lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint;
InitOkCancelApply(ui);
InitOkCancel(ui);
flagFormula = false;
flagName = false;

View File

@ -41,7 +41,7 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, QWidget *parent
labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint;
InitOkCancelApply(ui);
InitOkCancel(ui);
flagFormula = false;
flagName = false;
CheckState();

View File

@ -70,9 +70,7 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent)
//---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::FormulaTextChanged()
{
// TODO issue #79 : back to FormulaChanged when full update
// Also remove this function if only one function called here
this->FormulaChanged2();
this->FormulaChangedPlainText();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -38,7 +38,7 @@ DialogHeight::DialogHeight(const VContainer *data, QWidget *parent)
{
ui->setupUi(this);
labelEditNamePoint = ui->labelEditNamePoint;
InitOkCancelApply(ui);
InitOkCancel(ui);
flagName = false;
CheckState();

View File

@ -38,7 +38,7 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, QWidget *parent
{
ui->setupUi(this);
number = 0;
InitOkCancelApply(ui);
InitOkCancel(ui);
labelEditNamePoint = ui->labelEditNamePoint;
flagName = false;

View File

@ -70,9 +70,7 @@ DialogNormal::DialogNormal(const VContainer *data, QWidget *parent)
//---------------------------------------------------------------------------------------------------------------------
void DialogNormal::FormulaTextChanged()
{
// TODO issue #79 : back to FormulaChanged when full update
// Also remove this function if only one function called here
this->FormulaChanged2();
this->FormulaChangedPlainText();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -50,8 +50,10 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *pare
labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint;
this->formulaBaseHeight=ui->plainTextEditFormula->height();
InitOkCancelApply(ui);
/* bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
/* bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
SCASSERT(bOk != nullptr);
connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted);
QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel);
@ -99,9 +101,7 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *pare
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfContact::FormulaTextChanged()
{
// TODO issue #79 : back to FormulaChanged when full update
// Also remove this function if only one function called here
this->FormulaChanged2();
this->FormulaChangedPlainText();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -38,7 +38,7 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, QWi
{
ui->setupUi(this);
labelEditNamePoint = ui->labelEditNamePoint;
InitOkCancelApply(ui);
InitOkCancel(ui);
flagName = false;
CheckState();

View File

@ -70,9 +70,7 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent
//---------------------------------------------------------------------------------------------------------------------
void DialogShoulderPoint::FormulaTextChanged()
{
// TODO issue #79 : back to FormulaChanged when full update
// Also remove this function if only one function called here
this->FormulaChanged2();
this->FormulaChangedPlainText();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -40,7 +40,7 @@ DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent)
ui->doubleSpinBoxX->setRange(0, qApp->fromPixel(SceneSize));
ui->doubleSpinBoxY->setRange(0, qApp->fromPixel(SceneSize));
labelEditNamePoint = ui->labelEditName;
InitOkCancelApply(ui);
InitOkCancel(ui);
flagName = false;
CheckState();

View File

@ -37,7 +37,7 @@ DialogSpline::DialogSpline(const VContainer *data, QWidget *parent)
kAsm1(1), kAsm2(1), kCurve(1)
{
ui->setupUi(this);
InitOkCancelApply(ui);
InitOkCancel(ui);
FillComboBoxPoints(ui->comboBoxP1);
FillComboBoxPoints(ui->comboBoxP4);

View File

@ -37,7 +37,7 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogSplinePath), path(VSplinePath())
{
ui->setupUi(this);
InitOkCancelApply(ui);
InitOkCancel(ui);
bOk->setEnabled(false);
FillComboBoxPoints(ui->comboBoxPoint);

View File

@ -290,7 +290,7 @@ void DialogTool::ChangeCurrentData(QComboBox *box, const quint32 &value) const
}
void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget)
{ // TODO issue #79 : erase this function after all tools updated to plainTextEdit
{
SCASSERT(lineEdit != nullptr);
SCASSERT(listWidget != nullptr);
QListWidgetItem *item = listWidget->currentItem();
@ -324,7 +324,7 @@ void DialogTool::PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidg
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer)
{// TODO issue #79 : erase this function after all tools updated to plainTextEdit
{
SCASSERT(edit != nullptr);
SCASSERT(timer != nullptr);
SCASSERT(labelEditFormula != nullptr);
@ -358,7 +358,7 @@ void DialogTool::ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer *tim
}
void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label)
{ // TODO issue #79 : erase this function after all tools updated to plainTextEdit
{
SCASSERT(edit != nullptr);
SCASSERT(timer != nullptr);
SCASSERT(label != nullptr);
@ -565,9 +565,11 @@ void DialogTool::CheckState()
{
SCASSERT(bOk != nullptr);
bOk->setEnabled(flagFormula && flagName);
SCASSERT(bApply != nullptr);
bApply->setEnabled(flagFormula && flagName);
// In case dialog hasn't apply button
if ( bApply != nullptr)
{
bApply->setEnabled(flagFormula && flagName);
}
}
//---------------------------------------------------------------------------------------------------------------------
@ -617,7 +619,7 @@ void DialogTool::DialogRejected()
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FormulaChanged()
{ // TODO issue #79 : erase after full update of tools.
{
QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
if (edit)
{
@ -625,7 +627,7 @@ void DialogTool::FormulaChanged()
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FormulaChanged2()
void DialogTool::FormulaChangedPlainText()
{
QPlainTextEdit* edit = qobject_cast<QPlainTextEdit*>(sender());
if (edit)

View File

@ -117,10 +117,13 @@ public slots:
*/
virtual void DialogRejected();
/**
* @brief formula check formula
* @brief FormulaChanged check formula (one line input only)
*/
void FormulaChanged();
void FormulaChanged2();
/**
* @brief FormulaChangedPlainText check formula (plain text editor editor)
*/
void FormulaChangedPlainText();
/**
* @brief ArrowUp set angle value 90 degree
*/
@ -475,16 +478,22 @@ protected:
connect(radioButtonLengthCurve, &QRadioButton::clicked, this, &DialogTool::LengthCurves);
}
template <typename T>
/**
* @brief InitOkCancelApply initialise OK / Cancel and Apply buttons
* @param ui Dialog container
*/
void InitOkCancelApply(T *ui)
{
InitOkCancel(ui);
// TODO issue #79
bApply = ui->buttonBox->button(QDialogButtonBox::Apply);
SCASSERT(bApply != nullptr);
connect(bApply, &QPushButton::clicked, this, &DialogTool::DialogApply);
}
//Left this method for dialog what do not need apply button
template <typename T>
/**
* @brief InitOkCancel initialise OK and Cancel buttons
* @param ui Dialog container
*/
void InitOkCancel(T *ui)
{
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);

View File

@ -38,7 +38,7 @@ DialogTriangle::DialogTriangle(const VContainer *data, QWidget *parent)
{
ui->setupUi(this);
labelEditNamePoint = ui->labelEditNamePoint;
InitOkCancelApply(ui);
InitOkCancel(ui);
flagName = false;
CheckState();

View File

@ -35,7 +35,7 @@ DialogUnionDetails::DialogUnionDetails(const VContainer *data, QWidget *parent)
numberP(0), p1(0), p2(0)
{
ui->setupUi(this);
InitOkCancelApply(ui);
InitOkCancel(ui);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -223,7 +223,6 @@ void MainWindow::OptionDraw()
* @param toolTip first tooltipe.
* @param closeDialogSlot function what handle after close dialog.
*/
// TODO Issue 79 : remove function
template <typename Dialog, typename Func>
void MainWindow::SetToolButton(bool checked, Valentina::Tools t, const QString &cursor, const QString &toolTip,
Func closeDialogSlot)
@ -253,10 +252,9 @@ void MainWindow::SetToolButton(bool checked, Valentina::Tools t, const QString &
}
//---------------------------------------------------------------------------------------------------------------------
// TODO Issue 79 : rename to SetToolButton
template <typename Dialog, typename Func, typename Func2>
/**
* @brief SetToolButton set tool and show dialog.
* @brief SetToolButtonWithApply set tool and show dialog.
* @param checked true if tool button checked.
* @param t tool type.
* @param cursor path tool cursor icon.
@ -298,7 +296,7 @@ void MainWindow::SetToolButtonWithApply(bool checked, Valentina::Tools t, const
*/
template <typename DrawTool>
void MainWindow::ClosedDialog(int result)
{// TODO ISSUE 79 : delete
{
SCASSERT(dialogTool != nullptr);
if (result == QDialog::Accepted)
{
@ -309,10 +307,9 @@ void MainWindow::ClosedDialog(int result)
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialog handle close dialog
* @brief ClosedDialogWithApply handle close dialog that has apply button
* @param result result working dialog.
*/
// TODO ISSUE 79 : rename
template <typename DrawTool>
void MainWindow::ClosedDialogWithApply(int result)
{
@ -345,7 +342,7 @@ void MainWindow::ClosedDialogWithApply(int result)
*/
template <typename DrawTool>
void MainWindow::ApplyDialog()
{// TODO ISSUE 79 : copy
{
SCASSERT(dialogTool != nullptr);
// Only create tool if not already created with apply
@ -367,19 +364,17 @@ void MainWindow::ApplyDialog()
* @param checked true - button checked.
*/
void MainWindow::ToolEndLine(bool checked)
{// TODO ISSUE 79 : copy
// SetToolButton<DialogEndLine>(checked, Valentina::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"),
// &MainWindow::ClosedDialogEndLine);
{
SetToolButtonWithApply<DialogEndLine>(checked, Valentina::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"),
&MainWindow::ClosedDialogEndLine,&MainWindow::ApplyDialogEndLine);
}
//---------------------------------------------------------------------------------------------------------------------
/** // TODO ISSUE 79 : copy
/**
* @brief ApplyDialogEndLine actions after apply in DialogEndLine.
*/
void MainWindow::ApplyDialogEndLine()
{ // TODO ISSUE 79 : copy
{
ApplyDialog<VToolEndLine>();
}
@ -458,7 +453,7 @@ void MainWindow::ToolShoulderPoint(bool checked)
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ApplyDialogShoulderPoint actions after apply in DialogEndLine.
* @brief ApplyDialogShoulderPoint actions after apply in DialogShoulderPoint.
*/
void MainWindow::ApplyDialogShoulderPoint()
{
@ -489,7 +484,7 @@ void MainWindow::ToolNormal(bool checked)
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ApplyDialogNormal actions after apply in ApplyDialogNormal.
* @brief ApplyDialogNormal actions after apply in DialogNormal.
*/
void MainWindow::ApplyDialogNormal()
{
@ -816,8 +811,17 @@ void MainWindow::ClosedDialogUnionDetails(int result)
*/
void MainWindow::ToolCutArc(bool checked)
{
SetToolButton<DialogCutArc>(checked, Valentina::CutArcTool, ":/cursor/arc_cut_cursor.png", tr("Select arc"),
&MainWindow::ClosedDialogCutArc);
SetToolButtonWithApply<DialogCutArc>(checked, Valentina::CutArcTool, ":/cursor/arc_cut_cursor.png",
tr("Select arc"), &MainWindow::ClosedDialogCutArc, &MainWindow::ApplyDialogCutArc);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ApplyDialogCutArc actions after apply in DialogCutArc.
*/
void MainWindow::ApplyDialogCutArc()
{
ApplyDialog<VToolCutArc>();
}
//---------------------------------------------------------------------------------------------------------------------
@ -827,7 +831,7 @@ void MainWindow::ToolCutArc(bool checked)
*/
void MainWindow::ClosedDialogCutArc(int result)
{
ClosedDialog<VToolCutArc>(result);
ClosedDialogWithApply<VToolCutArc>(result);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -127,6 +127,7 @@ public slots:
void ClosedDialogUnionDetails(int result);
void ClosedDialogCutSpline(int result);
void ClosedDialogCutArc(int result);
void ApplyDialogCutArc();
void About();
void AboutQt();

View File

@ -77,7 +77,7 @@ void VToolCutArc::setDialog()
}
//---------------------------------------------------------------------------------------------------------------------
void VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VToolCutArc* VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data)
{
SCASSERT(dialog != nullptr);
@ -86,11 +86,17 @@ void VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
const QString pointName = dialogTool->getPointName();
QString formula = dialogTool->getFormula();
const quint32 arcId = dialogTool->getArcId();
Create(0, pointName, formula, arcId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui);
VToolCutArc* point = nullptr;
point=Create(0, pointName, formula, arcId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
}
return point;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolCutArc::Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation)
{
@ -149,7 +155,9 @@ void VToolCutArc::Create(const quint32 _id, const QString &pointName, QString &f
doc->AddTool(arc1id, point);
doc->AddTool(arc2id, point);
doc->IncrementReferens(arcId);
return point;
}
return nullptr;
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -65,7 +65,7 @@ public:
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
static VToolCutArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
@ -80,7 +80,7 @@ public:
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static void Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
static VToolCutArc* Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation);
static const QString ToolType;