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.
*/
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
* @param row number row in table

View File

@ -54,6 +54,10 @@ public:
DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent = nullptr);
~DialogIncrements();
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
*/

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -66,6 +66,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
/**
* @brief BiasXChanged changed value of offset for object respect to x
* @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.
this->formulaBaseHeight=ui->plainTextEditFormula->height();
InitOkCansel(ui);
InitOkCancel(ui);
flagFormula = false;
flagName = false;
CheckState();
@ -56,12 +56,14 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent)
InitArrow(ui);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogEndLine::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogEndLine::PutVal);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogEndLine::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogEndLine::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogEndLine::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogEndLine::DeployFormulaTextEdit);
//ui->
}
//---------------------------------------------------------------------------------------------------------------------
@ -75,9 +77,9 @@ void DialogEndLine::FormulaTextChanged()
//---------------------------------------------------------------------------------------------------------------------
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
{
@ -115,6 +117,12 @@ void DialogEndLine::setTypeLine(const QString &value)
void DialogEndLine::setFormula(const QString &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);
//QTextCursor cursor = ui->plainTextEditFormula->textCursor();
//cursor.insertText(value);
@ -136,6 +144,19 @@ void DialogEndLine::setBasePointId(const quint32 &value, const quint32 &id)
//---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::DialogAccepted()
{
this->SaveData();
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::DialogApply()
{
this->SaveData();
emit DialogApplied();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::SaveData()
{
pointName = ui->lineEditNamePoint->text();
typeLine = GetTypeLine(ui->comboBoxLineType);
@ -143,7 +164,6 @@ void DialogEndLine::DialogAccepted()
formula.replace("\n"," ");
angle = ui->doubleSpinBoxAngle->value();
basePointId = getCurrentObjectId(ui->comboBoxBasePoint);
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------

View File

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

View File

@ -593,7 +593,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

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

View File

@ -114,6 +114,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
private:
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())
{
ui->setupUi(this);
InitOkCansel(ui);
InitOkCancel(ui);
FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -124,6 +124,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
private:
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->doubleSpinBoxY->setRange(0, qApp->fromPixel(SceneSize));
labelEditNamePoint = ui->labelEditName;
InitOkCansel(ui);
InitOkCancel(ui);
flagName = false;
CheckState();

View File

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

View File

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

View File

@ -131,6 +131,10 @@ public slots:
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
private:
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())
{
ui->setupUi(this);
InitOkCansel(ui);
InitOkCancel(ui);
bOk->setEnabled(false);
FillComboBoxPoints(ui->comboBoxPoint);

View File

@ -76,6 +76,10 @@ public slots:
* @brief PointChanged selected another point in list
* @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);
/**
* @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);
listWidget->setCurrentRow (0);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::DialogApply()
{
}

View File

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

View File

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

View File

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

View File

@ -35,7 +35,7 @@ DialogUnionDetails::DialogUnionDetails(const VContainer *data, QWidget *parent)
numberP(0), p1(0), p2(0)
{
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.
*/
virtual void DialogAccepted();
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
private:
Q_DISABLE_COPY(DialogUnionDetails)
/**

View File

@ -94,6 +94,19 @@ void VDrawTool::FullUpdateFromGui(int result)
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)
{

View File

@ -84,6 +84,10 @@ public slots:
* @param result keep result working dialog.
*/
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.
* @param factor scene scale factor.
@ -157,6 +161,7 @@ protected:
connect(qobject_cast< VMainGraphicsScene * >(tool->scene()),
&VMainGraphicsScene::ChoosedObject, dialog, &DialogTool::ChoosedObject);
connect(dialog, &DialogTool::DialogClosed, tool, &Tool::FullUpdateFromGui);
connect(dialog, &DialogTool::DialogApplied, tool, &Tool::FullUpdateFromGuiApply);
if (ignoreFullUpdate == false)
{
connect(doc, &VPattern::FullUpdateFromFile, dialog, &DialogTool::UpdateList);