First test for apply on creation
--HG-- branch : DialogTools
This commit is contained in:
parent
2913e55024
commit
e645e671de
|
@ -45,7 +45,7 @@ DialogTool::DialogTool(const VContainer *data, QWidget *parent)
|
||||||
labelResultCalculation(nullptr), labelDescription(nullptr), labelEditNamePoint(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())
|
radioButtonLengthCurve(nullptr), lineStyles(QStringList()), associatedTool(nullptr)
|
||||||
{
|
{
|
||||||
Q_CHECK_PTR(data);
|
Q_CHECK_PTR(data);
|
||||||
timerFormula = new QTimer(this);
|
timerFormula = new QTimer(this);
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
#include "../../container/vcontainer.h"
|
#include "../../container/vcontainer.h"
|
||||||
#include "../../widgets/vapplication.h"
|
#include "../../widgets/vapplication.h"
|
||||||
|
#include "../../tools/vabstracttool.h"
|
||||||
|
|
||||||
namespace ComboMode
|
namespace ComboMode
|
||||||
{
|
{
|
||||||
|
@ -69,6 +70,8 @@ public:
|
||||||
*/
|
*/
|
||||||
DialogTool(const VContainer *data, QWidget *parent = nullptr);
|
DialogTool(const VContainer *data, QWidget *parent = nullptr);
|
||||||
virtual ~DialogTool() {}
|
virtual ~DialogTool() {}
|
||||||
|
inline VAbstractTool* GetAssociatedTool() { return this->associatedTool;}
|
||||||
|
inline void SetAssociatedTool(VAbstractTool* tool) { this->associatedTool=tool;}
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
* @brief DialogClosed signal dialog closed
|
* @brief DialogClosed signal dialog closed
|
||||||
|
@ -475,6 +478,7 @@ protected:
|
||||||
Q_CHECK_PTR(bApply);
|
Q_CHECK_PTR(bApply);
|
||||||
connect(bApply, &QPushButton::clicked, this, &DialogTool::DialogApply);
|
connect(bApply, &QPushButton::clicked, this, &DialogTool::DialogApply);
|
||||||
}
|
}
|
||||||
|
VAbstractTool* associatedTool;
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief FillList fill combobox list
|
* @brief FillList fill combobox list
|
||||||
|
|
|
@ -267,9 +267,12 @@ void MainWindow::ClosedDialog(int result)
|
||||||
{
|
{
|
||||||
Q_CHECK_PTR(dialogTool);
|
Q_CHECK_PTR(dialogTool);
|
||||||
if (result == QDialog::Accepted)
|
if (result == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
if (dialogTool->GetAssociatedTool() == nullptr)
|
||||||
{
|
{
|
||||||
DrawTool::Create(dialogTool, currentScene, doc, pattern);
|
DrawTool::Create(dialogTool, currentScene, doc, pattern);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ArrowTool();
|
ArrowTool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,10 +283,14 @@ void MainWindow::ApplyDialog()
|
||||||
Q_CHECK_PTR(dialogTool);
|
Q_CHECK_PTR(dialogTool);
|
||||||
|
|
||||||
// TODO ISSUE 79 : Only create on first apply for now,
|
// TODO ISSUE 79 : Only create on first apply for now,
|
||||||
// for updating : VDataTool * stored in DialogTool ?
|
// need function for updating in dialogtools or drawtool
|
||||||
DrawTool::Create(dialogTool, currentScene, doc, pattern);
|
|
||||||
|
|
||||||
ArrowTool();
|
if (dialogTool->GetAssociatedTool() == nullptr)
|
||||||
|
{
|
||||||
|
dialogTool->SetAssociatedTool(
|
||||||
|
dynamic_cast<VAbstractTool * > (DrawTool::Create(dialogTool, currentScene, doc, pattern)));
|
||||||
|
}
|
||||||
|
//ArrowTool();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -65,7 +65,7 @@ void VToolEndLine::setDialog()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
|
VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
|
||||||
VContainer *data)
|
VContainer *data)
|
||||||
{
|
{
|
||||||
Q_CHECK_PTR(dialog);
|
Q_CHECK_PTR(dialog);
|
||||||
|
@ -76,12 +76,12 @@ void VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPatter
|
||||||
QString formula = dialogTool->getFormula();
|
QString formula = dialogTool->getFormula();
|
||||||
qreal angle = dialogTool->getAngle();
|
qreal angle = dialogTool->getAngle();
|
||||||
quint32 basePointId = dialogTool->getBasePointId();
|
quint32 basePointId = dialogTool->getBasePointId();
|
||||||
Create(0, pointName, typeLine, formula, angle, basePointId, 5, 10, scene, doc, data, Document::FullParse,
|
return Create(0, pointName, typeLine, formula, angle, basePointId, 5, 10, scene, doc, data, Document::FullParse,
|
||||||
Valentina::FromGui);
|
Valentina::FromGui);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolEndLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
|
VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
|
||||||
const QString &formula, const qreal &angle, const quint32 &basePointId,
|
const QString &formula, const qreal &angle, const quint32 &basePointId,
|
||||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||||
VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation)
|
VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation)
|
||||||
|
@ -120,8 +120,10 @@ void VToolEndLine::Create(const quint32 _id, const QString &pointName, const QSt
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor);
|
||||||
doc->AddTool(id, point);
|
doc->AddTool(id, point);
|
||||||
doc->IncrementReferens(basePointId);
|
doc->IncrementReferens(basePointId);
|
||||||
|
return point;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -63,8 +63,9 @@ public:
|
||||||
* @param scene pointer to scene.
|
* @param scene pointer to scene.
|
||||||
* @param doc dom document container.
|
* @param doc dom document container.
|
||||||
* @param data container with variables.
|
* @param data container with variables.
|
||||||
|
* @return the created tool
|
||||||
*/
|
*/
|
||||||
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
static VToolEndLine *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||||
/**
|
/**
|
||||||
* @brief Create help create tool.
|
* @brief Create help create tool.
|
||||||
* @param _id tool id, 0 if tool doesn't exist yet.
|
* @param _id tool id, 0 if tool doesn't exist yet.
|
||||||
|
@ -80,8 +81,9 @@ public:
|
||||||
* @param data container with variables.
|
* @param data container with variables.
|
||||||
* @param parse parser file mode.
|
* @param parse parser file mode.
|
||||||
* @param typeCreation way we create this tool.
|
* @param typeCreation way we create this tool.
|
||||||
|
* @return the created tool
|
||||||
*/
|
*/
|
||||||
static void Create(const quint32 _id, const QString &pointName, const QString &typeLine,
|
static VToolEndLine *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
|
||||||
const QString &formula, const qreal &angle, const quint32 &basePointId, const qreal &mx,
|
const QString &formula, const qreal &angle, const quint32 &basePointId, const qreal &mx,
|
||||||
const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||||
const Document::Documents &parse, const Valentina::Sources &typeCreation);
|
const Document::Documents &parse, const Valentina::Sources &typeCreation);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user