diff --git a/src/app/dialogs/tools/dialogendline.cpp b/src/app/dialogs/tools/dialogendline.cpp index 580db8ebe..3f341ab32 100644 --- a/src/app/dialogs/tools/dialogendline.cpp +++ b/src/app/dialogs/tools/dialogendline.cpp @@ -43,7 +43,6 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent) labelEditFormula = ui->labelEditFormula; labelEditNamePoint = ui->labelEditNamePoint; - // TODO : auto extend height on first value length. this->formulaBaseHeight=ui->plainTextEditFormula->height(); InitOkCancelApply(ui); diff --git a/src/app/dialogs/tools/dialogline.cpp b/src/app/dialogs/tools/dialogline.cpp index 7e15ab494..0e7512024 100644 --- a/src/app/dialogs/tools/dialogline.cpp +++ b/src/app/dialogs/tools/dialogline.cpp @@ -36,7 +36,7 @@ DialogLine::DialogLine(const VContainer *data, QWidget *parent) :DialogTool(data, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0), typeLine(QString()) { ui->setupUi(this); - InitOkCancelApply(ui); + InitOkCancel(ui); FillComboBoxPoints(ui->comboBoxFirstPoint); FillComboBoxPoints(ui->comboBoxSecondPoint); diff --git a/src/app/dialogs/tools/dialogpointofcontact.cpp b/src/app/dialogs/tools/dialogpointofcontact.cpp index 57d3dedab..fd3de2f51 100644 --- a/src/app/dialogs/tools/dialogpointofcontact.cpp +++ b/src/app/dialogs/tools/dialogpointofcontact.cpp @@ -32,60 +32,95 @@ //--------------------------------------------------------------------------------------------------------------------- DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(), number(0), pointName(QString()), radius(QString()), center(0), + :DialogTool(data, parent), ui(new Ui::DialogPointOfContact), number(0), pointName(QString()), radius(QString()), center(0), firstPoint(0), secondPoint(0) { - ui.setupUi(this); - listWidget = ui.listWidget; - labelResultCalculation = ui.labelResultCalculation; - labelDescription = ui.labelDescription; - radioButtonSizeGrowth = ui.radioButtonSizeGrowth; - radioButtonStandardTable = ui.radioButtonStandardTable; - radioButtonIncrements = ui.radioButtonIncrements; - radioButtonLengthLine = ui.radioButtonLengthLine; - radioButtonLengthArc = ui.radioButtonLengthArc; - radioButtonLengthCurve = ui.radioButtonLengthSpline; - lineEditFormula = ui.lineEditFormula; - labelEditFormula = ui.labelEditFormula; - labelEditNamePoint = ui.labelEditNamePoint; + ui->setupUi(this); + InitVariables(ui); + listWidget = ui->listWidget; + labelResultCalculation = ui->labelResultCalculation; + labelDescription = ui->labelDescription; + radioButtonSizeGrowth = ui->radioButtonSizeGrowth; + radioButtonStandardTable = ui->radioButtonStandardTable; + radioButtonIncrements = ui->radioButtonIncrements; + radioButtonLengthLine = ui->radioButtonLengthLine; + radioButtonLengthArc = ui->radioButtonLengthArc; + radioButtonLengthCurve = ui->radioButtonLengthSpline; + plainTextEditFormula = ui->plainTextEditFormula; + labelEditFormula = ui->labelEditFormula; + labelEditNamePoint = ui->labelEditNamePoint; - bOk = ui.buttonBox->button(QDialogButtonBox::Ok); + InitOkCancelApply(ui); +/* bOk = ui.buttonBox->button(QDialogButtonBox::Ok); SCASSERT(bOk != nullptr); connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted); QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel); SCASSERT(bCansel != nullptr); connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected); - +*/ flagFormula = false; flagName = false; CheckState(); - FillComboBoxPoints(ui.comboBoxCenter); - FillComboBoxPoints(ui.comboBoxFirstPoint); - FillComboBoxPoints(ui.comboBoxSecondPoint); + FillComboBoxPoints(ui->comboBoxCenter); + FillComboBoxPoints(ui->comboBoxFirstPoint); + FillComboBoxPoints(ui->comboBoxSecondPoint); - connect(ui.toolButtonPutHere, &QPushButton::clicked, this, &DialogPointOfContact::PutHere); - connect(ui.listWidget, &QListWidget::itemDoubleClicked, this, &DialogPointOfContact::PutVal); - connect(ui.listWidget, &QListWidget::currentRowChanged, this, &DialogPointOfContact::ValChenged); + connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogPointOfContact::PutHere); + connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogPointOfContact::PutVal); + connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogPointOfContact::ValChenged); if (qApp->patternType() == Pattern::Standard) { SizeHeight(); - connect(ui.radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeHeight); + connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeHeight); } else { radioButtonSizeGrowth->setVisible(false); Measurements(); } - connect(ui.radioButtonStandardTable, &QRadioButton::clicked, this, &DialogPointOfContact::Measurements); - connect(ui.radioButtonIncrements, &QRadioButton::clicked, this, &DialogPointOfContact::Increments); - connect(ui.radioButtonLengthLine, &QRadioButton::clicked, this, &DialogPointOfContact::LengthLines); - connect(ui.radioButtonLengthArc, &QRadioButton::clicked, this, &DialogPointOfContact::LengthArcs); - connect(ui.radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogPointOfContact::LengthCurves); - connect(ui.toolButtonEqual, &QPushButton::clicked, this, &DialogPointOfContact::EvalFormula); - connect(ui.lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfContact::NamePointChanged); - connect(ui.lineEditFormula, &QLineEdit::textChanged, this, &DialogPointOfContact::FormulaChanged); + connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogPointOfContact::Measurements); + connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogPointOfContact::Increments); + connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogPointOfContact::LengthLines); + connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogPointOfContact::LengthArcs); + connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogPointOfContact::LengthCurves); + connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogPointOfContact::EvalFormula); + 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"))); +} + + + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPointOfContact::FormulaTextChanged() +{ + // TODO issue #79 : back to FormulaChanged when full update + // Also remove this function if only one function called here + this->FormulaChanged2(); +} + +//--------------------------------------------------------------------------------------------------------------------- +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"))); + } } //--------------------------------------------------------------------------------------------------------------------- @@ -96,10 +131,10 @@ void DialogPointOfContact::ChoosedObject(quint32 id, const Valentina::Scenes &ty const VPointF *point = data->GeometricObject(id); if (number == 0) { - qint32 index = ui.comboBoxFirstPoint->findText(point->name()); + qint32 index = ui->comboBoxFirstPoint->findText(point->name()); if ( index != -1 ) { // -1 for not found - ui.comboBoxFirstPoint->setCurrentIndex(index); + ui->comboBoxFirstPoint->setCurrentIndex(index); number++; emit ToolTip(tr("Select second point of line")); return; @@ -107,10 +142,10 @@ void DialogPointOfContact::ChoosedObject(quint32 id, const Valentina::Scenes &ty } if (number == 1) { - qint32 index = ui.comboBoxSecondPoint->findText(point->name()); + qint32 index = ui->comboBoxSecondPoint->findText(point->name()); if ( index != -1 ) { // -1 for not found - ui.comboBoxSecondPoint->setCurrentIndex(index); + ui->comboBoxSecondPoint->setCurrentIndex(index); number++; emit ToolTip(tr("Select point of center of arc")); return; @@ -118,10 +153,10 @@ void DialogPointOfContact::ChoosedObject(quint32 id, const Valentina::Scenes &ty } if (number == 2) { - qint32 index = ui.comboBoxCenter->findText(point->name()); + qint32 index = ui->comboBoxCenter->findText(point->name()); if ( index != -1 ) { // -1 for not found - ui.comboBoxCenter->setCurrentIndex(index); + ui->comboBoxCenter->setCurrentIndex(index); number = 0; emit ToolTip(""); } @@ -136,30 +171,43 @@ void DialogPointOfContact::ChoosedObject(quint32 id, const Valentina::Scenes &ty //--------------------------------------------------------------------------------------------------------------------- void DialogPointOfContact::DialogAccepted() { - pointName = ui.lineEditNamePoint->text(); - radius = ui.lineEditFormula->text(); - center = getCurrentObjectId(ui.comboBoxCenter); - firstPoint = getCurrentObjectId(ui.comboBoxFirstPoint); - secondPoint = getCurrentObjectId(ui.comboBoxSecondPoint); + this->SaveData(); emit DialogClosed(QDialog::Accepted); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogPointOfContact::DialogApply() +{ + this->SaveData(); + emit DialogApplied(); +} +//--------------------------------------------------------------------------------------------------------------------- +void DialogPointOfContact::SaveData() +{ + pointName = ui->lineEditNamePoint->text(); + radius = ui->plainTextEditFormula->toPlainText(); + radius.replace("\n"," "); + center = getCurrentObjectId(ui->comboBoxCenter); + firstPoint = getCurrentObjectId(ui->comboBoxFirstPoint); + secondPoint = getCurrentObjectId(ui->comboBoxSecondPoint); +} + //--------------------------------------------------------------------------------------------------------------------- void DialogPointOfContact::setSecondPoint(const quint32 &value, const quint32 &id) { - setCurrentPointId(ui.comboBoxSecondPoint, secondPoint, value, id); + setCurrentPointId(ui->comboBoxSecondPoint, secondPoint, value, id); } //--------------------------------------------------------------------------------------------------------------------- void DialogPointOfContact::setFirstPoint(const quint32 &value, const quint32 &id) { - setCurrentPointId(ui.comboBoxFirstPoint, firstPoint, value, id); + setCurrentPointId(ui->comboBoxFirstPoint, firstPoint, value, id); } //--------------------------------------------------------------------------------------------------------------------- void DialogPointOfContact::setCenter(const quint32 &value, const quint32 &id) { - setCurrentPointId(ui.comboBoxCenter, center, value, id); + setCurrentPointId(ui->comboBoxCenter, center, value, id); center = value; } @@ -167,12 +215,17 @@ void DialogPointOfContact::setCenter(const quint32 &value, const quint32 &id) void DialogPointOfContact::setRadius(const QString &value) { radius = value; - ui.lineEditFormula->setText(radius); + // increase height if needed. + if (radius.length() > 80) + { + this->DeployFormulaTextEdit(); + } + ui->plainTextEditFormula->setPlainText(radius); } //--------------------------------------------------------------------------------------------------------------------- void DialogPointOfContact::setPointName(const QString &value) { pointName = value; - ui.lineEditNamePoint->setText(pointName); + ui->lineEditNamePoint->setText(pointName); } diff --git a/src/app/dialogs/tools/dialogpointofcontact.h b/src/app/dialogs/tools/dialogpointofcontact.h index acde2b352..c9d0a3dd7 100644 --- a/src/app/dialogs/tools/dialogpointofcontact.h +++ b/src/app/dialogs/tools/dialogpointofcontact.h @@ -32,6 +32,11 @@ #include "ui_dialogpointofcontact.h" #include "dialogtool.h" +#define DIALOGPOINTOFCONTACT_MAX_FORMULA_HEIGHT 64 +namespace Ui +{ + class DialogPointOfContact; +} /** * @brief The DialogPointOfContact class dialog for ToolPointOfContact. Help create point and edit option. */ @@ -109,16 +114,28 @@ public slots: * @brief DialogAccepted save data and emit signal about closed dialog. */ 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(DialogPointOfContact) + /** + * @brief SaveData Put dialog data in local variables + */ + void SaveData(); /** * @brief ui keeps information about user interface */ - Ui::DialogPointOfContact ui; + Ui::DialogPointOfContact *ui; /** * @brief number number of handled objects */ @@ -143,6 +160,10 @@ private: * @brief secondPoint id second point of line */ quint32 secondPoint; + /** + * @brief formulaBaseHeight base height defined by dialogui + */ + int formulaBaseHeight; }; inline QString DialogPointOfContact::getPointName() const diff --git a/src/app/dialogs/tools/dialogpointofcontact.ui b/src/app/dialogs/tools/dialogpointofcontact.ui index 532648eeb..147765832 100644 --- a/src/app/dialogs/tools/dialogpointofcontact.ui +++ b/src/app/dialogs/tools/dialogpointofcontact.ui @@ -74,17 +74,17 @@ - - - - 0 - 0 - + + + Qt::Horizontal - - Formula for calculation of radius of arc + + + 40 + 20 + - + @@ -150,6 +150,56 @@ + + + + + + + 16777215 + 24 + + + + + + + + + 18 + 18 + + + + + 0 + 0 + + + + <html><head/><body><p>Show full calculation in message box</p></body></html> + + + + + + + + + + + + 16 + 16 + + + + true + + + + + @@ -441,14 +491,13 @@ Qt::Horizontal - QDialogButtonBox::Cancel|QDialogButtonBox::Ok + QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok - lineEditFormula lineEditNamePoint comboBoxCenter comboBoxFirstPoint diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index 48c45b976..b5705a1d5 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -264,7 +264,7 @@ template * @param closeDialogSlot function to handle close of dialog. * @param applyDialogSlot function to handle apply in dialog. */ -void MainWindow::SetToolButton2(bool checked, Valentina::Tools t, const QString &cursor, const QString &toolTip, +void MainWindow::SetToolButtonWithApply(bool checked, Valentina::Tools t, const QString &cursor, const QString &toolTip, Func closeDialogSlot, Func2 applyDialogSlot) { if (checked) @@ -314,7 +314,7 @@ void MainWindow::ClosedDialog(int result) */ // TODO ISSUE 79 : rename template -void MainWindow::ClosedDialog2(int result) +void MainWindow::ClosedDialogWithApply(int result) { SCASSERT(dialogTool != nullptr); if (result == QDialog::Accepted) @@ -370,7 +370,7 @@ void MainWindow::ToolEndLine(bool checked) {// TODO ISSUE 79 : copy // SetToolButton(checked, Valentina::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"), // &MainWindow::ClosedDialogEndLine); - SetToolButton2(checked, Valentina::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"), + SetToolButtonWithApply(checked, Valentina::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"), &MainWindow::ClosedDialogEndLine,&MainWindow::ApplyDialogEndLine); } @@ -390,7 +390,7 @@ void MainWindow::ApplyDialogEndLine() */ void MainWindow::ClosedDialogEndLine(int result) { - ClosedDialog2(result); + ClosedDialogWithApply(result); } //--------------------------------------------------------------------------------------------------------------------- @@ -421,7 +421,7 @@ void MainWindow::ClosedDialogLine(int result) */ void MainWindow::ToolAlongLine(bool checked) { - SetToolButton2(checked, Valentina::AlongLineTool, ":/cursor/alongline_cursor.png", + SetToolButtonWithApply(checked, Valentina::AlongLineTool, ":/cursor/alongline_cursor.png", tr("Select point"), &MainWindow::ClosedDialogAlongLine, &MainWindow::ApplyDialogAlongLine); } @@ -441,7 +441,7 @@ void MainWindow::ApplyDialogAlongLine() */ void MainWindow::ClosedDialogAlongLine(int result) { - ClosedDialog2(result); + ClosedDialogWithApply(result); } //--------------------------------------------------------------------------------------------------------------------- @@ -451,7 +451,7 @@ void MainWindow::ClosedDialogAlongLine(int result) */ void MainWindow::ToolShoulderPoint(bool checked) { - SetToolButton2(checked, Valentina::ShoulderPointTool, ":/cursor/shoulder_cursor.png", + SetToolButtonWithApply(checked, Valentina::ShoulderPointTool, ":/cursor/shoulder_cursor.png", tr("Select first point of line"), &MainWindow::ClosedDialogShoulderPoint, &MainWindow::ApplyDialogShoulderPoint); } @@ -472,7 +472,7 @@ void MainWindow::ApplyDialogShoulderPoint() */ void MainWindow::ClosedDialogShoulderPoint(int result) { - ClosedDialog2(result); + ClosedDialogWithApply(result); } //--------------------------------------------------------------------------------------------------------------------- @@ -482,7 +482,7 @@ void MainWindow::ClosedDialogShoulderPoint(int result) */ void MainWindow::ToolNormal(bool checked) { - SetToolButton2(checked, Valentina::NormalTool, ":/cursor/normal_cursor.png", + SetToolButtonWithApply(checked, Valentina::NormalTool, ":/cursor/normal_cursor.png", tr("Select first point of line"), &MainWindow::ClosedDialogNormal, &MainWindow::ApplyDialogNormal); } @@ -503,7 +503,7 @@ void MainWindow::ApplyDialogNormal() */ void MainWindow::ClosedDialogNormal(int result) { - ClosedDialog2(result); + ClosedDialogWithApply(result); } //--------------------------------------------------------------------------------------------------------------------- @@ -513,7 +513,7 @@ void MainWindow::ClosedDialogNormal(int result) */ void MainWindow::ToolBisector(bool checked) { - SetToolButton2(checked, Valentina::BisectorTool, ":/cursor/bisector_cursor.png", + SetToolButtonWithApply(checked, Valentina::BisectorTool, ":/cursor/bisector_cursor.png", tr("Select first point of angle"), &MainWindow::ClosedDialogBisector, &MainWindow::ApplyDialogBisector); } @@ -534,7 +534,7 @@ void MainWindow::ApplyDialogBisector() */ void MainWindow::ClosedDialogBisector(int result) { - ClosedDialog2(result); + ClosedDialogWithApply(result); } //--------------------------------------------------------------------------------------------------------------------- @@ -671,8 +671,18 @@ void MainWindow::ClosedDialogCutSplinePath(int result) */ void MainWindow::ToolPointOfContact(bool checked) { - SetToolButton(checked, Valentina::PointOfContact, ":/cursor/pointcontact_cursor.png", - tr("Select first point of line"), &MainWindow::ClosedDialogPointOfContact); + SetToolButtonWithApply(checked, Valentina::PointOfContact, ":/cursor/pointcontact_cursor.png", + tr("Select first point of line"), &MainWindow::ClosedDialogPointOfContact, + &MainWindow::ApplyDialogPointOfContact); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief ApplyDialogPointOfContact actions after apply in DialogPointOfContact. + */ +void MainWindow::ApplyDialogPointOfContact() +{ + ApplyDialog(); } //--------------------------------------------------------------------------------------------------------------------- @@ -682,7 +692,7 @@ void MainWindow::ToolPointOfContact(bool checked) */ void MainWindow::ClosedDialogPointOfContact(int result) { - ClosedDialog(result); + ClosedDialogWithApply(result); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/mainwindow.h b/src/app/mainwindow.h index a1eef0b61..285b78956 100644 --- a/src/app/mainwindow.h +++ b/src/app/mainwindow.h @@ -119,6 +119,7 @@ public slots: void ClosedDialogSplinePath(int result); void ClosedDialogCutSplinePath(int result); void ClosedDialogPointOfContact(int result); + void ApplyDialogPointOfContact(); void ClosedDialogDetail(int result); void ClosedDialogHeight(int result); void ClosedDialogTriangle(int result); @@ -218,17 +219,15 @@ private: void MinimumScrollBar(); template - // TODO ISSUE 79 : delete void SetToolButton(bool checked, Valentina::Tools t, const QString &cursor, const QString &toolTip, Func closeDialogSlot); template - // TODO ISSUE 79 : copy - void SetToolButton2(bool checked, Valentina::Tools t, const QString &cursor, const QString &toolTip, + void SetToolButtonWithApply(bool checked, Valentina::Tools t, const QString &cursor, const QString &toolTip, Func closeDialogSlot, Func2 applyDialogSlot); template void ClosedDialog(int result); template - void ClosedDialog2(int result); + void ClosedDialogWithApply(int result); template void ApplyDialog(); bool SavePattern(const QString &curFile); diff --git a/src/app/tools/drawTools/vtoolpointofcontact.cpp b/src/app/tools/drawTools/vtoolpointofcontact.cpp index b374baf18..52615b8b2 100644 --- a/src/app/tools/drawTools/vtoolpointofcontact.cpp +++ b/src/app/tools/drawTools/vtoolpointofcontact.cpp @@ -92,7 +92,7 @@ QPointF VToolPointOfContact::FindPoint(const qreal &radius, const QPointF ¢e } //--------------------------------------------------------------------------------------------------------------------- -void VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) +VToolPointOfContact* VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { SCASSERT(dialog != nullptr); DialogPointOfContact *dialogTool = qobject_cast(dialog); @@ -102,12 +102,18 @@ void VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene, const quint32 firstPointId = dialogTool->getFirstPoint(); const quint32 secondPointId = dialogTool->getSecondPoint(); const QString pointName = dialogTool->getPointName(); - Create(0, radius, center, firstPointId, secondPointId, pointName, 5, 10, scene, doc, data, + VToolPointOfContact *point = nullptr; + point=Create(0, radius, center, firstPointId, secondPointId, pointName, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui); + if (point != nullptr) + { + point->dialog=dialogTool; + } + return point; } //--------------------------------------------------------------------------------------------------------------------- -void VToolPointOfContact::Create(const quint32 _id, QString &radius, const quint32 ¢er, const quint32 &firstPointId, +VToolPointOfContact* VToolPointOfContact::Create(const quint32 _id, QString &radius, const quint32 ¢er, const quint32 &firstPointId, const quint32 &secondPointId, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation) @@ -151,7 +157,9 @@ void VToolPointOfContact::Create(const quint32 _id, QString &radius, const quint doc->IncrementReferens(center); doc->IncrementReferens(firstPointId); doc->IncrementReferens(secondPointId); + return point; } + return nullptr; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/tools/drawTools/vtoolpointofcontact.h b/src/app/tools/drawTools/vtoolpointofcontact.h index ce02fdd50..ea39684b5 100644 --- a/src/app/tools/drawTools/vtoolpointofcontact.h +++ b/src/app/tools/drawTools/vtoolpointofcontact.h @@ -74,7 +74,7 @@ public: * @param doc dom document container. * @param data container with variables. */ - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); + static VToolPointOfContact* 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. @@ -91,7 +91,7 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const quint32 _id, QString &arcRadius, const quint32 ¢er, + static VToolPointOfContact* Create(const quint32 _id, QString &arcRadius, const quint32 ¢er, const quint32 &firstPointId, const quint32 &secondPointId, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation);