DialogPointOfContact + DialogLine (no changes)

Also renamed specific functions in mainwindow

--HG--
branch : DialogTools
This commit is contained in:
Patrick Proy 2014-06-09 15:00:26 +02:00
parent a167cda90c
commit be8b8c9c95
9 changed files with 226 additions and 87 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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<const VPointF *>(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);
}

View File

@ -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

View File

@ -74,17 +74,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 calculation of radius of arc</string>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHere">
@ -150,6 +150,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_3">
<item>
@ -441,14 +491,13 @@
<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>
</layout>
</widget>
<tabstops>
<tabstop>lineEditFormula</tabstop>
<tabstop>lineEditNamePoint</tabstop>
<tabstop>comboBoxCenter</tabstop>
<tabstop>comboBoxFirstPoint</tabstop>

View File

@ -264,7 +264,7 @@ template <typename Dialog, typename Func, typename Func2>
* @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 <typename DrawTool>
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<DialogEndLine>(checked, Valentina::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"),
// &MainWindow::ClosedDialogEndLine);
SetToolButton2<DialogEndLine>(checked, Valentina::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"),
SetToolButtonWithApply<DialogEndLine>(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<VToolEndLine>(result);
ClosedDialogWithApply<VToolEndLine>(result);
}
//---------------------------------------------------------------------------------------------------------------------
@ -421,7 +421,7 @@ void MainWindow::ClosedDialogLine(int result)
*/
void MainWindow::ToolAlongLine(bool checked)
{
SetToolButton2<DialogAlongLine>(checked, Valentina::AlongLineTool, ":/cursor/alongline_cursor.png",
SetToolButtonWithApply<DialogAlongLine>(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<VToolAlongLine>(result);
ClosedDialogWithApply<VToolAlongLine>(result);
}
//---------------------------------------------------------------------------------------------------------------------
@ -451,7 +451,7 @@ void MainWindow::ClosedDialogAlongLine(int result)
*/
void MainWindow::ToolShoulderPoint(bool checked)
{
SetToolButton2<DialogShoulderPoint>(checked, Valentina::ShoulderPointTool, ":/cursor/shoulder_cursor.png",
SetToolButtonWithApply<DialogShoulderPoint>(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<VToolShoulderPoint>(result);
ClosedDialogWithApply<VToolShoulderPoint>(result);
}
//---------------------------------------------------------------------------------------------------------------------
@ -482,7 +482,7 @@ void MainWindow::ClosedDialogShoulderPoint(int result)
*/
void MainWindow::ToolNormal(bool checked)
{
SetToolButton2<DialogNormal>(checked, Valentina::NormalTool, ":/cursor/normal_cursor.png",
SetToolButtonWithApply<DialogNormal>(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<VToolNormal>(result);
ClosedDialogWithApply<VToolNormal>(result);
}
//---------------------------------------------------------------------------------------------------------------------
@ -513,7 +513,7 @@ void MainWindow::ClosedDialogNormal(int result)
*/
void MainWindow::ToolBisector(bool checked)
{
SetToolButton2<DialogBisector>(checked, Valentina::BisectorTool, ":/cursor/bisector_cursor.png",
SetToolButtonWithApply<DialogBisector>(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<VToolBisector>(result);
ClosedDialogWithApply<VToolBisector>(result);
}
//---------------------------------------------------------------------------------------------------------------------
@ -671,8 +671,18 @@ void MainWindow::ClosedDialogCutSplinePath(int result)
*/
void MainWindow::ToolPointOfContact(bool checked)
{
SetToolButton<DialogPointOfContact>(checked, Valentina::PointOfContact, ":/cursor/pointcontact_cursor.png",
tr("Select first point of line"), &MainWindow::ClosedDialogPointOfContact);
SetToolButtonWithApply<DialogPointOfContact>(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<VToolPointOfContact>();
}
//---------------------------------------------------------------------------------------------------------------------
@ -682,7 +692,7 @@ void MainWindow::ToolPointOfContact(bool checked)
*/
void MainWindow::ClosedDialogPointOfContact(int result)
{
ClosedDialog<VToolPointOfContact>(result);
ClosedDialogWithApply<VToolPointOfContact>(result);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -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 <typename Dialog, typename Func>
// TODO ISSUE 79 : delete
void SetToolButton(bool checked, Valentina::Tools t, const QString &cursor, const QString &toolTip,
Func closeDialogSlot);
template <typename Dialog, typename Func, typename Func2>
// 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 <typename DrawTool>
void ClosedDialog(int result);
template <typename DrawTool>
void ClosedDialog2(int result);
void ClosedDialogWithApply(int result);
template <typename DrawTool>
void ApplyDialog();
bool SavePattern(const QString &curFile);

View File

@ -92,7 +92,7 @@ QPointF VToolPointOfContact::FindPoint(const qreal &radius, const QPointF &cente
}
//---------------------------------------------------------------------------------------------------------------------
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<DialogPointOfContact*>(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 &center, const quint32 &firstPointId,
VToolPointOfContact* VToolPointOfContact::Create(const quint32 _id, QString &radius, const quint32 &center, 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;
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -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 &center,
static VToolPointOfContact* Create(const quint32 _id, QString &arcRadius, const quint32 &center,
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);