First change for "apply button" (works only when modifying an existing point).

--HG--
branch : DialogTools
This commit is contained in:
Patrick Proy 2014-05-25 21:54:17 +02:00
parent 43fe3e1371
commit aa2eda12ee
45 changed files with 176 additions and 26 deletions

View File

@ -57,6 +57,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
/** /**
* @brief cellClicked changed history record * @brief cellClicked changed history record
* @param row number row in table * @param row number row in table

View File

@ -54,6 +54,10 @@ public:
DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent = nullptr); DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent = nullptr);
~DialogIncrements(); ~DialogIncrements();
public slots: public slots:
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
/** /**
* @brief clickedToolButtonAdd create new row in table * @brief clickedToolButtonAdd create new row in table
*/ */

View File

@ -43,7 +43,7 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, QWidget *parent)
flagFormula = false; flagFormula = false;
flagName = false; flagName = false;
InitOkCansel(ui); InitOkCancel(ui);
CheckState(); CheckState();
FillComboBoxTypeLine(ui->comboBoxLineType); FillComboBoxTypeLine(ui->comboBoxLineType);

View File

@ -113,6 +113,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
private: private:
Q_DISABLE_COPY(DialogAlongLine) Q_DISABLE_COPY(DialogAlongLine)
/** /**

View File

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

View File

@ -101,6 +101,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
/** /**
* @brief ValChenged show description angles of lines * @brief ValChenged show description angles of lines
* @param row number of row * @param row number of row

View File

@ -42,7 +42,7 @@ DialogBisector::DialogBisector(const VContainer *data, QWidget *parent)
lineEditFormula = ui->lineEditFormula; lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula; labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint; labelEditNamePoint = ui->labelEditNamePoint;
InitOkCansel(ui); InitOkCancel(ui);
flagFormula = false; flagFormula = false;
flagName = false; flagName = false;
CheckState(); CheckState();

View File

@ -124,6 +124,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
private: private:
Q_DISABLE_COPY(DialogBisector) Q_DISABLE_COPY(DialogBisector)
/** /**

View File

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

View File

@ -92,6 +92,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
private: private:
Q_DISABLE_COPY(DialogCutArc) Q_DISABLE_COPY(DialogCutArc)
/** /**

View File

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

View File

@ -92,6 +92,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
private: private:
Q_DISABLE_COPY(DialogCutSpline) Q_DISABLE_COPY(DialogCutSpline)
/** /**

View File

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

View File

@ -92,6 +92,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
private: private:
Q_DISABLE_COPY(DialogCutSplinePath) Q_DISABLE_COPY(DialogCutSplinePath)
/** /**

View File

@ -66,6 +66,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
/** /**
* @brief BiasXChanged changed value of offset for object respect to x * @brief BiasXChanged changed value of offset for object respect to x
* @param d value in mm * @param d value in mm

View File

@ -46,7 +46,7 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent)
// TODO : auto extend height on first value length. // TODO : auto extend height on first value length.
this->formulaBaseHeight=ui->plainTextEditFormula->height(); this->formulaBaseHeight=ui->plainTextEditFormula->height();
InitOkCansel(ui); InitOkCancel(ui);
flagFormula = false; flagFormula = false;
flagName = false; flagName = false;
CheckState(); CheckState();
@ -56,12 +56,14 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent)
InitArrow(ui); InitArrow(ui);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogEndLine::PutHere); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogEndLine::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogEndLine::PutVal); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogEndLine::PutVal);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogEndLine::EvalFormula); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogEndLine::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogEndLine::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogEndLine::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogEndLine::FormulaTextChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogEndLine::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogEndLine::DeployFormulaTextEdit); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogEndLine::DeployFormulaTextEdit);
//ui->
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -75,9 +77,9 @@ void DialogEndLine::FormulaTextChanged()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::DeployFormulaTextEdit() void DialogEndLine::DeployFormulaTextEdit()
{ {
if (ui->plainTextEditFormula->height() < 64) if (ui->plainTextEditFormula->height() < DIALOGENDLINE_MAX_FORMULA_HEIGHT)
{ {
ui->plainTextEditFormula->setFixedHeight(64); ui->plainTextEditFormula->setFixedHeight(DIALOGENDLINE_MAX_FORMULA_HEIGHT);
} }
else else
{ {
@ -115,6 +117,12 @@ void DialogEndLine::setTypeLine(const QString &value)
void DialogEndLine::setFormula(const QString &value) void DialogEndLine::setFormula(const QString &value)
{ {
formula = value; formula = value;
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formula.length() > 80)
{
this->DeployFormulaTextEdit();
}
ui->plainTextEditFormula->setPlainText(value); ui->plainTextEditFormula->setPlainText(value);
//QTextCursor cursor = ui->plainTextEditFormula->textCursor(); //QTextCursor cursor = ui->plainTextEditFormula->textCursor();
//cursor.insertText(value); //cursor.insertText(value);
@ -136,6 +144,19 @@ void DialogEndLine::setBasePointId(const quint32 &value, const quint32 &id)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::DialogAccepted() void DialogEndLine::DialogAccepted()
{
this->SaveData();
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::DialogApply()
{
this->SaveData();
emit DialogApplied();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::SaveData()
{ {
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();
typeLine = GetTypeLine(ui->comboBoxLineType); typeLine = GetTypeLine(ui->comboBoxLineType);
@ -143,7 +164,6 @@ void DialogEndLine::DialogAccepted()
formula.replace("\n"," "); formula.replace("\n"," ");
angle = ui->doubleSpinBoxAngle->value(); angle = ui->doubleSpinBoxAngle->value();
basePointId = getCurrentObjectId(ui->comboBoxBasePoint); basePointId = getCurrentObjectId(ui->comboBoxBasePoint);
emit DialogClosed(QDialog::Accepted);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -31,6 +31,8 @@
#include "dialogtool.h" #include "dialogtool.h"
#define DIALOGENDLINE_MAX_FORMULA_HEIGHT 64
namespace Ui namespace Ui
{ {
class DialogEndLine; class DialogEndLine;
@ -112,6 +114,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/**
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply();
/** /**
* @brief DeployFormulaTextEdit grow or shrink formula input * @brief DeployFormulaTextEdit grow or shrink formula input
*/ */
@ -122,6 +128,10 @@ public slots:
void FormulaTextChanged(); void FormulaTextChanged();
private: private:
Q_DISABLE_COPY(DialogEndLine) Q_DISABLE_COPY(DialogEndLine)
/**
* @brief SaveData Put dialog data in local variables
*/
void SaveData();
/** /**
* @brief ui keeps information about user interface * @brief ui keeps information about user interface
*/ */

