Don't show internal variable if we created her.

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-29 15:19:11 +03:00
parent 484f149929
commit 10ba3eacbb
65 changed files with 165 additions and 161 deletions

View File

@ -154,16 +154,16 @@ void Calculator::InitVariables(const VContainer *data)
num +=2; num +=2;
} }
const QMap<QString, qreal> lengthLines = data->DataLengthLines(); const QMap<QString, VLengthLine *> lengthLines = data->DataLengthLines();
num += lengthLines.size(); num += lengthLines.size();
const QMap<QString, qreal> lengthSplines = data->DataLengthSplines(); const QMap<QString, VLengthSpline *> lengthSplines = data->DataLengthSplines();
num += lengthSplines.size(); num += lengthSplines.size();
const QMap<QString, qreal> lengthArcs = data->DataLengthArcs(); const QMap<QString, VLengthArc *> lengthArcs = data->DataLengthArcs();
num += lengthArcs.size(); num += lengthArcs.size();
const QMap<QString, qreal> lineAngles = data->DataLineAngles(); const QMap<QString, VLineAngle *> lineAngles = data->DataLineAngles();
num += lineAngles.size(); num += lineAngles.size();
const QMap<QString, VMeasurement*> measurements = data->DataMeasurements(); const QMap<QString, VMeasurement*> measurements = data->DataMeasurements();
@ -187,10 +187,10 @@ void Calculator::InitVariables(const VContainer *data)
} }
{ {
QMap<QString, qreal>::const_iterator i = lengthLines.constBegin(); QMap<QString, VLengthLine *>::const_iterator i = lengthLines.constBegin();
while (i != lengthLines.constEnd()) while (i != lengthLines.constEnd())
{ {
vVarVal[j] = i.value(); vVarVal[j] = *i.value()->GetValue();
DefineVar(i.key(), &vVarVal[j]); DefineVar(i.key(), &vVarVal[j]);
++j; ++j;
++i; ++i;
@ -198,10 +198,10 @@ void Calculator::InitVariables(const VContainer *data)
} }
{ {
QMap<QString, qreal>::const_iterator i = lengthSplines.constBegin(); QMap<QString, VLengthSpline *>::const_iterator i = lengthSplines.constBegin();
while (i != lengthSplines.constEnd()) while (i != lengthSplines.constEnd())
{ {
vVarVal[j] = i.value(); vVarVal[j] = *i.value()->GetValue();
DefineVar(i.key(), &vVarVal[j]); DefineVar(i.key(), &vVarVal[j]);
++j; ++j;
++i; ++i;
@ -209,10 +209,10 @@ void Calculator::InitVariables(const VContainer *data)
} }
{ {
QMap<QString, qreal>::const_iterator i = lengthArcs.constBegin(); QMap<QString, VLengthArc *>::const_iterator i = lengthArcs.constBegin();
while (i != lengthArcs.constEnd()) while (i != lengthArcs.constEnd())
{ {
vVarVal[j] = i.value(); vVarVal[j] = *i.value()->GetValue();
DefineVar(i.key(), &vVarVal[j]); DefineVar(i.key(), &vVarVal[j]);
++j; ++j;
++i; ++i;
@ -220,10 +220,10 @@ void Calculator::InitVariables(const VContainer *data)
} }
{ {
QMap<QString, qreal>::const_iterator i = lineAngles.constBegin(); QMap<QString, VLineAngle *>::const_iterator i = lineAngles.constBegin();
while (i != lineAngles.constEnd()) while (i != lineAngles.constEnd())
{ {
vVarVal[j] = i.value(); vVarVal[j] = *i.value()->GetValue();
DefineVar(i.key(), &vVarVal[j]); DefineVar(i.key(), &vVarVal[j]);
++j; ++j;
++i; ++i;

View File

@ -445,37 +445,37 @@ void VContainer::RemoveIncrement(const QString &name)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
const QMap<QString, VMeasurement*> VContainer::DataMeasurements() const const QMap<QString, VMeasurement*> VContainer::DataMeasurements() const
{ {
return DataTableVar<VMeasurement>(VarType::Measurement); return DataVar<VMeasurement>(VarType::Measurement);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
const QMap<QString, VIncrement *> VContainer::DataIncrements() const const QMap<QString, VIncrement *> VContainer::DataIncrements() const
{ {
return DataTableVar<VIncrement>(VarType::Increment); return DataVar<VIncrement>(VarType::Increment);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
const QMap<QString, qreal> VContainer::DataLengthLines() const const QMap<QString, VLengthLine *> VContainer::DataLengthLines() const
{ {
return DataVar(VarType::LengthLine); return DataVar<VLengthLine>(VarType::LengthLine);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
const QMap<QString, qreal> VContainer::DataLengthSplines() const const QMap<QString, VLengthSpline *> VContainer::DataLengthSplines() const
{ {
return DataVar(VarType::LengthSpline); return DataVar<VLengthSpline>(VarType::LengthSpline);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
const QMap<QString, qreal> VContainer::DataLengthArcs() const const QMap<QString, VLengthArc *> VContainer::DataLengthArcs() const
{ {
return DataVar(VarType::LengthArc); return DataVar<VLengthArc>(VarType::LengthArc);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
const QMap<QString, qreal> VContainer::DataLineAngles() const const QMap<QString, VLineAngle *> VContainer::DataLineAngles() const
{ {
return DataVar(VarType::LineAngle); return DataVar<VLineAngle>(VarType::LineAngle);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -505,26 +505,9 @@ void VContainer::CopyVar(const VContainer &data, const QString &name)
AddVariable(name, var); AddVariable(name, var);
} }
//---------------------------------------------------------------------------------------------------------------------
QMap<QString, qreal> VContainer::DataVar(const VarType &type) const
{
QHashIterator<QString, VInternalVariable*> i(variables);
QMap<QString, qreal> map;
//Sorting QHash by id
while (i.hasNext())
{
i.next();
if(i.value()->GetType() == type)
{
map.insert(qApp->VarToUser(i.key()), *i.value()->GetValue());
}
}
return map;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template <typename T> template <typename T>
const QMap<QString, T *> VContainer::DataTableVar(const VarType &type) const const QMap<QString, T *> VContainer::DataVar(const VarType &type) const
{ {
QHashIterator<QString, VInternalVariable*> i(variables); QHashIterator<QString, VInternalVariable*> i(variables);
QMap<QString, T*> map; QMap<QString, T*> map;

View File

@ -172,10 +172,10 @@ public:
const QMap<QString, VMeasurement *> DataMeasurements() const; const QMap<QString, VMeasurement *> DataMeasurements() const;
const QMap<QString, VIncrement *> DataIncrements() const; const QMap<QString, VIncrement *> DataIncrements() const;
const QMap<QString, qreal> DataLengthLines() const; const QMap<QString, VLengthLine *> DataLengthLines() const;
const QMap<QString, qreal> DataLengthSplines() const; const QMap<QString, VLengthSpline *> DataLengthSplines() const;
const QMap<QString, qreal> DataLengthArcs() const; const QMap<QString, VLengthArc *> DataLengthArcs() const;
const QMap<QString, qreal> DataLineAngles() const; const QMap<QString, VLineAngle *> DataLineAngles() const;
private: private:
@ -217,10 +217,8 @@ private:
template <typename T> template <typename T>
void CopyVar(const VContainer &data, const QString &name); void CopyVar(const VContainer &data, const QString &name);
QMap<QString, qreal> DataVar(const VarType &type) const;
template <typename T> template <typename T>
const QMap<QString, T*> DataTableVar(const VarType &type) const; const QMap<QString, T*> DataVar(const VarType &type) const;
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -45,7 +45,7 @@
* @param parent parent widget * @param parent parent widget
*/ */
DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent) DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0), :DialogTool(data, 0, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0),
cursorToolRecordRow(0) cursorToolRecordRow(0)
{ {
ui->setupUi(this); ui->setupUi(this);

View File

@ -49,7 +49,7 @@
* @param parent parent widget * @param parent parent widget
*/ */
DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent) DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogIncrements), data(data), doc(doc), row(0), column(0), m(nullptr) :DialogTool(data, 0, parent), ui(new Ui::DialogIncrements), data(data), doc(doc), row(0), column(0), m(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -287,16 +287,17 @@ void DialogIncrements::FillIncrements()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::FillTable(const QMap<QString, qreal> varTable, QTableWidget *table) template <typename T>
void DialogIncrements::FillTable(const QMap<QString, T> varTable, QTableWidget *table)
{ {
SCASSERT(table != nullptr); SCASSERT(table != nullptr);
qint32 currentRow = -1; qint32 currentRow = -1;
QMapIterator<QString, qreal> i(varTable); QMapIterator<QString, T> i(varTable);
while (i.hasNext()) while (i.hasNext())
{ {
i.next(); i.next();
qreal length = i.value(); qreal length = *i.value()->GetValue();
currentRow++; currentRow++;
table->setRowCount ( varTable.size() ); table->setRowCount ( varTable.size() );

View File

@ -94,7 +94,8 @@ private:
void FillMeasurements(); void FillMeasurements();
void FillIncrements(); void FillIncrements();
void FillTable(const QMap<QString, qreal> varTable, QTableWidget *table); template <typename T>
void FillTable(const QMap<QString, T> varTable, QTableWidget *table);
void FillLengthLines(); void FillLengthLines();
void FillLengthSplines(); void FillLengthSplines();
void FillLengthArcs(); void FillLengthArcs();

View File

@ -40,9 +40,10 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogAlongLine::DialogAlongLine(const VContainer *data, QWidget *parent) DialogAlongLine::DialogAlongLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogAlongLine), number(0), pointName(QString()), typeLine(QString()), :DialogTool(data, toolId, parent), ui(new Ui::DialogAlongLine), number(0), pointName(QString()),
formula(QString()), firstPointId(0), secondPointId(0), formulaBaseHeight(0), line(nullptr), prepare(false) typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0), formulaBaseHeight(0), line(nullptr),
prepare(false)
{ {
ui->setupUi(this); ui->setupUi(this);
InitVariables(ui); InitVariables(ui);

View File

@ -45,7 +45,7 @@ class DialogAlongLine : public DialogTool
{ {
Q_OBJECT Q_OBJECT
public: public:
DialogAlongLine(const VContainer *data, QWidget *parent = nullptr); DialogAlongLine(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogAlongLine(); ~DialogAlongLine();
QString getPointName() const; QString getPointName() const;
void setPointName(const QString &value); void setPointName(const QString &value);

View File

@ -41,8 +41,8 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogArc::DialogArc(const VContainer *data, QWidget *parent) DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false), :DialogTool(data, toolId, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false),
timerRadius(nullptr), timerF1(nullptr), timerF2(nullptr), center(0), radius(QString()), f1(QString()), timerRadius(nullptr), timerF1(nullptr), timerF2(nullptr), center(0), radius(QString()), f1(QString()),
f2(QString()), formulaBaseHeight(0), formulaBaseHeightF1(0), formulaBaseHeightF2(0) f2(QString()), formulaBaseHeight(0), formulaBaseHeightF1(0), formulaBaseHeightF2(0)
{ {
@ -357,8 +357,8 @@ void DialogArc::ShowLineAngles()
disconnect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged); disconnect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
ui->listWidget->clear(); ui->listWidget->clear();
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged); connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
const QMap<QString, qreal> lineAnglesTable = data->DataLineAngles(); const QMap<QString, VLineAngle *> lineAnglesTable = data->DataLineAngles();
QMapIterator<QString, qreal> i(lineAnglesTable); QMapIterator<QString, VLineAngle *> i(lineAnglesTable);
while (i.hasNext()) while (i.hasNext())
{ {
i.next(); i.next();

View File

@ -43,7 +43,7 @@ class DialogArc : public DialogTool
{ {
Q_OBJECT Q_OBJECT
public: public:
DialogArc(const VContainer *data, QWidget *parent = nullptr); DialogArc(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogArc(); ~DialogArc();
quint32 GetCenter() const; quint32 GetCenter() const;

View File

@ -41,8 +41,8 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogBisector::DialogBisector(const VContainer *data, QWidget *parent) DialogBisector::DialogBisector(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogBisector), number(0), pointName(QString()), typeLine(QString()), :DialogTool(data, toolId, parent), ui(new Ui::DialogBisector), number(0), pointName(QString()), typeLine(QString()),
formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0), formulaBaseHeight(0), line(nullptr), formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0), formulaBaseHeight(0), line(nullptr),
prepare(false) prepare(false)
{ {

View File

@ -46,7 +46,7 @@ class DialogBisector : public DialogTool
Q_OBJECT Q_OBJECT
public: public:
DialogBisector(const VContainer *data, QWidget *parent = nullptr); DialogBisector(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogBisector(); ~DialogBisector();
QString getPointName() const; QString getPointName() const;

View File

@ -38,8 +38,8 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogCutArc::DialogCutArc(const VContainer *data, QWidget *parent) DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidget *parent)
: DialogTool(data, parent), ui(new Ui::DialogCutArc), pointName(QString()), formula(QString()), arcId(0), : DialogTool(data, toolId, parent), ui(new Ui::DialogCutArc), pointName(QString()), formula(QString()), arcId(0),
formulaBaseHeight(0) formulaBaseHeight(0)
{ {
ui->setupUi(this); ui->setupUi(this);

View File

@ -44,7 +44,7 @@ class DialogCutArc : public DialogTool
Q_OBJECT Q_OBJECT
public: public:
DialogCutArc(const VContainer *data, QWidget *parent = nullptr); DialogCutArc(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogCutArc(); ~DialogCutArc();
QString getPointName() const; QString getPointName() const;

View File

@ -38,9 +38,9 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogCutSpline::DialogCutSpline(const VContainer *data, QWidget *parent) DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogCutSpline), pointName(QString()), formula(QString()), splineId(0), :DialogTool(data, toolId, parent), ui(new Ui::DialogCutSpline), pointName(QString()), formula(QString()),
formulaBaseHeight(0) splineId(0), formulaBaseHeight(0)
{ {
ui->setupUi(this); ui->setupUi(this);
InitVariables(ui); InitVariables(ui);

View File

@ -43,7 +43,7 @@ class DialogCutSpline : public DialogTool
{ {
Q_OBJECT Q_OBJECT
public: public:
DialogCutSpline(const VContainer *data, QWidget *parent = nullptr); DialogCutSpline(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogCutSpline(); ~DialogCutSpline();
QString getPointName() const; QString getPointName() const;

View File

@ -38,8 +38,8 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, QWidget *parent) DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogCutSplinePath), pointName(QString()), formula(QString()), :DialogTool(data, toolId, parent), ui(new Ui::DialogCutSplinePath), pointName(QString()), formula(QString()),
splinePathId(0), formulaBaseHeight(0) splinePathId(0), formulaBaseHeight(0)
{ {
ui->setupUi(this); ui->setupUi(this);

View File

@ -43,7 +43,7 @@ class DialogCutSplinePath : public DialogTool
{ {
Q_OBJECT Q_OBJECT
public: public:
DialogCutSplinePath(const VContainer *data, QWidget *parent = nullptr); DialogCutSplinePath(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogCutSplinePath(); ~DialogCutSplinePath();
QString getPointName() const; QString getPointName() const;

View File

@ -42,8 +42,8 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogDetail::DialogDetail(const VContainer *data, QWidget *parent) DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, parent), ui(), details(VDetail()), supplement(true), closed(true) :DialogTool(data, toolId, parent), ui(), details(VDetail()), supplement(true), closed(true)
{ {
ui.setupUi(this); ui.setupUi(this);
labelEditNamePoint = ui.labelEditNameDetail; labelEditNamePoint = ui.labelEditNameDetail;

View File

@ -40,7 +40,7 @@ class DialogDetail : public DialogTool
{ {
Q_OBJECT Q_OBJECT
public: public:
DialogDetail(const VContainer *data, QWidget *parent = nullptr); DialogDetail(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
VDetail getDetails() const; VDetail getDetails() const;
void setDetails(const VDetail &value); void setDetails(const VDetail &value);

View File

@ -30,8 +30,8 @@
#include "ui_dialogeditwrongformula.h" #include "ui_dialogeditwrongformula.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, QWidget *parent) DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogEditWrongFormula), formula(QString()), formulaBaseHeight(0) :DialogTool(data, toolId, parent), ui(new Ui::DialogEditWrongFormula), formula(QString()), formulaBaseHeight(0)
{ {
ui->setupUi(this); ui->setupUi(this);
InitVariables(ui); InitVariables(ui);

View File

@ -48,7 +48,7 @@ class DialogEditWrongFormula : public DialogTool
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DialogEditWrongFormula(const VContainer *data, QWidget *parent = nullptr); explicit DialogEditWrongFormula(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogEditWrongFormula(); ~DialogEditWrongFormula();
QString getFormula() const; QString getFormula() const;

View File

@ -41,9 +41,9 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent) DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()), formula(QString()), :DialogTool(data, toolId, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()),
angle(0), basePointId(0), formulaBaseHeight(0), line(nullptr), prepare(false) formula(QString()), angle(0), basePointId(0), formulaBaseHeight(0), line(nullptr), prepare(false)
{ {
ui->setupUi(this); ui->setupUi(this);
InitVariables(ui); InitVariables(ui);

View File

@ -45,7 +45,7 @@ class DialogEndLine : public DialogTool
{ {
Q_OBJECT Q_OBJECT
public: public:
DialogEndLine(const VContainer *data, QWidget *parent = nullptr); DialogEndLine(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogEndLine(); ~DialogEndLine();
QString getPointName() const; QString getPointName() const;

View File

@ -39,8 +39,8 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogHeight::DialogHeight(const VContainer *data, QWidget *parent) DialogHeight::DialogHeight(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogHeight), number(0), pointName(QString()), :DialogTool(data, toolId, parent), ui(new Ui::DialogHeight), number(0), pointName(QString()),
typeLine(QString()), basePointId(0), p1LineId(0), p2LineId(0) typeLine(QString()), basePointId(0), p1LineId(0), p2LineId(0)
{ {
ui->setupUi(this); ui->setupUi(this);

View File

@ -43,7 +43,7 @@ class DialogHeight : public DialogTool
{ {
Q_OBJECT Q_OBJECT
public: public:
DialogHeight(const VContainer *data, QWidget *parent = nullptr); DialogHeight(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogHeight(); ~DialogHeight();
QString getPointName() const; QString getPointName() const;

View File

@ -42,9 +42,9 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogLine::DialogLine(const VContainer *data, QWidget *parent) DialogLine::DialogLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0), typeLine(QString()), :DialogTool(data, toolId, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0),
line(nullptr) typeLine(QString()), line(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
InitOkCancelApply(ui); InitOkCancelApply(ui);

View File

@ -45,7 +45,7 @@ class DialogLine : public DialogTool
{ {
Q_OBJECT Q_OBJECT
public: public:
DialogLine(const VContainer *data, QWidget *parent = nullptr); DialogLine(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogLine(); ~DialogLine();
quint32 getFirstPoint() const; quint32 getFirstPoint() const;

View File

@ -38,8 +38,8 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogLineIntersect::DialogLineIntersect(const VContainer *data, QWidget *parent) DialogLineIntersect::DialogLineIntersect(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogLineIntersect), number(0), pointName(QString()), :DialogTool(data, toolId, parent), ui(new Ui::DialogLineIntersect), number(0), pointName(QString()),
p1Line1(0), p2Line1(0), p1Line2(0), p2Line2(0), flagPoint(true) p1Line1(0), p2Line1(0), p1Line2(0), p2Line2(0), flagPoint(true)
{ {
ui->setupUi(this); ui->setupUi(this);

View File

@ -43,7 +43,7 @@ class DialogLineIntersect : public DialogTool
{ {
Q_OBJECT Q_OBJECT
public: public:
DialogLineIntersect(const VContainer *data, QWidget *parent = nullptr); DialogLineIntersect(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogLineIntersect(); ~DialogLineIntersect();
quint32 getP1Line1() const; quint32 getP1Line1() const;

View File

@ -35,8 +35,8 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogNormal::DialogNormal(const VContainer *data, QWidget *parent) DialogNormal::DialogNormal(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()), typeLine(QString()), :DialogTool(data, toolId, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()), typeLine(QString()),
formula(QString()), angle(0), firstPointId(0), secondPointId(0), formulaBaseHeight(0) formula(QString()), angle(0), firstPointId(0), secondPointId(0), formulaBaseHeight(0)
{ {
ui->setupUi(this); ui->setupUi(this);

View File

@ -43,7 +43,7 @@ class DialogNormal : public DialogTool
{ {
Q_OBJECT Q_OBJECT
public: public:
DialogNormal(const VContainer *data, QWidget *parent = nullptr); DialogNormal(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogNormal(); ~DialogNormal();
QString getPointName() const; QString getPointName() const;

View File

@ -37,9 +37,9 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *parent) DialogPointOfContact::DialogPointOfContact(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogPointOfContact), number(0), pointName(QString()), radius(QString()), :DialogTool(data, toolId, parent), ui(new Ui::DialogPointOfContact), number(0), pointName(QString()),
center(0), firstPoint(0), secondPoint(0), formulaBaseHeight(0) radius(QString()), center(0), firstPoint(0), secondPoint(0), formulaBaseHeight(0)
{ {
ui->setupUi(this); ui->setupUi(this);
InitVariables(ui); InitVariables(ui);

View File

@ -43,7 +43,7 @@ class DialogPointOfContact : public DialogTool
{ {
Q_OBJECT Q_OBJECT
public: public:
DialogPointOfContact(const VContainer *data, QWidget *parent = nullptr); DialogPointOfContact(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
QString getPointName() const; QString getPointName() const;
void setPointName(const QString &value); void setPointName(const QString &value);

View File

@ -38,8 +38,8 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, QWidget *parent) DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogPointOfIntersection), number(0), pointName(QString()), :DialogTool(data, toolId, parent), ui(new Ui::DialogPointOfIntersection), number(0), pointName(QString()),
firstPointId(0), secondPointId(0) firstPointId(0), secondPointId(0)
{ {
ui->setupUi(this); ui->setupUi(this);

View File

@ -43,7 +43,7 @@ class DialogPointOfIntersection : public DialogTool
{ {
Q_OBJECT Q_OBJECT
public: public:
DialogPointOfIntersection(const VContainer *data, QWidget *parent = nullptr); DialogPointOfIntersection(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogPointOfIntersection(); ~DialogPointOfIntersection();
QString getPointName() const; QString getPointName() const;

View File

@ -41,8 +41,8 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent) DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogShoulderPoint), number(0), pointName(QString()), :DialogTool(data, toolId, parent), ui(new Ui::DialogShoulderPoint), number(0), pointName(QString()),
typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0), formulaBaseHeight(0), line (nullptr), typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0), formulaBaseHeight(0), line (nullptr),
prepare(false) prepare(false)
{ {

View File

@ -45,7 +45,7 @@ class DialogShoulderPoint : public DialogTool
{ {
Q_OBJECT Q_OBJECT
public: public:
DialogShoulderPoint(const VContainer *data, QWidget *parent = nullptr); DialogShoulderPoint(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogShoulderPoint(); ~DialogShoulderPoint();
QString getPointName() const; QString getPointName() const;

View File

@ -35,8 +35,8 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent) DialogSinglePoint::DialogSinglePoint(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogSinglePoint), name(QString()), point(QPointF()) :DialogTool(data, toolId, parent), ui(new Ui::DialogSinglePoint), name(QString()), point(QPointF())
{ {
ui->setupUi(this); ui->setupUi(this);
ui->doubleSpinBoxX->setRange(0, qApp->fromPixel(SceneSize)); ui->doubleSpinBoxX->setRange(0, qApp->fromPixel(SceneSize));

View File

@ -43,7 +43,7 @@ class DialogSinglePoint : public DialogTool
{ {
Q_OBJECT Q_OBJECT
public: public:
DialogSinglePoint(const VContainer *data, QWidget *parent = nullptr); DialogSinglePoint(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogSinglePoint(); ~DialogSinglePoint();
void setData(const QString &name, const QPointF &point); void setData(const QString &name, const QPointF &point);
QString getName()const; QString getName()const;

View File

@ -38,9 +38,9 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogSpline::DialogSpline(const VContainer *data, QWidget *parent) DialogSpline::DialogSpline(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogSpline), number(0), p1(0), p4(0), angle1(0), angle2(0), kAsm1(1), :DialogTool(data, toolId, parent), ui(new Ui::DialogSpline), number(0), p1(0), p4(0), angle1(0), angle2(0),
kAsm2(1), kCurve(1) kAsm1(1), kAsm2(1), kCurve(1)
{ {
ui->setupUi(this); ui->setupUi(this);
InitOkCancel(ui); InitOkCancel(ui);

View File

@ -43,7 +43,7 @@ class DialogSpline : public DialogTool
{ {
Q_OBJECT Q_OBJECT
public: public:
DialogSpline(const VContainer *data, QWidget *parent = nullptr); DialogSpline(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogSpline(); ~DialogSpline();
quint32 getP1() const; quint32 getP1() const;

View File

@ -37,8 +37,8 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogSplinePath::DialogSplinePath(const VContainer *data, QWidget *parent) DialogSplinePath::DialogSplinePath(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogSplinePath), path(VSplinePath()) :DialogTool(data, toolId, parent), ui(new Ui::DialogSplinePath), path(VSplinePath())
{ {
ui->setupUi(this); ui->setupUi(this);
InitOkCancel(ui); InitOkCancel(ui);

View File

@ -44,7 +44,7 @@ class DialogSplinePath : public DialogTool
{ {
Q_OBJECT Q_OBJECT
public: public:
DialogSplinePath(const VContainer *data, QWidget *parent = nullptr); DialogSplinePath(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogSplinePath(); ~DialogSplinePath();
VSplinePath GetPath() const; VSplinePath GetPath() const;

View File

@ -56,21 +56,18 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogTool::DialogTool(const VContainer *data, QWidget *parent) DialogTool::DialogTool(const VContainer *data, const quint32 &toolId, QWidget *parent)
:QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), flagError(true), :QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), flagError(true),
timerFormula(nullptr), bOk(nullptr), bApply(nullptr), spinBoxAngle(nullptr), plainTextEditFormula(nullptr), timerFormula(nullptr), bOk(nullptr), bApply(nullptr), spinBoxAngle(nullptr), plainTextEditFormula(nullptr),
listWidget(nullptr), labelResultCalculation(nullptr), labelDescription(nullptr), labelEditNamePoint(nullptr), listWidget(nullptr), labelResultCalculation(nullptr), labelDescription(nullptr), labelEditNamePoint(nullptr),
labelEditFormula(nullptr), radioButtonSizeGrowth(nullptr), radioButtonStandardTable(nullptr), labelEditFormula(nullptr), radioButtonSizeGrowth(nullptr), radioButtonStandardTable(nullptr),
radioButtonIncrements(nullptr), radioButtonLengthLine(nullptr), radioButtonLengthArc(nullptr), radioButtonIncrements(nullptr), radioButtonLengthLine(nullptr), radioButtonLengthArc(nullptr),
radioButtonLengthCurve(nullptr), lineStyles(QStringList()), okColor(QColor(76, 76, 76)), errorColor(Qt::red), radioButtonLengthCurve(nullptr), lineStyles(VAbstractTool::Styles()), okColor(QColor(76, 76, 76)),
associatedTool(nullptr) errorColor(Qt::red), associatedTool(nullptr), toolId(toolId)
{ {
SCASSERT(data != nullptr); SCASSERT(data != nullptr);
timerFormula = new QTimer(this); timerFormula = new QTimer(this);
connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula); connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula);
//Keep synchronize with VAbstractTool styles list!!!
lineStyles<<tr("No line")<<tr("Line")<<tr("Dash Line")<<tr("Dot Line")<<tr("Dash Dot Line")
<<tr("Dash Dot Dot Line");
this->setWindowFlags(Qt::Tool | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint); this->setWindowFlags(Qt::Tool | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint);
} }
@ -1046,6 +1043,18 @@ void DialogTool::UpdateList()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
quint32 DialogTool::GetToolId() const
{
return toolId;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::SetToolId(const quint32 &value)
{
toolId = value;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief ShowVariable show variables in list * @brief ShowVariable show variables in list
@ -1062,10 +1071,13 @@ void DialogTool::ShowVariable(const QMap<key, val> var)
while (iMap.hasNext()) while (iMap.hasNext())
{ {
iMap.next(); iMap.next();
if (iMap.value()->Filter(toolId) == false)
{// If we create this variable don't show
QListWidgetItem *item = new QListWidgetItem(iMap.key()); QListWidgetItem *item = new QListWidgetItem(iMap.key());
item->setFont(QFont("Times", 12, QFont::Bold)); item->setFont(QFont("Times", 12, QFont::Bold));
listWidget->addItem(item); listWidget->addItem(item);
} }
}
connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
listWidget->setCurrentRow (0); listWidget->setCurrentRow (0);
} }
@ -1086,5 +1098,5 @@ void DialogTool::ShowDialog(bool click)
void DialogTool::SetAssociatedTool(VAbstractTool *tool) void DialogTool::SetAssociatedTool(VAbstractTool *tool)
{ {
this->associatedTool=tool; this->associatedTool=tool;
this->data = tool->getData(); SetToolId(tool->getId());
} }

View File

@ -55,11 +55,16 @@ class DialogTool : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
DialogTool(const VContainer *data, QWidget *parent = nullptr); DialogTool(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
virtual ~DialogTool() {} virtual ~DialogTool() {}
VAbstractTool* GetAssociatedTool(); VAbstractTool* GetAssociatedTool();
void SetAssociatedTool(VAbstractTool* tool); void SetAssociatedTool(VAbstractTool* tool);
virtual void ShowDialog(bool click); virtual void ShowDialog(bool click);
quint32 GetToolId() const;
void SetToolId(const quint32 &value);
signals: signals:
/** /**
* @brief DialogClosed signal dialog closed * @brief DialogClosed signal dialog closed
@ -183,6 +188,11 @@ protected:
QStringList lineStyles; QStringList lineStyles;
const QColor okColor; const QColor okColor;
const QColor errorColor; const QColor errorColor;
/**
* @brief associatedTool vdrawtool associated with opened dialog.
*/
VAbstractTool *associatedTool;
quint32 toolId;
virtual void closeEvent ( QCloseEvent * event ); virtual void closeEvent ( QCloseEvent * event );
virtual void showEvent( QShowEvent *event ); virtual void showEvent( QShowEvent *event );
@ -300,10 +310,7 @@ protected:
plainTextEditFormula = ui->plainTextEditFormula; plainTextEditFormula = ui->plainTextEditFormula;
labelEditFormula = ui->labelEditFormula; labelEditFormula = ui->labelEditFormula;
} }
/**
* @brief associatedTool vdrawtool associated with opened dialog.
*/
VAbstractTool* associatedTool;
void ChangeColor(QWidget *widget, const QColor &color); void ChangeColor(QWidget *widget, const QColor &color);
void setPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id); void setPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id);
virtual void ShowVisualization(){} virtual void ShowVisualization(){}

View File

@ -37,8 +37,8 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogTriangle::DialogTriangle(const VContainer *data, QWidget *parent) DialogTriangle::DialogTriangle(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogTriangle), number(0), pointName(QString()), axisP1Id(0), :DialogTool(data, toolId, parent), ui(new Ui::DialogTriangle), number(0), pointName(QString()), axisP1Id(0),
axisP2Id(0), firstPointId(0), secondPointId(0) axisP2Id(0), firstPointId(0), secondPointId(0)
{ {
ui->setupUi(this); ui->setupUi(this);

View File

@ -43,7 +43,7 @@ class DialogTriangle : public DialogTool
{ {
Q_OBJECT Q_OBJECT
public: public:
DialogTriangle(const VContainer *data, QWidget *parent = nullptr); DialogTriangle(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogTriangle(); ~DialogTriangle();
quint32 getAxisP1Id() const; quint32 getAxisP1Id() const;

View File

@ -37,8 +37,8 @@
* @param data container with data * @param data container with data
* @param parent parent widget * @param parent parent widget
*/ */
DialogUnionDetails::DialogUnionDetails(const VContainer *data, QWidget *parent) : DialogUnionDetails::DialogUnionDetails(const VContainer *data, const quint32 &toolId, QWidget *parent)
DialogTool(data, parent), ui(new Ui::DialogUnionDetails), indexD1(0), indexD2(0), d1(0), d2(0), numberD(0), :DialogTool(data, toolId, parent), ui(new Ui::DialogUnionDetails), indexD1(0), indexD2(0), d1(0), d2(0), numberD(0),
numberP(0), p1(0), p2(0) numberP(0), p1(0), p2(0)
{ {
ui->setupUi(this); ui->setupUi(this);

View File

@ -43,7 +43,7 @@ class DialogUnionDetails : public DialogTool
{ {
Q_OBJECT Q_OBJECT
public: public:
DialogUnionDetails(const VContainer *data, QWidget *parent = nullptr); DialogUnionDetails(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogUnionDetails(); ~DialogUnionDetails();
quint32 getD1() const; quint32 getD1() const;

View File

@ -259,7 +259,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
QCursor cur(pixmap, 2, 3); QCursor cur(pixmap, 2, 3);
view->setCursor(cur); view->setCursor(cur);
helpLabel->setText(toolTip); helpLabel->setText(toolTip);
dialogTool = new Dialog(pattern, this); dialogTool = new Dialog(pattern, 0, this);
connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject); connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject);
connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot); connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot);
connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip); connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
@ -297,7 +297,7 @@ void MainWindow::SetToolButtonWithApply(bool checked, Tool t, const QString &cur
QCursor cur(pixmap, 2, 3); QCursor cur(pixmap, 2, 3);
view->setCursor(cur); view->setCursor(cur);
helpLabel->setText(toolTip); helpLabel->setText(toolTip);
dialogTool = new Dialog(pattern, this); dialogTool = new Dialog(pattern, 0, this);
connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject); connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject);
connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot); connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot);
connect(dialogTool, &DialogTool::DialogApplied, this, applyDialogSlot); connect(dialogTool, &DialogTool::DialogApplied, this, applyDialogSlot);

View File

@ -173,12 +173,14 @@ void VDrawTool::SetFactor(qreal factor)
* *
* Try calculate formula. If find error show dialog that allow user try fix formula. If user can't throw exception. In * Try calculate formula. If find error show dialog that allow user try fix formula. If user can't throw exception. In
* successes case return result calculation and fixed formula string. If formula ok don't touch formula. * successes case return result calculation and fixed formula string. If formula ok don't touch formula.
*
* @param toolId[in] tool's id.
* @param formula [in|out] string with formula. * @param formula [in|out] string with formula.
* @param data [in] container with variables. Need for math parser. * @param data [in] container with variables. Need for math parser.
* @throw QmuParserError. * @throw QmuParserError.
* @return result of calculation formula. * @return result of calculation formula.
*/ */
qreal VDrawTool::CheckFormula(QString &formula, VContainer *data) qreal VDrawTool::CheckFormula(const quint32 &toolId, QString &formula, VContainer *data)
{ {
SCASSERT(data != nullptr) SCASSERT(data != nullptr)
qreal result = 0; qreal result = 0;
@ -206,7 +208,7 @@ qreal VDrawTool::CheckFormula(QString &formula, VContainer *data)
delete dialogUndo; delete dialogUndo;
if (resultUndo == UndoButton::Fix) if (resultUndo == UndoButton::Fix)
{ {
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, qApp->getMainWindow()); DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, qApp->getMainWindow());
dialog->setFormula(formula); dialog->setFormula(formula);
if (dialog->exec() == QDialog::Accepted) if (dialog->exec() == QDialog::Accepted)
{ {

View File

@ -55,7 +55,7 @@ public:
virtual void setDialog() {} virtual void setDialog() {}
virtual void DialogLinkDestroy(); virtual void DialogLinkDestroy();
void ignoreContextMenu(bool enable); void ignoreContextMenu(bool enable);
static qreal CheckFormula(QString &formula, VContainer *data); static qreal CheckFormula(const quint32 &toolId, QString &formula, VContainer *data);
public slots: public slots:
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable); virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
virtual void ChangedActivDraw(const QString &newName); virtual void ChangedActivDraw(const QString &newName);
@ -118,7 +118,7 @@ protected:
QAction *selectedAction = menu.exec(event->screenPos()); QAction *selectedAction = menu.exec(event->screenPos());
if (selectedAction == actionOption) if (selectedAction == actionOption)
{ {
dialog = new Dialog(getData(), qApp->getMainWindow()); dialog = new Dialog(getData(), id, qApp->getMainWindow());
dialog->setModal(true); dialog->setModal(true);
connect(dialog, &DialogTool::DialogClosed, tool, &Tool::FullUpdateFromGuiOk); connect(dialog, &DialogTool::DialogClosed, tool, &Tool::FullUpdateFromGuiOk);

View File

@ -253,7 +253,7 @@ VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointNa
const VPointF *secondPoint = data->GeometricObject<const VPointF *>(secondPointId); const VPointF *secondPoint = data->GeometricObject<const VPointF *>(secondPointId);
QLineF line = QLineF(firstPoint->toQPointF(), secondPoint->toQPointF()); QLineF line = QLineF(firstPoint->toQPointF(), secondPoint->toQPointF());
line.setLength(qApp->toPixel(CheckFormula(formula, data))); line.setLength(qApp->toPixel(CheckFormula(_id, formula, data)));
quint32 id = _id; quint32 id = _id;
if (typeCreation == Source::FromGui) if (typeCreation == Source::FromGui)

View File

@ -129,10 +129,10 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 &center, QString &ra
{ {
qreal calcRadius = 0, calcF1 = 0, calcF2 = 0; qreal calcRadius = 0, calcF1 = 0, calcF2 = 0;
calcRadius = qApp->toPixel(CheckFormula(radius, data)); calcRadius = qApp->toPixel(CheckFormula(_id, radius, data));
calcF1 = CheckFormula(f1, data); calcF1 = CheckFormula(_id, f1, data);
calcF2 = CheckFormula(f2, data); calcF2 = CheckFormula(_id, f2, data);
VPointF c = *data->GeometricObject<const VPointF *>(center); VPointF c = *data->GeometricObject<const VPointF *>(center);
VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 ); VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 );

View File

@ -176,7 +176,7 @@ VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const
const VPointF *secondPoint = data->GeometricObject<const VPointF *>(secondPointId); const VPointF *secondPoint = data->GeometricObject<const VPointF *>(secondPointId);
const VPointF *thirdPoint = data->GeometricObject<const VPointF *>(thirdPointId); const VPointF *thirdPoint = data->GeometricObject<const VPointF *>(thirdPointId);
const qreal result = CheckFormula(formula, data); const qreal result = CheckFormula(_id, formula, data);
QPointF fPoint = VToolBisector::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(), QPointF fPoint = VToolBisector::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(),
thirdPoint->toQPointF(), qApp->toPixel(result)); thirdPoint->toQPointF(), qApp->toPixel(result));

View File

@ -127,7 +127,7 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS
{ {
const VArc *arc = data->GeometricObject<const VArc *>(arcId); const VArc *arc = data->GeometricObject<const VArc *>(arcId);
const qreal result = CheckFormula(formula, data); const qreal result = CheckFormula(_id, formula, data);
VArc arc1; VArc arc1;
VArc arc2; VArc arc2;

View File

@ -121,7 +121,7 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName, QString
{ {
const VSpline *spl = data->GeometricObject<const VSpline *>(splineId); const VSpline *spl = data->GeometricObject<const VSpline *>(splineId);
const qreal result = CheckFormula(formula, data); const qreal result = CheckFormula(_id, formula, data);
QPointF spl1p2, spl1p3, spl2p2, spl2p3; QPointF spl1p2, spl1p3, spl2p2, spl2p3;
QPointF point = spl->CutSpline(qApp->toPixel(result), spl1p2, spl1p3, spl2p2, spl2p3); QPointF point = spl->CutSpline(qApp->toPixel(result), spl1p2, spl1p3, spl2p2, spl2p3);

View File

@ -125,7 +125,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QSt
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(splinePathId); const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(splinePathId);
SCASSERT(splPath != nullptr); SCASSERT(splPath != nullptr);
const qreal result = CheckFormula(formula, data); const qreal result = CheckFormula(_id, formula, data);
quint32 id = _id; quint32 id = _id;
QPointF spl1p2, spl1p3, spl2p2, spl2p3; QPointF spl1p2, spl1p3, spl2p2, spl2p3;

View File

@ -138,7 +138,7 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName,
const VPointF *basePoint = data->GeometricObject<const VPointF *>(basePointId); const VPointF *basePoint = data->GeometricObject<const VPointF *>(basePointId);
QLineF line = QLineF(basePoint->toQPointF(), QPointF(basePoint->x()+100, basePoint->y())); QLineF line = QLineF(basePoint->toQPointF(), QPointF(basePoint->x()+100, basePoint->y()));
line.setLength(qApp->toPixel(CheckFormula(formula, data))); line.setLength(qApp->toPixel(CheckFormula(_id, formula, data)));
line.setAngle(angle); line.setAngle(angle);
quint32 id = _id; quint32 id = _id;
if (typeCreation == Source::FromGui) if (typeCreation == Source::FromGui)

View File

@ -138,7 +138,7 @@ VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quin
const VPointF *firstPoint = data->GeometricObject<const VPointF *>(firstPointId); const VPointF *firstPoint = data->GeometricObject<const VPointF *>(firstPointId);
const VPointF *secondPoint = data->GeometricObject<const VPointF *>(secondPointId); const VPointF *secondPoint = data->GeometricObject<const VPointF *>(secondPointId);
const qreal result = CheckFormula(formula, data); const qreal result = CheckFormula(_id, formula, data);
QPointF fPoint = VToolNormal::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(), QPointF fPoint = VToolNormal::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(),
qApp->toPixel(result), angle); qApp->toPixel(result), angle);

View File

@ -171,7 +171,7 @@ VToolPointOfContact* VToolPointOfContact::Create(const quint32 _id, QString &rad
const VPointF *firstP = data->GeometricObject<const VPointF *>(firstPointId); const VPointF *firstP = data->GeometricObject<const VPointF *>(firstPointId);
const VPointF *secondP = data->GeometricObject<const VPointF *>(secondPointId); const VPointF *secondP = data->GeometricObject<const VPointF *>(secondPointId);
const qreal result = CheckFormula(radius, data); const qreal result = CheckFormula(_id, radius, data);
QPointF fPoint = VToolPointOfContact::FindPoint(qApp->toPixel(result), centerP->toQPointF(), QPointF fPoint = VToolPointOfContact::FindPoint(qApp->toPixel(result), centerP->toQPointF(),
firstP->toQPointF(), secondP->toQPointF()); firstP->toQPointF(), secondP->toQPointF());

View File

@ -176,7 +176,7 @@ VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formu
const VPointF *secondPoint = data->GeometricObject<const VPointF *>(p2Line); const VPointF *secondPoint = data->GeometricObject<const VPointF *>(p2Line);
const VPointF *shoulderPoint = data->GeometricObject<const VPointF *>(pShoulder); const VPointF *shoulderPoint = data->GeometricObject<const VPointF *>(pShoulder);
const qreal result = CheckFormula(formula, data); const qreal result = CheckFormula(_id, formula, data);
QPointF fPoint = VToolShoulderPoint::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(), QPointF fPoint = VToolShoulderPoint::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(),
shoulderPoint->toQPointF(), qApp->toPixel(result)); shoulderPoint->toQPointF(), qApp->toPixel(result));

View File

@ -326,7 +326,6 @@ void VAbstractTool::LineCoefficients(const QLineF &line, qreal *a, qreal *b, qre
*/ */
const QStringList VAbstractTool::Styles() const QStringList VAbstractTool::Styles()
{ {
//Keep synchronize with DialogTool lineStyles list!!!
QStringList styles{TypeLineNone, TypeLineLine, TypeLineDashLine, TypeLineDotLine, TypeLineDashDotLine, QStringList styles{TypeLineNone, TypeLineLine, TypeLineDashLine, TypeLineDotLine, TypeLineDashDotLine,
TypeLineDashDotDotLine}; TypeLineDashDotDotLine};
return styles; return styles;

View File

@ -405,7 +405,7 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
QAction *selectedAction = menu.exec(event->screenPos()); QAction *selectedAction = menu.exec(event->screenPos());
if (selectedAction == actionOption) if (selectedAction == actionOption)
{ {
dialog = new DialogDetail(getData(), qApp->getMainWindow()); dialog = new DialogDetail(getData(), id, qApp->getMainWindow());
dialog->setModal(true); dialog->setModal(true);
connect(qobject_cast< VMainGraphicsScene * >(this->scene()), &VMainGraphicsScene::ChoosedObject, connect(qobject_cast< VMainGraphicsScene * >(this->scene()), &VMainGraphicsScene::ChoosedObject,
dialog, &DialogTool::ChosenObject); dialog, &DialogTool::ChosenObject);