Merged develop into feature

--HG--
branch : feature
This commit is contained in:
Bojan Kverh 2016-07-07 20:47:16 +02:00
commit 5aa75f2aff
55 changed files with 4960 additions and 3263 deletions

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 980 KiB

After

Width:  |  Height:  |  Size: 988 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -99,9 +99,9 @@ void DialogHistory::cellClicked(int row, int column)
item = ui->tableWidget->item(row, 0); item = ui->tableWidget->item(row, 0);
cursorRow = row; cursorRow = row;
item->setIcon(QIcon("://icon/32x32/put_after.png")); item->setIcon(QIcon("://icon/32x32/put_after.png"));
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole)); const quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
doc->blockSignals(true); doc->blockSignals(true);
doc->setCursor(id); row == ui->tableWidget->rowCount()-1 ? doc->setCursor(0) : doc->setCursor(id);
doc->blockSignals(false); doc->blockSignals(false);
} }
else else
@ -185,7 +185,7 @@ void DialogHistory::FillTable()
ui->tableWidget->setRowCount(count);//Real row count ui->tableWidget->setRowCount(count);//Real row count
if (count>0) if (count>0)
{ {
cursorRow = currentRow; cursorRow = CursorRow();
QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0); QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0);
SCASSERT(item != nullptr); SCASSERT(item != nullptr);
item->setIcon(QIcon("://icon/32x32/put_after.png")); item->setIcon(QIcon("://icon/32x32/put_after.png"));
@ -492,3 +492,24 @@ void DialogHistory::RetranslateUi()
cursorRow = currentRow; cursorRow = currentRow;
cellClicked(cursorRow, 0); cellClicked(cursorRow, 0);
} }
//---------------------------------------------------------------------------------------------------------------------
int DialogHistory::CursorRow() const
{
const quint32 cursor = doc->getCursor();
if (cursor == 0)
{
return ui->tableWidget->rowCount()-1;
}
for (int i = 0; i < ui->tableWidget->rowCount(); ++i)
{
QTableWidgetItem *item = ui->tableWidget->item(i, 0);
const quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
if (cursor == id)
{
return i;
}
}
return ui->tableWidget->rowCount()-1;
}

View File

@ -91,6 +91,7 @@ private:
QString PointName(quint32 pointId); QString PointName(quint32 pointId);
quint32 AttrUInt(const QDomElement &domElement, const QString &name); quint32 AttrUInt(const QDomElement &domElement, const QString &name);
void RetranslateUi(); void RetranslateUi();
int CursorRow() const;
}; };
#endif // DIALOGHISTORY_H #endif // DIALOGHISTORY_H

View File