View File

@ -593,7 +593,7 @@
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="standardButtons"> <property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> <set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property> </property>
</widget> </widget>
</item> </item>

View File

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

View File

@ -114,6 +114,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
private: private:
Q_DISABLE_COPY(DialogHeight) Q_DISABLE_COPY(DialogHeight)
/** /**

View File

@ -36,7 +36,7 @@ DialogLine::DialogLine(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0), typeLine(QString()) :DialogTool(data, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0), typeLine(QString())
{ {
ui->setupUi(this); ui->setupUi(this);
InitOkCansel(ui); InitOkCancel(ui);
FillComboBoxPoints(ui->comboBoxFirstPoint); FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint); FillComboBoxPoints(ui->comboBoxSecondPoint);

View File

@ -91,6 +91,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
private: private:
Q_DISABLE_COPY(DialogLine) Q_DISABLE_COPY(DialogLine)
/** /**

View File

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

View File

@ -111,6 +111,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
/** /**
* @brief P1Line1Changed changed first point of first line * @brief P1Line1Changed changed first point of first line
* @param index index in list * @param index index in list

View File

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

View File

@ -123,6 +123,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
private: private:
Q_DISABLE_COPY(DialogNormal) Q_DISABLE_COPY(DialogNormal)
/** /**

View File

@ -109,6 +109,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
private: private:
Q_DISABLE_COPY(DialogPointOfContact) Q_DISABLE_COPY(DialogPointOfContact)
/** /**

View File

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

View File

@ -93,6 +93,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
private: private:
Q_DISABLE_COPY(DialogPointOfIntersection) Q_DISABLE_COPY(DialogPointOfIntersection)
/** /**

View File

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

View File

@ -124,6 +124,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
private: private:
Q_DISABLE_COPY(DialogShoulderPoint) Q_DISABLE_COPY(DialogShoulderPoint)
/** /**

View File

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

View File

@ -76,6 +76,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
private: private:
Q_DISABLE_COPY(DialogSinglePoint) Q_DISABLE_COPY(DialogSinglePoint)
/** /**

View File

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

View File

@ -131,6 +131,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
private: private:
Q_DISABLE_COPY(DialogSpline) Q_DISABLE_COPY(DialogSpline)
/** /**

View File

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

View File

@ -76,6 +76,10 @@ public slots:
* @brief PointChanged selected another point in list * @brief PointChanged selected another point in list
* @param row number of row * @param row number of row
*/ */
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
void PointChanged(int row); void PointChanged(int row);
/** /**
* @brief currentPointChanged changed point in combo box * @brief currentPointChanged changed point in combo box

View File

@ -855,3 +855,9 @@ void DialogTool::ShowVariable(const QHash<key, val> *var)
connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
listWidget->setCurrentRow (0); listWidget->setCurrentRow (0);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::DialogApply()
{
}

View File

@ -75,6 +75,10 @@ signals:
* @param result keep result * @param result keep result
*/ */
void DialogClosed(int result); void DialogClosed(int result);
/**
* @brief DialogApplied emit signal dialog apply changes
*/
void DialogApplied();
/** /**
* @brief ToolTip emit tooltipe for tool * @brief ToolTip emit tooltipe for tool
* @param toolTip text tooltipe * @param toolTip text tooltipe
@ -95,6 +99,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/**
* @brief DialogApply save data and emit signal DialogApplied.
*/
virtual void DialogApply();
/** /**
* @brief DialogRejected emit signal dialog rejected * @brief DialogRejected emit signal dialog rejected
*/ */
@ -453,15 +461,19 @@ protected:
connect(radioButtonLengthCurve, &QRadioButton::clicked, this, &DialogTool::LengthCurves); connect(radioButtonLengthCurve, &QRadioButton::clicked, this, &DialogTool::LengthCurves);
} }
template <typename T> template <typename T>
void InitOkCansel(T *ui) void InitOkCancel(T *ui)
{ {
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
Q_CHECK_PTR(bOk); Q_CHECK_PTR(bOk);
connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted); connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted);
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
Q_CHECK_PTR(bCansel); Q_CHECK_PTR(bCancel);
connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected); connect(bCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
// TODO issue #79
QPushButton *bApply = ui->buttonBox->button(QDialogButtonBox::Apply);
Q_CHECK_PTR(bApply);
connect(bApply, &QPushButton::clicked, this, &DialogTool::DialogApply);
} }
private: private:
/** /**

View File

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

View File

@ -115,6 +115,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
private: private:
Q_DISABLE_COPY(DialogTriangle) Q_DISABLE_COPY(DialogTriangle)
/** /**

View File

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

View File

@ -81,6 +81,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.
*/ */
virtual void DialogAccepted(); virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
private: private:
Q_DISABLE_COPY(DialogUnionDetails) Q_DISABLE_COPY(DialogUnionDetails)
/** /**

View File

@ -94,6 +94,19 @@ void VDrawTool::FullUpdateFromGui(int result)
dialog = nullptr; dialog = nullptr;
} }
//---------------------------------------------------------------------------------------------------------------------
void VDrawTool::FullUpdateFromGuiApply()
{
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
SaveDialog(domElement);
emit FullUpdateTree();
emit toolhaveChange();
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VDrawTool::SetFactor(qreal factor) void VDrawTool::SetFactor(qreal factor)
{ {

View File

@ -84,6 +84,10 @@ public slots:
* @param result keep result working dialog. * @param result keep result working dialog.
*/ */
virtual void FullUpdateFromGui(int result); virtual void FullUpdateFromGui(int result);
/**
* @brief FullUpdateFromGuiApply refresh tool data after change in options but do not delete dialog
*/
virtual void FullUpdateFromGuiApply();
/** /**
* @brief SetFactor set current scale factor of scene. * @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor. * @param factor scene scale factor.
@ -157,6 +161,7 @@ protected:
connect(qobject_cast< VMainGraphicsScene * >(tool->scene()), connect(qobject_cast< VMainGraphicsScene * >(tool->scene()),
&VMainGraphicsScene::ChoosedObject, dialog, &DialogTool::ChoosedObject); &VMainGraphicsScene::ChoosedObject, dialog, &DialogTool::ChoosedObject);
connect(dialog, &DialogTool::DialogClosed, tool, &Tool::FullUpdateFromGui); connect(dialog, &DialogTool::DialogClosed, tool, &Tool::FullUpdateFromGui);
connect(dialog, &DialogTool::DialogApplied, tool, &Tool::FullUpdateFromGuiApply);
if (ignoreFullUpdate == false) if (ignoreFullUpdate == false)
{ {
connect(doc, &VPattern::FullUpdateFromFile, dialog, &DialogTool::UpdateList); connect(doc, &VPattern::FullUpdateFromFile, dialog, &DialogTool::UpdateList);