Refactoring. Visualization for VToolHeight.

--HG--
branch : develop
This commit is contained in:
dismine 2014-08-13 13:20:30 +03:00
parent fe5104db01
commit 043b9a4742
47 changed files with 209 additions and 385 deletions

View File

@ -165,22 +165,6 @@ void DialogAlongLine::ChosenObject(quint32 id, const SceneObject &type)
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogAlongLine::DialogAccepted()
{
this->SaveData();
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogAlongLine::DialogApply()
{
this->SaveData();
emit DialogApplied();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogAlongLine::SaveData()
{

View File

@ -63,11 +63,6 @@ public:
void setSecondPointId(const quint32 &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
virtual void DialogAccepted();
/**
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply();
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
@ -79,6 +74,10 @@ public slots:
void PointChanged();
protected:
virtual void ShowVisualization();
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData();
private:
Q_DISABLE_COPY(DialogAlongLine)
@ -106,11 +105,6 @@ private:
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight;
VisToolAlongLine *line;
/**
* @brief SaveData Put dialog data in local variables
*/
void SaveData();
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -190,22 +190,6 @@ void DialogArc::ChosenObject(quint32 id, const SceneObject &type)
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogArc::DialogAccepted()
{
this->SaveData();
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::DialogApply()
{
this->SaveData();
emit DialogApplied();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::SaveData()
{

View File

@ -59,11 +59,6 @@ public:
void SetF2(const QString &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply();
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
@ -81,6 +76,10 @@ public slots:
void F2Changed();
protected:
virtual void CheckState();
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData();
private:
Q_DISABLE_COPY(DialogArc)
@ -126,10 +125,7 @@ private:
void EvalF1();
void EvalF2();
void ShowLineAngles();
/**
* @brief SaveData Put dialog data in local variables
*/
void SaveData();
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -268,22 +268,6 @@ void DialogBisector::setThirdPointId(const quint32 &value)
line->setPoint3Id(thirdPointId);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogBisector::DialogAccepted()
{
this->SaveData();
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogBisector::DialogApply()
{
this->SaveData();
emit DialogApplied();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogBisector::SaveData()
{

View File

@ -68,11 +68,6 @@ public:
void setThirdPointId(const quint32 &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
virtual void DialogAccepted();
/**
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply();
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
@ -84,6 +79,10 @@ public slots:
virtual void PointNameChanged();
protected:
virtual void ShowVisualization();
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData();
private:
Q_DISABLE_COPY(DialogBisector)
@ -116,10 +115,6 @@ private:
VisToolBisector *line;
bool prepare;
/**
* @brief SaveData Put dialog data in local variables
*/
void SaveData();
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -100,22 +100,6 @@ void DialogCutArc::ChosenObject(quint32 id, const SceneObject &type)
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogCutArc::DialogAccepted()
{
this->SaveData();
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCutArc::DialogApply()
{
this->SaveData();
emit DialogApplied();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCutArc::SaveData()
{

View File

@ -57,19 +57,19 @@ public:
void setArcId(const quint32 &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
virtual void DialogAccepted();
/**
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply();
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
void DeployFormulaTextEdit();
void DeployFormulaTextEdit();
/**
* @brief FormulaTextChanged when formula text changes for validation and calc
*/
void FormulaTextChanged();
void FormulaTextChanged();
protected:
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData();
private:
Q_DISABLE_COPY(DialogCutArc)
/** @brief ui keeps information about user interface */
@ -86,10 +86,7 @@ private:
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight;
/**
* @brief SaveData Put dialog data in local variables
*/
void SaveData();
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -126,16 +126,12 @@ void DialogCutSpline::ChosenObject(quint32 id, const SceneObject &type)
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogCutSpline::DialogAccepted()
void DialogCutSpline::SaveData()
{
pointName = ui->lineEditNamePoint->text();
formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n", " ");
splineId = getCurrentObjectId(ui->comboBoxSpline);
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -56,15 +56,15 @@ public:
void setSplineId(const quint32 &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
void DeployFormulaTextEdit();
void DeployFormulaTextEdit();
protected:
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData();
private:
Q_DISABLE_COPY(DialogCutSpline)
@ -81,7 +81,7 @@ private:
quint32 splineId;
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight;
int formulaBaseHeight;
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -126,16 +126,12 @@ void DialogCutSplinePath::ChosenObject(quint32 id, const SceneObject &type)
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogCutSplinePath::DialogAccepted()
void DialogCutSplinePath::SaveData()
{
pointName = ui->lineEditNamePoint->text();
formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n", " ");
splinePathId = getCurrentObjectId(ui->comboBoxSplinePath);
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -56,15 +56,15 @@ public:
void setSplinePathId(const quint32 &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
void DeployFormulaTextEdit();
void DeployFormulaTextEdit();
protected:
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData();
private:
Q_DISABLE_COPY(DialogCutSplinePath)

View File

@ -110,10 +110,7 @@ void DialogDetail::ChosenObject(quint32 id, const SceneObject &type)
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogDetail::DialogAccepted()
void DialogDetail::SaveData()
{
details.Clear();
for (qint32 i = 0; i < ui.listWidget->count(); ++i)
@ -125,8 +122,6 @@ void DialogDetail::DialogAccepted()
details.setName(ui.lineEditNameDetail->text());
details.setSeamAllowance(supplement);
details.setClosed(closed);
emit ToolTip("");
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -46,11 +46,6 @@ public:
void setDetails(const VDetail &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
void BiasXChanged(qreal d);
void BiasYChanged(qreal d);
void ClickedSeams(bool checked);
@ -58,6 +53,11 @@ public slots:
void ObjectChanged(int row);
void DeleteItem();
virtual void UpdateList();
protected:
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData();
private:
/** @brief ui keeps information about user interface */

View File

@ -268,22 +268,6 @@ void DialogEndLine::ShowVisualization()
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogEndLine::DialogAccepted()
{
this->SaveData();
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::DialogApply()
{
this->SaveData();
emit DialogApplied();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::SaveData()
{

View File

@ -65,11 +65,6 @@ public:
virtual void ShowDialog(bool click);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
virtual void DialogAccepted();
/**
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply();
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
@ -83,7 +78,11 @@ public slots:
void AngleTextChanged();
void DeployAngleTextEdit();
protected:
virtual void ShowVisualization();
virtual void ShowVisualization();
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData();
private:
Q_DISABLE_COPY(DialogEndLine)
@ -111,10 +110,7 @@ private:
VisToolEndLine *line;
/**
* @brief SaveData Put dialog data in local variables
*/
void SaveData();
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -32,6 +32,8 @@
#include "../../geometry/vpointf.h"
#include "../../container/vcontainer.h"
#include "../../tools/vabstracttool.h"
#include "../visualization/vistoolheight.h"
#include "../widgets/vmaingraphicsscene.h"
//---------------------------------------------------------------------------------------------------------------------
/**
@ -41,11 +43,11 @@
*/
DialogHeight::DialogHeight(const VContainer *data, const quint32 &toolId, QWidget *parent)
: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), line(nullptr)
{
ui->setupUi(this);
labelEditNamePoint = ui->labelEditNamePoint;
InitOkCancel(ui);
InitOkCancelApply(ui);
flagName = false;
CheckState();
@ -61,11 +63,13 @@ DialogHeight::DialogHeight(const VContainer *data, const quint32 &toolId, QWidge
connect(ui->comboBoxP2Line, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogHeight::PointNameChanged);
line = new VisToolHeight(data);
}
//---------------------------------------------------------------------------------------------------------------------
DialogHeight::~DialogHeight()
{
delete line;
delete ui;
}
@ -89,6 +93,7 @@ void DialogHeight::setTypeLine(const QString &value)
{
typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value);
line->setLineStyle(VAbstractTool::LineStyle(typeLine));
}
//---------------------------------------------------------------------------------------------------------------------
@ -99,6 +104,7 @@ void DialogHeight::setTypeLine(const QString &value)
void DialogHeight::setBasePointId(const quint32 &value)
{
setPointId(ui->comboBoxBasePoint, basePointId, value);
line->setPoint1Id(basePointId);
}
//---------------------------------------------------------------------------------------------------------------------
@ -109,6 +115,7 @@ void DialogHeight::setBasePointId(const quint32 &value)
void DialogHeight::setP1LineId(const quint32 &value)
{
setPointId(ui->comboBoxP1Line, p1LineId, value);
line->setLineP1Id(p1LineId);
}
//---------------------------------------------------------------------------------------------------------------------
@ -119,6 +126,7 @@ void DialogHeight::setP1LineId(const quint32 &value)
void DialogHeight::setP2LineId(const quint32 &value)
{
setPointId(ui->comboBoxP2Line, p2LineId, value);
line->setLineP2Id(p2LineId);
}
//---------------------------------------------------------------------------------------------------------------------
@ -137,17 +145,23 @@ void DialogHeight::ChosenObject(quint32 id, const SceneObject &type)
case (0):
ChangeCurrentText(ui->comboBoxBasePoint, point->name());
number++;
line->VisualMode(id);
emit ToolTip(tr("Select first point of line"));
break;
case (1):
ChangeCurrentText(ui->comboBoxP1Line, point->name());
number++;
line->setLineP1Id(id);
line->RefreshGeometry();
emit ToolTip(tr("Select second point of line"));
break;
case (2):
ChangeCurrentText(ui->comboBoxP2Line, point->name());
number = 0;
emit ToolTip(tr(""));
emit ToolTip("");
line->setLineP2Id(id);
line->RefreshGeometry();
prepare = true;
if (isInitialized == false)
{
this->setModal(true);
@ -161,17 +175,19 @@ void DialogHeight::ChosenObject(quint32 id, const SceneObject &type)
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogHeight::DialogAccepted()
void DialogHeight::SaveData()
{
pointName = ui->lineEditNamePoint->text();
typeLine = GetTypeLine(ui->comboBoxLineType);
basePointId = getCurrentObjectId(ui->comboBoxBasePoint);
p1LineId = getCurrentObjectId(ui->comboBoxP1Line);
p2LineId = getCurrentObjectId(ui->comboBoxP2Line);
emit DialogClosed(QDialog::Accepted);
line->setPoint1Id(basePointId);
line->setLineP1Id(p1LineId);
line->setLineP2Id(p2LineId);
line->setLineStyle(VAbstractTool::LineStyle(typeLine));
line->RefreshGeometry();
}
//---------------------------------------------------------------------------------------------------------------------
@ -216,3 +232,15 @@ void DialogHeight::UpdateList()
* This dialog doesn't work with formula. Don't delete. Help avoid crash.
*/
}
//---------------------------------------------------------------------------------------------------------------------
void DialogHeight::ShowVisualization()
{
if (prepare == false)
{
VMainGraphicsScene *scene = qApp->getCurrentScene();
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
scene->addItem(line);
line->RefreshGeometry();
}
}

View File

@ -36,6 +36,8 @@ namespace Ui
class DialogHeight;
}
class VisToolHeight;
/**
* @brief The DialogHeight class dialog for ToolHeight. Help create point and edit option.
*/
@ -62,13 +64,14 @@ public:
void setP2LineId(const quint32 &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
virtual void PointNameChanged();
virtual void UpdateList();
protected:
virtual void ShowVisualization();
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData();
private:
Q_DISABLE_COPY(DialogHeight)
@ -85,13 +88,14 @@ private:
QString typeLine;
/** @brief basePointId id base point of height */
quint32 basePointId;
quint32 basePointId;
/** @brief p1LineId id first point of line */
quint32 p1LineId;
quint32 p1LineId;
/** @brief p2LineId id second point of line */
quint32 p2LineId;
quint32 p2LineId;
VisToolHeight *line;
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>247</width>
<width>285</width>
<height>220</height>
</rect>
</property>
@ -174,7 +174,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>

View File

@ -104,23 +104,6 @@ void DialogLine::setFirstPoint(const quint32 &value)
line->setPoint1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogLine::DialogAccepted()
{
this->SaveData();
DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLine::DialogApply()
{
this->SaveData();
emit DialogApplied();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLine::PointNameChanged()
{

View File

@ -58,15 +58,14 @@ public:
void setTypeLine(const QString &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
virtual void DialogAccepted();
/**
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply();
virtual void PointNameChanged();
virtual void UpdateList();
protected:
virtual void ShowVisualization();
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData();
private:
Q_DISABLE_COPY(DialogLine)
@ -85,10 +84,7 @@ private:
/** @brief typeLine type of line */
QString typeLine;
VisToolLine *line;
/**
* @brief SaveData Put dialog data in local variables
*/
void SaveData();
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -151,17 +151,13 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogLineIntersect::DialogAccepted()
void DialogLineIntersect::SaveData()
{
pointName = ui->lineEditNamePoint->text();
p1Line1 = getCurrentObjectId(ui->comboBoxP1Line1);
p2Line1 = getCurrentObjectId(ui->comboBoxP2Line1);
p1Line2 = getCurrentObjectId(ui->comboBoxP1Line2);
p2Line2 = getCurrentObjectId(ui->comboBoxP2Line2);
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -62,17 +62,17 @@ public:
void setPointName(const QString &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
void P1Line1Changed( int index);
void P2Line1Changed( int index);
void P1Line2Changed( int index);
void P2Line2Changed( int index);
virtual void PointNameChanged();
virtual void UpdateList();
protected:
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData();
private:
Q_DISABLE_COPY(DialogLineIntersect)
@ -86,16 +86,16 @@ private:
QString pointName;
/** @brief p1Line1 id first point of first line */
quint32 p1Line1;
quint32 p1Line1;
/** @brief p2Line1 id second point of first line */
quint32 p2Line1;
quint32 p2Line1;
/** @brief p1Line2 id first point of second line */
quint32 p1Line2;
quint32 p1Line2;
/** @brief p2Line2 id second point of second line */
quint32 p2Line2;
quint32 p2Line2;
/** @brief flagPoint keep state of point */
bool flagPoint;

View File

@ -163,22 +163,6 @@ void DialogNormal::ChosenObject(quint32 id, const SceneObject &type)
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogNormal::DialogAccepted()
{
this->SaveData();
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogNormal::DialogApply()
{
this->SaveData();
emit DialogApplied();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogNormal::SaveData()
{

View File

@ -67,11 +67,6 @@ public:
void setSecondPointId(const quint32 &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
virtual void DialogAccepted();
/**
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply();
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
@ -83,6 +78,10 @@ public slots:
virtual void PointNameChanged();
protected:
virtual void ShowVisualization();
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData();
private:
Q_DISABLE_COPY(DialogNormal)
@ -114,11 +113,6 @@ private:
int formulaBaseHeight;
VisToolNormal *line;
/**
* @brief SaveData Put dialog data in local variables
*/
void SaveData();
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -175,22 +175,6 @@ void DialogPointOfContact::ChosenObject(quint32 id, const SceneObject &type)
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogPointOfContact::DialogAccepted()
{
this->SaveData();
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfContact::DialogApply()
{
this->SaveData();
emit DialogApplied();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfContact::SaveData()
{

View File

@ -61,11 +61,6 @@ public:
void setSecondPoint(const quint32 &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
virtual void DialogAccepted();
/**
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply();
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
@ -75,6 +70,11 @@ public slots:
*/
void FormulaTextChanged();
virtual void PointNameChanged();
protected:
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData();
private:
Q_DISABLE_COPY(DialogPointOfContact)
@ -101,11 +101,6 @@ private:
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight;
/**
* @brief SaveData Put dialog data in local variables
*/
void SaveData();
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -116,15 +116,11 @@ void DialogPointOfIntersection::ChosenObject(quint32 id, const SceneObject &type
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogPointOfIntersection::DialogAccepted()
void DialogPointOfIntersection::SaveData()
{
pointName = ui->lineEditNamePoint->text();
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -56,13 +56,13 @@ public:
void setSecondPointId(const quint32 &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
virtual void PointNameChanged();
virtual void UpdateList();
protected:
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData();
private:
Q_DISABLE_COPY(DialogPointOfIntersection)

View File

@ -195,22 +195,6 @@ void DialogShoulderPoint::ChosenObject(quint32 id, const SceneObject &type)
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogShoulderPoint::DialogAccepted()
{
this->SaveData();
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogShoulderPoint::DialogApply()
{
this->SaveData();
emit DialogApplied();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogShoulderPoint::SaveData()
{

View File

@ -67,11 +67,6 @@ public:
void setPShoulder(const quint32 &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
virtual void DialogAccepted();
/**
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply();
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
@ -83,6 +78,10 @@ public slots:
virtual void PointNameChanged();
protected:
virtual void ShowVisualization();
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData();
private:
Q_DISABLE_COPY(DialogShoulderPoint)
@ -113,11 +112,6 @@ private:
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight;
VisToolShoulderPoint *line;
/**
* @brief SaveData Put dialog data in local variables
*/
void SaveData();
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -71,14 +71,10 @@ void DialogSinglePoint::mousePress(const QPointF &scenePos)
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogSinglePoint::DialogAccepted()
void DialogSinglePoint::SaveData()
{
point = QPointF(qApp->toPixel(ui->doubleSpinBoxX->value()), qApp->toPixel(ui->doubleSpinBoxY->value()));
name = ui->lineEditName->text();
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -50,12 +50,12 @@ public:
QPointF getPoint()const;
public slots:
void mousePress(const QPointF &scenePos);
virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
virtual void UpdateList();
protected:
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData();
private:
Q_DISABLE_COPY(DialogSinglePoint)

View File

@ -118,10 +118,7 @@ void DialogSpline::ChosenObject(quint32 id, const SceneObject &type)
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogSpline::DialogAccepted()
void DialogSpline::SaveData()
{
p1 = getCurrentObjectId(ui->comboBoxP1);
p4 = getCurrentObjectId(ui->comboBoxP4);
@ -130,7 +127,6 @@ void DialogSpline::DialogAccepted()
kAsm1 = ui->doubleSpinBoxKasm1->value();
kAsm2 = ui->doubleSpinBoxKasm2->value();
kCurve = ui->doubleSpinBoxKcurve->value();
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -46,10 +46,10 @@ public:
DialogSpline(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
~DialogSpline();
quint32 getP1() const;
quint32 getP1() const;
void setP1(const quint32 &value);
quint32 getP4() const;
quint32 getP4() const;
void setP4(const quint32 &value);
qreal getAngle1() const;
@ -68,13 +68,13 @@ public:
void setKCurve(const qreal &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
virtual void PointNameChanged();
virtual void UpdateList();
protected:
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData();
private:
Q_DISABLE_COPY(DialogSpline)

View File

@ -99,10 +99,7 @@ void DialogSplinePath::ChosenObject(quint32 id, const SceneObject &type)
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogSplinePath::DialogAccepted()
void DialogSplinePath::SaveData()
{
path.Clear();
for (qint32 i = 0; i < ui->listWidget->count(); ++i)
@ -111,8 +108,6 @@ void DialogSplinePath::DialogAccepted()
path.append( qvariant_cast<VSplinePoint>(item->data(Qt::UserRole)));
}
path.setKCurve(ui->doubleSpinBoxKcurve->value());
emit ToolTip("");
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -51,11 +51,6 @@ public:
void SetPath(const VSplinePath &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
void PointChanged(int row);
void currentPointChanged( int index );
void Angle1Changed(qreal index );
@ -63,6 +58,11 @@ public slots:
void KAsm1Changed(qreal d);
void KAsm2Changed(qreal d);
virtual void UpdateList();
protected:
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData();
private:
Q_DISABLE_COPY(DialogSplinePath)

View File

@ -71,6 +71,13 @@ DialogTool::DialogTool(const VContainer *data, const quint32 &toolId, QWidget *p
this->setWindowFlags(Qt::Tool | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint);
}
//---------------------------------------------------------------------------------------------------------------------
DialogTool::~DialogTool()
{
emit ToolTip("");
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief closeEvent handle when dialog cloded
@ -703,9 +710,17 @@ void DialogTool::setPointId(QComboBox *box, quint32 &pointId, const quint32 &val
*/
void DialogTool::DialogAccepted()
{
SaveData();
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::DialogApply()
{
SaveData();
emit DialogApplied();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogRejected emit signal dialog rejected

View File

@ -56,7 +56,7 @@ class DialogTool : public QDialog
Q_OBJECT
public:
DialogTool(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
virtual ~DialogTool() {}
virtual ~DialogTool();
VAbstractTool* GetAssociatedTool();
void SetAssociatedTool(VAbstractTool* tool);
@ -74,7 +74,7 @@ signals:
/**
* @brief DialogApplied emit signal dialog apply changes
*/
void DialogApplied();
void DialogApplied();
/**
* @brief ToolTip emit tooltipe for tool
* @param toolTip text tooltipe
@ -88,7 +88,7 @@ public slots:
/**
* @brief DialogApply save data and emit signal DialogApplied.
*/
virtual void DialogApply(){}
virtual void DialogApply();
virtual void DialogRejected();
void FormulaChanged();
/**
@ -320,6 +320,10 @@ protected:
void ChangeColor(QWidget *widget, const QColor &color);
void setPointId(QComboBox *box, quint32 &pointId, const quint32 &value);
virtual void ShowVisualization(){}
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData(){}
private:
void FillList(QComboBox *box, const QMap<QString, quint32> &list)const;
};

View File

@ -115,17 +115,13 @@ void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogTriangle::DialogAccepted()
void DialogTriangle::SaveData()
{
pointName = ui->lineEditNamePoint->text();
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
axisP1Id = getCurrentObjectId(ui->comboBoxAxisP1);
axisP2Id = getCurrentObjectId(ui->comboBoxAxisP2);
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -62,12 +62,12 @@ public:
void setPointName(const QString &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type);
virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
virtual void PointNameChanged();
protected:
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData();
private:
Q_DISABLE_COPY(DialogTriangle)

View File

@ -69,15 +69,6 @@ void DialogUnionDetails::ChosenObject(quint32 id, const SceneObject &type)
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
void DialogUnionDetails::DialogAccepted()
{
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogUnionDetails::UpdateList()
{

View File

@ -52,11 +52,6 @@ public:
ptrdiff_t getIndexD2() const;
public slots:
void ChosenObject(quint32 id, const SceneObject &type);
virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
virtual void UpdateList();
private:
Q_DISABLE_COPY(DialogUnionDetails)

View File

@ -568,8 +568,9 @@ void MainWindow::ClosedDialogDetail(int result)
*/
void MainWindow::ToolHeight(bool checked)
{
SetToolButton<DialogHeight>(checked, Tool::Height, ":/cursor/height_cursor.png", tr("Select base point"),
&MainWindow::ClosedDialog<VToolHeight>);
SetToolButtonWithApply<DialogHeight>(checked, Tool::Height, ":/cursor/height_cursor.png", tr("Select base point"),
&MainWindow::ClosedDialogWithApply<VToolHeight>,
&MainWindow::ApplyDialog<VToolHeight>);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -85,9 +85,9 @@ void VToolHeight::setDialog()
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @return the created tool
*/
void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data)
VToolHeight* VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr);
DialogHeight *dialogTool = qobject_cast<DialogHeight*>(dialog);
@ -98,8 +98,15 @@ void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
const quint32 basePointId = dialogTool->getBasePointId();
const quint32 p1LineId = dialogTool->getP1LineId();
const quint32 p2LineId = dialogTool->getP2LineId();
Create(0, pointName, typeLine, basePointId, p1LineId, p2LineId, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
VToolHeight *point = nullptr;
point = Create(0, pointName, typeLine, basePointId, p1LineId, p2LineId, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
}
return point;
}
//---------------------------------------------------------------------------------------------------------------------
@ -118,11 +125,12 @@ void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
* @return the created tool
*/
void VToolHeight::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
VToolHeight* VToolHeight::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
{
const VPointF *basePoint = data->GeometricObject<const VPointF *>(basePointId);
const VPointF *p1Line = data->GeometricObject<const VPointF *>(p1LineId);
@ -161,7 +169,9 @@ void VToolHeight::Create(const quint32 _id, const QString &pointName, const QStr
doc->IncrementReferens(basePointId);
doc->IncrementReferens(p1LineId);
doc->IncrementReferens(p2LineId);
return point;
}
return nullptr;
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -43,11 +43,11 @@ public:
const quint32 &p1LineId, const quint32 &p2LineId, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
virtual void setDialog();
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
static void Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation);
static VToolHeight *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
static VToolHeight *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation);
static QPointF FindPoint(const QLineF &line, const QPointF &point);
static const QString ToolType;
public slots:

View File

@ -82,8 +82,10 @@ void VisToolHeight::RefreshGeometry()
DrawLine(line, base_line, supportColor);
QPointF height = VToolHeight::FindPoint(base_line, first->toQPointF());
DrawPoint(point, height, mainColor);
QLineF height_line(first->toQPointF(), height);
DrawLine(this, height_line, mainColor);
DrawLine(this, height_line, mainColor, lineStyle);
ShowIntersection(height_line, base_line);
}