@ -182,7 +182,6 @@ MainWindow::MainWindow(QWidget *parent)
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
// On Mac deafault icon size is 32x32. // On Mac deafault icon size is 32x32.
ui->toolBarArrows->setIconSize(QSize(24, 24));
ui->toolBarDraws->setIconSize(QSize(24, 24)); ui->toolBarDraws->setIconSize(QSize(24, 24));
ui->toolBarOption->setIconSize(QSize(24, 24)); ui->toolBarOption->setIconSize(QSize(24, 24));
ui->toolBarStages->setIconSize(QSize(24, 24)); ui->toolBarStages->setIconSize(QSize(24, 24));
@ -570,10 +569,10 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene); VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr);
connect(scene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject); connect(scene, &VMainGraphicsScene::ChoosedObject, dialogTool.data(), &DialogTool::ChosenObject);
connect(scene, &VMainGraphicsScene::SelectedObject, dialogTool, &DialogTool::SelectedObject); connect(scene, &VMainGraphicsScene::SelectedObject, dialogTool.data(), &DialogTool::SelectedObject);
connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot); connect(dialogTool.data(), &DialogTool::DialogClosed, this, closeDialogSlot);
connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip); connect(dialogTool.data(), &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
ui->view->itemClicked(nullptr); ui->view->itemClicked(nullptr);
} }
else else
@ -629,11 +628,11 @@ void MainWindow::SetToolButtonWithApply(bool checked, Tool t, const QString &cur
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene); VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr);
connect(scene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject); connect(scene, &VMainGraphicsScene::ChoosedObject, dialogTool.data(), &DialogTool::ChosenObject);
connect(scene, &VMainGraphicsScene::SelectedObject, dialogTool, &DialogTool::SelectedObject); connect(scene, &VMainGraphicsScene::SelectedObject, dialogTool.data(), &DialogTool::SelectedObject);
connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot); connect(dialogTool.data(), &DialogTool::DialogClosed, this, closeDialogSlot);
connect(dialogTool, &DialogTool::DialogApplied, this, applyDialogSlot); connect(dialogTool.data(), &DialogTool::DialogApplied, this, applyDialogSlot);
connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip); connect(dialogTool.data(), &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
connect(ui->view, &VMainGraphicsView::MouseRelease, this, &MainWindow::ClickEndVisualization); connect(ui->view, &VMainGraphicsView::MouseRelease, this, &MainWindow::ClickEndVisualization);
ui->view->itemClicked(nullptr); ui->view->itemClicked(nullptr);
} }
@ -653,7 +652,7 @@ void MainWindow::SetToolButtonWithApply(bool checked, Tool t, const QString &cur
template <typename DrawTool> template <typename DrawTool>
void MainWindow::ClosedDialog(int result) void MainWindow::ClosedDialog(int result)
{ {
SCASSERT(dialogTool != nullptr); SCASSERT(not dialogTool.isNull());
if (result == QDialog::Accepted) if (result == QDialog::Accepted)
{ {
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene); VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
@ -673,7 +672,7 @@ void MainWindow::ClosedDialog(int result)
template <typename DrawTool> template <typename DrawTool>
void MainWindow::ClosedDialogWithApply(int result) void MainWindow::ClosedDialogWithApply(int result)
{ {
SCASSERT(dialogTool != nullptr); SCASSERT(not dialogTool.isNull());
if (result == QDialog::Accepted) if (result == QDialog::Accepted)
{ {
// Only create tool if not already created with apply // Only create tool if not already created with apply
@ -691,7 +690,7 @@ void MainWindow::ClosedDialogWithApply(int result)
vtool->FullUpdateFromGuiApply(); vtool->FullUpdateFromGuiApply();
} }
} }
SCASSERT(dialogTool != nullptr); SCASSERT(not dialogTool.isNull());
QGraphicsItem *tool = dynamic_cast<QGraphicsItem *>(dialogTool->GetAssociatedTool()); QGraphicsItem *tool = dynamic_cast<QGraphicsItem *>(dialogTool->GetAssociatedTool());
ui->view->itemClicked(tool); ui->view->itemClicked(tool);
if (dialogTool->GetAssociatedTool() != nullptr) if (dialogTool->GetAssociatedTool() != nullptr)
@ -700,6 +699,15 @@ void MainWindow::ClosedDialogWithApply(int result)
vtool->DialogLinkDestroy(); vtool->DialogLinkDestroy();
} }
ArrowTool(); ArrowTool();
// If insert not to the end of file call lite parse
if (doc->getCursor() > 0)
{
doc->LiteParseTree(Document::LiteParse);
if (dialogHistory)
{
dialogHistory->UpdateHistory();
}
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -709,7 +717,7 @@ void MainWindow::ClosedDialogWithApply(int result)
template <typename DrawTool> template <typename DrawTool>
void MainWindow::ApplyDialog() void MainWindow::ApplyDialog()
{ {
SCASSERT(dialogTool != nullptr); SCASSERT(not dialogTool.isNull());
// Only create tool if not already created with apply // Only create tool if not already created with apply
if (dialogTool->GetAssociatedTool() == nullptr) if (dialogTool->GetAssociatedTool() == nullptr)
@ -1834,7 +1842,6 @@ void MainWindow::CancelTool()
qCDebug(vMainWindow, "Canceling tool."); qCDebug(vMainWindow, "Canceling tool.");
delete dialogTool; delete dialogTool;
dialogTool = nullptr;
qCDebug(vMainWindow, "Dialog closed."); qCDebug(vMainWindow, "Dialog closed.");
currentScene->setFocus(Qt::OtherFocusReason); currentScene->setFocus(Qt::OtherFocusReason);
@ -3090,8 +3097,8 @@ void MainWindow::ActionHistory(bool checked)
{ {
dialogHistory = new DialogHistory(pattern, doc, this); dialogHistory = new DialogHistory(pattern, doc, this);
dialogHistory->setWindowFlags(Qt::Window); dialogHistory->setWindowFlags(Qt::Window);
connect(this, &MainWindow::RefreshHistory, dialogHistory, &DialogHistory::UpdateHistory); connect(this, &MainWindow::RefreshHistory, dialogHistory.data(), &DialogHistory::UpdateHistory);
connect(dialogHistory, &DialogHistory::DialogClosed, this, &MainWindow::ClosedActionHistory); connect(dialogHistory.data(), &DialogHistory::DialogClosed, this, &MainWindow::ClosedActionHistory);
dialogHistory->show(); dialogHistory->show();
} }
else else
@ -4254,7 +4261,7 @@ void MainWindow::ChangePP(int index, bool zoomBestFit)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void MainWindow::EndVisualization(bool click) void MainWindow::EndVisualization(bool click)
{ {
if (dialogTool != nullptr) if (not dialogTool.isNull())
{ {
dialogTool->ShowDialog(click); dialogTool->ShowDialog(click);
} }

View File

@ -242,9 +242,9 @@ private:
bool patternReadOnly; bool patternReadOnly;
DialogIncrements *dialogTable; DialogIncrements *dialogTable;
DialogTool *dialogTool; QPointer<DialogTool> dialogTool;
DialogHistory *dialogHistory; QPointer<DialogHistory> dialogHistory;
/** @brief comboBoxDraws comboc who show name of pattern peaces. */ /** @brief comboBoxDraws comboc who show name of pattern peaces. */
QComboBox *comboBoxDraws; QComboBox *comboBoxDraws;

View File

@ -1558,7 +1558,6 @@
</attribute> </attribute>
<addaction name="actionZoomIn"/> <addaction name="actionZoomIn"/>
<addaction name="actionZoomOut"/> <addaction name="actionZoomOut"/>
<addaction name="actionZoomOriginal"/>
<addaction name="actionZoomFitBest"/> <addaction name="actionZoomFitBest"/>
</widget> </widget>
<widget class="QDockWidget" name="dockWidgetToolOptions"> <widget class="QDockWidget" name="dockWidgetToolOptions">

View File

@ -32,6 +32,7 @@
#include "../ifc/xml/vabstractpattern.h" #include "../ifc/xml/vabstractpattern.h"
#include "../ifc/xml/vtoolrecord.h" #include "../ifc/xml/vtoolrecord.h"
#include "../vpatterndb/vcontainer.h" #include "../vpatterndb/vcontainer.h"
#include "../ifc/xml/vpatternconverter.h"
class VDataTool; class VDataTool;
class VMainGraphicsScene; class VMainGraphicsScene;
@ -171,12 +172,16 @@ private:
void ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse); void ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
// TODO. Delete if minimal supported version is 0.2.7 // TODO. Delete if minimal supported version is 0.2.7
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 7),
"Time to refactor the code.");
void ParseOldToolSpline(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse); void ParseOldToolSpline(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
void ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); void ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
void ParseToolCubicBezier(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse); void ParseToolCubicBezier(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
// TODO. Delete if minimal supported version is 0.2.7 // TODO. Delete if minimal supported version is 0.2.7
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 7),
"Time to refactor the code.");
void ParseOldToolSplinePath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse); void ParseOldToolSplinePath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
void ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse); void ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);

View File

@ -31,6 +31,8 @@
#include "vdomdocument.h" #include "vdomdocument.h"
#define CONVERTER_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
class VAbstractConverter :public VDomDocument class VAbstractConverter :public VDomDocument
{ {
Q_DECLARE_TR_FUNCTIONS(VAbstractConverter) Q_DECLARE_TR_FUNCTIONS(VAbstractConverter)

View File

@ -46,6 +46,9 @@ const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.3"); const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.3");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.3.3.xsd"); const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.3.3.xsd");
constexpr int VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
constexpr int VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPatternConverter::VPatternConverter(const QString &fileName) VPatternConverter::VPatternConverter(const QString &fileName)
:VAbstractConverter(fileName) :VAbstractConverter(fileName)
@ -57,30 +60,6 @@ VPatternConverter::VPatternConverter(const QString &fileName)
VPatternConverter::~VPatternConverter() VPatternConverter::~VPatternConverter()
{} {}
//---------------------------------------------------------------------------------------------------------------------
int VPatternConverter::MinVer() const
{
return GetVersion(PatternMinVerStr);
}
//---------------------------------------------------------------------------------------------------------------------
int VPatternConverter::MaxVer() const
{
return GetVersion(PatternMaxVerStr);
}
//---------------------------------------------------------------------------------------------------------------------
QString VPatternConverter::MinVerStr() const
{
return PatternMinVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
QString VPatternConverter::MaxVerStr() const
{
return PatternMaxVerStr;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VPatternConverter::XSDSchema(int ver) const QString VPatternConverter::XSDSchema(int ver) const
{ {

View File

@ -38,8 +38,10 @@ public:
explicit VPatternConverter(const QString &fileName); explicit VPatternConverter(const QString &fileName);
virtual ~VPatternConverter() Q_DECL_OVERRIDE; virtual ~VPatternConverter() Q_DECL_OVERRIDE;
static const QString PatternMaxVerStr; static const QString PatternMaxVerStr;
static const QString CurrentSchema; static const QString CurrentSchema;
static constexpr int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
static constexpr int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 3, 2);
protected: protected:
virtual int MinVer() const Q_DECL_OVERRIDE; virtual int MinVer() const Q_DECL_OVERRIDE;
@ -54,7 +56,7 @@ protected:
private: private:
Q_DISABLE_COPY(VPatternConverter) Q_DISABLE_COPY(VPatternConverter)
static const QString PatternMinVerStr; static const QString PatternMinVerStr;
void ToV0_1_1(); void ToV0_1_1();
void ToV0_1_2(); void ToV0_1_2();
@ -105,4 +107,28 @@ private:
static QMap<QString, QString> OldNamesToNewNames_InV0_2_1(); static QMap<QString, QString> OldNamesToNewNames_InV0_2_1();
}; };
//---------------------------------------------------------------------------------------------------------------------
inline int VPatternConverter::MinVer() const
{
return PatternMinVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline int VPatternConverter::MaxVer() const
{
return PatternMaxVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VPatternConverter::MinVerStr() const
{
return PatternMinVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VPatternConverter::MaxVerStr() const
{
return PatternMaxVerStr;
}
#endif // VPATTERNCONVERTER_H #endif // VPATTERNCONVERTER_H

View File

@ -43,6 +43,9 @@ const QString VVITConverter::MeasurementMinVerStr = QStringLiteral("0.2.0");
const QString VVITConverter::MeasurementMaxVerStr = QStringLiteral("0.3.3"); const QString VVITConverter::MeasurementMaxVerStr = QStringLiteral("0.3.3");
const QString VVITConverter::CurrentSchema = QStringLiteral("://schema/individual_measurements/v0.3.3.xsd"); const QString VVITConverter::CurrentSchema = QStringLiteral("://schema/individual_measurements/v0.3.3.xsd");
constexpr int VVITConverter::MeasurementMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
constexpr int VVITConverter::MeasurementMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VVITConverter::VVITConverter(const QString &fileName) VVITConverter::VVITConverter(const QString &fileName)
:VAbstractMConverter(fileName) :VAbstractMConverter(fileName)
@ -54,30 +57,6 @@ VVITConverter::VVITConverter(const QString &fileName)
VVITConverter::~VVITConverter() VVITConverter::~VVITConverter()
{} {}
//---------------------------------------------------------------------------------------------------------------------
int VVITConverter::MinVer() const
{
return GetVersion(MeasurementMinVerStr);
}
//---------------------------------------------------------------------------------------------------------------------
int VVITConverter::MaxVer() const
{
return GetVersion(MeasurementMaxVerStr);
}
//---------------------------------------------------------------------------------------------------------------------
QString VVITConverter::MinVerStr() const
{
return MeasurementMinVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
QString VVITConverter::MaxVerStr() const
{
return MeasurementMaxVerStr;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VVITConverter::XSDSchema(int ver) const QString VVITConverter::XSDSchema(int ver) const
{ {

View File

@ -38,8 +38,10 @@ public:
explicit VVITConverter(const QString &fileName); explicit VVITConverter(const QString &fileName);
virtual ~VVITConverter() Q_DECL_OVERRIDE; virtual ~VVITConverter() Q_DECL_OVERRIDE;
static const QString MeasurementMaxVerStr; static const QString MeasurementMaxVerStr;
static const QString CurrentSchema; static const QString CurrentSchema;
static constexpr int MeasurementMinVer = CONVERTER_VERSION_CHECK(0, 2, 0);
static constexpr int MeasurementMaxVer = CONVERTER_VERSION_CHECK(0, 3, 3);
protected: protected:
virtual int MinVer() const Q_DECL_OVERRIDE; virtual int MinVer() const Q_DECL_OVERRIDE;
@ -54,7 +56,7 @@ protected:
private: private:
Q_DISABLE_COPY(VVITConverter) Q_DISABLE_COPY(VVITConverter)
static const QString MeasurementMinVerStr; static const QString MeasurementMinVerStr;
void AddNewTagsForV0_3_0(); void AddNewTagsForV0_3_0();
QString MUnitV0_2_0(); QString MUnitV0_2_0();
@ -70,4 +72,28 @@ private:
void ToV0_3_3(); void ToV0_3_3();
}; };
//---------------------------------------------------------------------------------------------------------------------
inline int VVITConverter::MinVer() const
{
return MeasurementMinVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline int VVITConverter::MaxVer() const
{
return MeasurementMaxVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VVITConverter::MinVerStr() const
{
return MeasurementMinVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VVITConverter::MaxVerStr() const
{
return MeasurementMaxVerStr;
}
#endif // VVITCONVERTER_H #endif // VVITCONVERTER_H

View File

@ -43,6 +43,9 @@ const QString VVSTConverter::MeasurementMinVerStr = QStringLiteral("0.3.0");
const QString VVSTConverter::MeasurementMaxVerStr = QStringLiteral("0.4.2"); const QString VVSTConverter::MeasurementMaxVerStr = QStringLiteral("0.4.2");
const QString VVSTConverter::CurrentSchema = QStringLiteral("://schema/standard_measurements/v0.4.2.xsd"); const QString VVSTConverter::CurrentSchema = QStringLiteral("://schema/standard_measurements/v0.4.2.xsd");
constexpr int VVSTConverter::MeasurementMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
constexpr int VVSTConverter::MeasurementMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VVSTConverter::VVSTConverter(const QString &fileName) VVSTConverter::VVSTConverter(const QString &fileName)
:VAbstractMConverter(fileName) :VAbstractMConverter(fileName)
@ -54,30 +57,6 @@ VVSTConverter::VVSTConverter(const QString &fileName)
VVSTConverter::~VVSTConverter() VVSTConverter::~VVSTConverter()
{} {}
//---------------------------------------------------------------------------------------------------------------------
int VVSTConverter::MinVer() const
{
return GetVersion(MeasurementMinVerStr);
}
//---------------------------------------------------------------------------------------------------------------------
int VVSTConverter::MaxVer() const
{
return GetVersion(MeasurementMaxVerStr);
}
//---------------------------------------------------------------------------------------------------------------------
QString VVSTConverter::MinVerStr() const
{
return MeasurementMinVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
QString VVSTConverter::MaxVerStr() const
{
return MeasurementMaxVerStr;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VVSTConverter::XSDSchema(int ver) const QString VVSTConverter::XSDSchema(int ver) const
{ {

View File

@ -38,8 +38,10 @@ public:
explicit VVSTConverter(const QString &fileName); explicit VVSTConverter(const QString &fileName);
virtual ~VVSTConverter() Q_DECL_OVERRIDE; virtual ~VVSTConverter() Q_DECL_OVERRIDE;
static const QString MeasurementMaxVerStr; static const QString MeasurementMaxVerStr;
static const QString CurrentSchema; static const QString CurrentSchema;
static constexpr int MeasurementMinVer = CONVERTER_VERSION_CHECK(0, 3, 0);
static constexpr int MeasurementMaxVer = CONVERTER_VERSION_CHECK(0, 4, 2);
protected: protected:
virtual int MinVer() const Q_DECL_OVERRIDE; virtual int MinVer() const Q_DECL_OVERRIDE;
@ -54,7 +56,7 @@ protected:
private: private:
Q_DISABLE_COPY(VVSTConverter) Q_DISABLE_COPY(VVSTConverter)
static const QString MeasurementMinVerStr; static const QString MeasurementMinVerStr;
void AddNewTagsForV0_4_0(); void AddNewTagsForV0_4_0();
void RemoveTagsForV0_4_0(); void RemoveTagsForV0_4_0();
@ -68,4 +70,28 @@ private:
void ToV0_4_2(); void ToV0_4_2();
}; };
//---------------------------------------------------------------------------------------------------------------------
inline int VVSTConverter::MinVer() const
{
return MeasurementMinVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline int VVSTConverter::MaxVer() const
{
return MeasurementMaxVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VVSTConverter::MinVerStr() const
{
return MeasurementMinVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VVSTConverter::MaxVerStr() const
{
return MeasurementMaxVerStr;
}
#endif // VMEASUREMENTCONVERTER_H #endif // VMEASUREMENTCONVERTER_H

View File

@ -142,7 +142,6 @@ DialogAlongLine::~DialogAlongLine()
VContainer *locData = const_cast<VContainer *> (data); VContainer *locData = const_cast<VContainer *> (data);
locData->RemoveVariable(currentLength); locData->RemoveVariable(currentLength);
DeleteVisualization<VisToolAlongLine>();
delete ui; delete ui;
} }

View File

@ -113,7 +113,6 @@ void DialogArc::DeployF2TextEdit()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogArc::~DialogArc() DialogArc::~DialogArc()
{ {
DeleteVisualization<VisToolArc>();
delete ui; delete ui;
} }

View File

@ -90,7 +90,6 @@ DialogArcWithLength::DialogArcWithLength(const VContainer *data, const quint32 &
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogArcWithLength::~DialogArcWithLength() DialogArcWithLength::~DialogArcWithLength()
{ {
DeleteVisualization<VisToolArcWithLength>();
delete ui; delete ui;
} }

View File

@ -142,7 +142,6 @@ void DialogBisector::DeployFormulaTextEdit()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogBisector::~DialogBisector() DialogBisector::~DialogBisector()
{ {
DeleteVisualization<VisToolBisector>();
delete ui; delete ui;
} }

View File

@ -63,7 +63,6 @@ DialogCubicBezier::DialogCubicBezier(const VContainer *data, const quint32 &tool
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogCubicBezier::~DialogCubicBezier() DialogCubicBezier::~DialogCubicBezier()
{ {
DeleteVisualization<VisToolCubicBezier>();
delete ui; delete ui;
} }

View File

@ -61,7 +61,6 @@ DialogCubicBezierPath::DialogCubicBezierPath(const VContainer *data, const quint
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogCubicBezierPath::~DialogCubicBezierPath() DialogCubicBezierPath::~DialogCubicBezierPath()
{ {
DeleteVisualization<VisToolCubicBezierPath>();
delete ui; delete ui;
} }

View File

@ -77,7 +77,6 @@ DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogCurveIntersectAxis::~DialogCurveIntersectAxis() DialogCurveIntersectAxis::~DialogCurveIntersectAxis()
{ {
DeleteVisualization<VisToolCurveIntersectAxis>();
delete ui; delete ui;
} }

View File

@ -106,7 +106,6 @@ void DialogCutArc::DeployFormulaTextEdit()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogCutArc::~DialogCutArc() DialogCutArc::~DialogCutArc()
{ {
DeleteVisualization<VisToolCutArc>();
delete ui; delete ui;
} }

View File

@ -73,7 +73,6 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId,
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogCutSpline::~DialogCutSpline() DialogCutSpline::~DialogCutSpline()
{ {
DeleteVisualization<VisToolCutSpline>();
delete ui; delete ui;
} }

View File

@ -73,7 +73,6 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogCutSplinePath::~DialogCutSplinePath() DialogCutSplinePath::~DialogCutSplinePath()
{ {
DeleteVisualization<VisToolCutSplinePath>();
delete ui; delete ui;
} }

View File

@ -167,7 +167,7 @@ void DialogEndLine::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxBasePoint, "")) if (SetObject(id, ui->comboBoxBasePoint, ""))
{ {
vis->VisualMode(id); vis->VisualMode(id);
connect(vis, &Visualization::ToolTip, this, &DialogTool::ShowVisToolTip); connect(vis.data(), &Visualization::ToolTip, this, &DialogTool::ShowVisToolTip);
prepare = true; prepare = true;
} }
} }
@ -343,7 +343,6 @@ void DialogEndLine::closeEvent(QCloseEvent *event)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogEndLine::~DialogEndLine() DialogEndLine::~DialogEndLine()
{ {
DeleteVisualization<VisToolEndLine>();
delete ui; delete ui;
} }

View File

@ -75,7 +75,6 @@ DialogHeight::DialogHeight(const VContainer *data, const quint32 &toolId, QWidge
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogHeight::~DialogHeight() DialogHeight::~DialogHeight()
{ {
DeleteVisualization<VisToolHeight>();
delete ui; delete ui;
} }

View File

@ -68,7 +68,6 @@ DialogLine::DialogLine(const VContainer *data, const quint32 &toolId, QWidget *p
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogLine::~DialogLine() DialogLine::~DialogLine()
{ {
DeleteVisualization<VisToolLine>();
delete ui; delete ui;
} }

View File

@ -75,7 +75,6 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, const quint32 &
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogLineIntersect::~DialogLineIntersect() DialogLineIntersect::~DialogLineIntersect()
{ {
DeleteVisualization<VisToolLineIntersect>();
delete ui; delete ui;
} }

View File

@ -86,7 +86,6 @@ DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const q
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogLineIntersectAxis::~DialogLineIntersectAxis() DialogLineIntersectAxis::~DialogLineIntersectAxis()
{ {
DeleteVisualization<VisToolLineIntersectAxis>();
delete ui; delete ui;
} }

View File

@ -132,7 +132,6 @@ void DialogNormal::DeployFormulaTextEdit()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogNormal::~DialogNormal() DialogNormal::~DialogNormal()
{ {
DeleteVisualization<VisToolNormal>();
delete ui; delete ui;
} }

View File

@ -63,7 +63,6 @@ DialogPointFromArcAndTangent::DialogPointFromArcAndTangent(const VContainer *dat
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogPointFromArcAndTangent::~DialogPointFromArcAndTangent() DialogPointFromArcAndTangent::~DialogPointFromArcAndTangent()
{ {
DeleteVisualization<VisToolPointFromArcAndTangent>();
delete ui; delete ui;
} }

View File

@ -88,7 +88,6 @@ DialogPointFromCircleAndTangent::DialogPointFromCircleAndTangent(const VContaine
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogPointFromCircleAndTangent::~DialogPointFromCircleAndTangent() DialogPointFromCircleAndTangent::~DialogPointFromCircleAndTangent()
{ {
DeleteVisualization<VisToolPointFromCircleAndTangent>();
delete ui; delete ui;
} }

View File

@ -81,7 +81,6 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, const quint32
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogPointOfContact::~DialogPointOfContact() DialogPointOfContact::~DialogPointOfContact()
{ {
DeleteVisualization<VisToolPointOfContact>();
delete ui; delete ui;
} }

View File

@ -71,7 +71,6 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, con
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogPointOfIntersection::~DialogPointOfIntersection() DialogPointOfIntersection::~DialogPointOfIntersection()
{ {
DeleteVisualization<VisToolPointOfIntersection>();
delete ui; delete ui;
} }

View File

@ -67,7 +67,6 @@ DialogPointOfIntersectionArcs::DialogPointOfIntersectionArcs(const VContainer *d
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogPointOfIntersectionArcs::~DialogPointOfIntersectionArcs() DialogPointOfIntersectionArcs::~DialogPointOfIntersectionArcs()
{ {
DeleteVisualization<VisToolPointOfIntersectionArcs>();
delete ui; delete ui;
} }

View File

@ -104,7 +104,6 @@ DialogPointOfIntersectionCircles::DialogPointOfIntersectionCircles(const VContai
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogPointOfIntersectionCircles::~DialogPointOfIntersectionCircles() DialogPointOfIntersectionCircles::~DialogPointOfIntersectionCircles()
{ {
DeleteVisualization<VisToolPointOfIntersectionCircles>();
delete ui; delete ui;
} }

View File

@ -65,7 +65,6 @@ DialogPointOfIntersectionCurves::DialogPointOfIntersectionCurves(const VContaine
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogPointOfIntersectionCurves::~DialogPointOfIntersectionCurves() DialogPointOfIntersectionCurves::~DialogPointOfIntersectionCurves()
{ {
DeleteVisualization<VisToolPointOfIntersectionCurves>();
delete ui; delete ui;
} }

View File

@ -81,7 +81,6 @@ DialogRotation::DialogRotation(const VContainer *data, const quint32 &toolId, QW
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogRotation::~DialogRotation() DialogRotation::~DialogRotation()
{ {
DeleteVisualization<VisToolRotation>();
delete ui; delete ui;
} }

View File

@ -143,7 +143,6 @@ void DialogShoulderPoint::DeployFormulaTextEdit()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogShoulderPoint::~DialogShoulderPoint() DialogShoulderPoint::~DialogShoulderPoint()
{ {
DeleteVisualization<VisToolShoulderPoint>();
delete ui; delete ui;
} }

View File

@ -122,7 +122,6 @@ DialogSpline::DialogSpline(const VContainer *data, const quint32 &toolId, QWidge
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogSpline::~DialogSpline() DialogSpline::~DialogSpline()
{ {
DeleteVisualization<VisToolSpline>();
delete ui; delete ui;
} }

View File

@ -108,7 +108,6 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, const quint32 &toolId
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogSplinePath::~DialogSplinePath() DialogSplinePath::~DialogSplinePath()
{ {
DeleteVisualization<VisToolSplinePath>();
delete ui; delete ui;
} }

View File

@ -78,6 +78,11 @@ DialogTool::DialogTool(const VContainer *data, const quint32 &toolId, QWidget *p
DialogTool::~DialogTool() DialogTool::~DialogTool()
{ {
emit ToolTip(""); emit ToolTip("");
if (not vis.isNull())
{
delete vis;
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -181,7 +181,7 @@ protected:
/** @brief number number of handled objects */ /** @brief number number of handled objects */
qint32 number; qint32 number;
Visualization *vis; QPointer<Visualization> vis;
virtual void closeEvent ( QCloseEvent * event ) Q_DECL_OVERRIDE; virtual void closeEvent ( QCloseEvent * event ) Q_DECL_OVERRIDE;
virtual void showEvent( QShowEvent *event ) Q_DECL_OVERRIDE; virtual void showEvent( QShowEvent *event ) Q_DECL_OVERRIDE;
@ -241,9 +241,6 @@ protected:
template <typename T> template <typename T>
void AddVisualization(); void AddVisualization();
template <typename T>
void DeleteVisualization();
void ChangeColor(QWidget *widget, const QColor &color); void ChangeColor(QWidget *widget, const QColor &color);
virtual void ShowVisualization() {} virtual void ShowVisualization() {}
/** /**
@ -360,19 +357,6 @@ inline void DialogTool::AddVisualization()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
inline void DialogTool::DeleteVisualization()
{
T *toolVis = qobject_cast<T *>(vis);
SCASSERT(toolVis != nullptr);
if (qApp->getCurrentScene()->items().contains(toolVis))
{ // In some cases scene delete object yourself. If not make check program will crash.
delete vis;
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template <typename T> template <typename T>
inline T DialogTool::getCurrentCrossPoint(QComboBox *box) const inline T DialogTool::getCurrentCrossPoint(QComboBox *box) const

View File

@ -75,7 +75,6 @@ DialogTriangle::DialogTriangle(const VContainer *data, const quint32 &toolId, QW
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogTriangle::~DialogTriangle() DialogTriangle::~DialogTriangle()
{ {
DeleteVisualization<VisToolTriangle>();
delete ui; delete ui;
} }

View File

@ -80,7 +80,6 @@ DialogTrueDarts::DialogTrueDarts(const VContainer *data, const quint32 &toolId,
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogTrueDarts::~DialogTrueDarts() DialogTrueDarts::~DialogTrueDarts()
{ {
DeleteVisualization<VisToolTrueDarts>();
delete ui; delete ui;
} }

View File

@ -89,7 +89,7 @@ void VToolDoublePoint::setNameP2(const QString &name)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolDoublePoint::SetEnabled(bool enabled) void VToolDoublePoint::SetEnabled(bool enabled)
{ {
SetToolEnabled(this, enabled); SetToolEnabled(this, baseColor, enabled);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -379,8 +379,7 @@ void VToolBasePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event )
*/ */
void VToolBasePoint::FullUpdateFromFile() void VToolBasePoint::FullUpdateFromFile()
{ {
VPointF point = *VAbstractTool::data.GeometricObject<VPointF>(id); RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
RefreshPointGeometry(point);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -94,8 +94,8 @@ void VToolSinglePoint::setName(const QString &name)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::SetEnabled(bool enabled) void VToolSinglePoint::SetEnabled(bool enabled)
{ {
SetToolEnabled(this, enabled); SetToolEnabled(this, baseColor, enabled);
SetToolEnabled(lineName, enabled); SetToolEnabled(lineName, Qt::black, enabled);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ protected:
virtual void RefreshLine(quint32 id)=0; virtual void RefreshLine(quint32 id)=0;
template <typename T> template <typename T>
void SetToolEnabled(T *item, bool enabled); void SetToolEnabled(T *item, const QColor &color, bool enabled);
template <typename T> template <typename T>
static void InitToolConnections(VMainGraphicsScene *scene, T *tool); static void InitToolConnections(VMainGraphicsScene *scene, T *tool);
@ -97,12 +97,12 @@ void VAbstractPoint::ShowToolVisualization(bool show)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template <typename T> template <typename T>
void VAbstractPoint::SetToolEnabled(T *item, bool enabled) void VAbstractPoint::SetToolEnabled(T *item, const QColor &color, bool enabled)
{ {
item->setEnabled(enabled); item->setEnabled(enabled);
if (enabled) if (enabled)
{ {
item->setPen(QPen(QColor(baseColor), item->setPen(QPen(color,
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
} }
else else

View File

@ -470,7 +470,7 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const
// value - this is new position. // value - this is new position.
const QPointF newPos = value.toPointF(); const QPointF newPos = value.toPointF();
MoveDetail *moveDet = new MoveDetail(doc, newPos.x(), newPos.y(), id); MoveDetail *moveDet = new MoveDetail(doc, newPos.x(), newPos.y(), id, scene());
connect(moveDet, &MoveDetail::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); connect(moveDet, &MoveDetail::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(moveDet); qApp->getUndoStack()->push(moveDet);

View File

@ -33,6 +33,7 @@
#include "../../vgeometry/varc.h" #include "../../vgeometry/varc.h"
#include "../../vgeometry/vsplinepath.h" #include "../../vgeometry/vsplinepath.h"
#include "../dialogs/tools/dialoguniondetails.h" #include "../dialogs/tools/dialoguniondetails.h"
#include "../ifc/xml/vpatternconverter.h"
#include <QUndoStack> #include <QUndoStack>
@ -649,6 +650,8 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
// Remove it if min version is 0.3.2 // Remove it if min version is 0.3.2
// Instead: // Instead:
// UpdatePoints(data, d1.RemoveEdge(indexD1), i, children); // UpdatePoints(data, d1.RemoveEdge(indexD1), i, children);
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 2),
"Time to refactor the code.");
if (children.size() != countNodeD2) if (children.size() != countNodeD2)
{ {
UpdatePoints(data, d1.RemoveEdge(indexD1), i, children); UpdatePoints(data, d1.RemoveEdge(indexD1), i, children);
@ -671,6 +674,8 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
} while (pointsD2 < countNodeD2-1); } while (pointsD2 < countNodeD2-1);
// This check need for backward compatibility // This check need for backward compatibility
// Remove it if min version is 0.3.2 // Remove it if min version is 0.3.2
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 2),
"Time to refactor the code.");
if (children.size() == countNodeD2) if (children.size() == countNodeD2)
{ {
break; break;

View File

@ -49,7 +49,6 @@ void AddToCalc::undo()
qCDebug(vUndo, "Undo."); qCDebug(vUndo, "Undo.");
doc->ChangeActivPP(nameActivDraw);//Without this user will not see this change doc->ChangeActivPP(nameActivDraw);//Without this user will not see this change
doc->setCursor(cursor);
QDomElement calcElement; QDomElement calcElement;
if (doc->GetActivNodeElement(VAbstractPattern::TagCalculation, calcElement)) if (doc->GetActivNodeElement(VAbstractPattern::TagCalculation, calcElement))
@ -74,10 +73,6 @@ void AddToCalc::undo()
qCDebug(vUndo, "Can't find tag Calculation."); qCDebug(vUndo, "Can't find tag Calculation.");
return; return;
} }
if (cursor > 0)
{
doc->setCursor(0);
}
emit NeedFullParsing(); emit NeedFullParsing();
VMainGraphicsView::NewSceneRect(qApp->getCurrentScene(), qApp->getSceneView()); VMainGraphicsView::NewSceneRect(qApp->getCurrentScene(), qApp->getSceneView());
doc->SetCurrentPP(nameActivDraw);//Return current pattern piece after undo doc->SetCurrentPP(nameActivDraw);//Return current pattern piece after undo
@ -104,7 +99,6 @@ void AddToCalc::redo()
if (refElement.isElement()) if (refElement.isElement())
{ {
calcElement.insertAfter(xml, refElement); calcElement.insertAfter(xml, refElement);
doc->setCursor(0);
} }
else else
{ {

View File

@ -35,8 +35,8 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
MoveDetail::MoveDetail(VAbstractPattern *doc, const double &x, const double &y, const quint32 &id, MoveDetail::MoveDetail(VAbstractPattern *doc, const double &x, const double &y, const quint32 &id,
QUndoCommand *parent) QGraphicsScene *scene, QUndoCommand *parent)
: VUndoCommand(QDomElement(), doc, parent), oldX(0.0), oldY(0.0), newX(x), newY(y), scene(qApp->getCurrentScene()) : VUndoCommand(QDomElement(), doc, parent), oldX(0.0), oldY(0.0), newX(x), newY(y), scene(scene)
{ {
setText(QObject::tr("move detail")); setText(QObject::tr("move detail"));
nodeId = id; nodeId = id;

View File

@ -37,7 +37,7 @@ class MoveDetail : public VUndoCommand
{ {
Q_OBJECT Q_OBJECT
public: public:
MoveDetail(VAbstractPattern *doc, const double &x, const double &y, const quint32 &id, MoveDetail(VAbstractPattern *doc, const double &x, const double &y, const quint32 &id, QGraphicsScene *scene,
QUndoCommand *parent = 0); QUndoCommand *parent = 0);
virtual ~MoveDetail() Q_DECL_OVERRIDE; virtual ~MoveDetail() Q_DECL_OVERRIDE;
virtual void undo() Q_DECL_OVERRIDE; virtual void undo() Q_DECL_OVERRIDE;