Fixed issue #743. Valentina doesn't update update pattern after adding item.

(grafted from 9488967913032bb6c97488a8540309db771e7728)

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-08-03 15:25:14 +03:00
parent 9acaaffce5
commit 349a5cade0
10 changed files with 46 additions and 60 deletions

View File

@ -43,6 +43,7 @@
- [#738] Bug in transformation over arc and elliptical arc. - [#738] Bug in transformation over arc and elliptical arc.
- [#729] Moved Bezier curves can't be rotated. - [#729] Moved Bezier curves can't be rotated.
- [#742] Valentina produces wrong seam allowance. - [#742] Valentina produces wrong seam allowance.
- [#743] Valentina doesn't update update pattern after adding item.
# Version 0.5.0 May 9, 2017 # Version 0.5.0 May 9, 2017
- [#581] User can now filter input lists by keyword in function wizard. - [#581] User can now filter input lists by keyword in function wizard.

View File

@ -36,7 +36,7 @@
#include "../ifc/exception/vexceptionundo.h" #include "../ifc/exception/vexceptionundo.h"
#include "version.h" #include "version.h"
#include "core/vapplication.h" #include "core/vapplication.h"
#include "../vmisc/undoevent.h" #include "../vmisc/customevents.h"
#include "../vmisc/vsettings.h" #include "../vmisc/vsettings.h"
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "../vmisc/qxtcsvmodel.h" #include "../vmisc/qxtcsvmodel.h"

View File

@ -39,7 +39,7 @@
#include "../ifc/exception/vexceptionemptyparameter.h" #include "../ifc/exception/vexceptionemptyparameter.h"
#include "../ifc/exception/vexceptionundo.h" #include "../ifc/exception/vexceptionundo.h"
#include "../ifc/xml/vpatternconverter.h" #include "../ifc/xml/vpatternconverter.h"
#include "../vmisc/undoevent.h" #include "../vmisc/customevents.h"
#include "../vmisc/vsettings.h" #include "../vmisc/vsettings.h"
#include "../vmisc/vmath.h" #include "../vmisc/vmath.h"
#include "../vmisc/projectversion.h" #include "../vmisc/projectversion.h"
@ -608,6 +608,10 @@ void VPattern::customEvent(QEvent *event)
{ {
qApp->getUndoStack()->undo(); qApp->getUndoStack()->undo();
} }
else if (event->type() == LITE_PARSE_EVENT)
{
LiteParseTree(Document::LiteParse);
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
/************************************************************************ /************************************************************************
** **
** @file undoevent.h ** @file customevents.h
** @author Roman Telezhynskyi <dismine(at)gmail.com> ** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 23 6, 2014 ** @date 23 6, 2014
** **
@ -26,20 +26,37 @@
** **
*************************************************************************/ *************************************************************************/
#ifndef UNDOEVENT_H #ifndef CUSTOMEVENTS_H
#define UNDOEVENT_H #define CUSTOMEVENTS_H
#include <qcompilerdetection.h> #include <qcompilerdetection.h>
#include <QEvent> #include <QEvent>
enum CustomEventType { UndoEventType = 1, LiteParseEventType = 2 };
// Define undo event identifier // Define undo event identifier
const QEvent::Type UNDO_EVENT = static_cast<QEvent::Type>(QEvent::User + 1); const QEvent::Type UNDO_EVENT = static_cast<QEvent::Type>(QEvent::User + CustomEventType::UndoEventType);
class UndoEvent : public QEvent class UndoEvent : public QEvent
{ {
public: public:
UndoEvent(); UndoEvent()
virtual ~UndoEvent() Q_DECL_OVERRIDE; : QEvent(UNDO_EVENT)
{}
virtual ~UndoEvent() =default;
}; };
#endif // UNDOEVENT_H const QEvent::Type LITE_PARSE_EVENT = static_cast<QEvent::Type>(QEvent::User + CustomEventType::LiteParseEventType);
class LiteParseEvent : public QEvent
{
public:
LiteParseEvent()
: QEvent(LITE_PARSE_EVENT)
{}
virtual ~LiteParseEvent() =default;
};
#endif // CUSTOMEVENTS_H

View File

@ -1,38 +0,0 @@
/************************************************************************
**
** @file undoevent.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 23 6, 2014
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include "undoevent.h"
//---------------------------------------------------------------------------------------------------------------------
UndoEvent::UndoEvent()
:QEvent(UNDO_EVENT)
{}
//---------------------------------------------------------------------------------------------------------------------
UndoEvent::~UndoEvent()
{}

View File

@ -3,7 +3,6 @@
SOURCES += \ SOURCES += \
$$PWD/def.cpp \ $$PWD/def.cpp \
$$PWD/undoevent.cpp \
$$PWD/vsettings.cpp \ $$PWD/vsettings.cpp \
$$PWD/vabstractapplication.cpp \ $$PWD/vabstractapplication.cpp \
$$PWD/projectversion.cpp \ $$PWD/projectversion.cpp \
@ -21,7 +20,6 @@ HEADERS += \
$$PWD/def.h \ $$PWD/def.h \
$$PWD/logging.h \ $$PWD/logging.h \
$$PWD/vmath.h \ $$PWD/vmath.h \
$$PWD/undoevent.h \
$$PWD/vsettings.h \ $$PWD/vsettings.h \
$$PWD/vabstractapplication.h \ $$PWD/vabstractapplication.h \
$$PWD/projectversion.h \ $$PWD/projectversion.h \
@ -34,7 +32,8 @@ HEADERS += \
$$PWD/qxtcsvmodel.h \ $$PWD/qxtcsvmodel.h \
$$PWD/vtablesearch.h \ $$PWD/vtablesearch.h \
$$PWD/diagnostic.h \ $$PWD/diagnostic.h \
$$PWD/dialogs/dialogexporttocsv.h $$PWD/dialogs/dialogexporttocsv.h \
$$PWD/customevents.h
# Qt's versions # Qt's versions
# 5.2.0, 5.2.1 # 5.2.0, 5.2.1

View File

@ -35,6 +35,7 @@
#include "../ifc/ifcdef.h" #include "../ifc/ifcdef.h"
#include "../vmisc/logging.h" #include "../vmisc/logging.h"
#include "../vmisc/vabstractapplication.h" #include "../vmisc/vabstractapplication.h"
#include "../vmisc/customevents.h"
#include "vundocommand.h" #include "vundocommand.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -45,10 +46,6 @@ AddToCalc::AddToCalc(const QDomElement &xml, VAbstractPattern *doc, QUndoCommand
nodeId = doc->GetParametrId(xml); nodeId = doc->GetParametrId(xml);
} }
//---------------------------------------------------------------------------------------------------------------------
AddToCalc::~AddToCalc()
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void AddToCalc::undo() void AddToCalc::undo()
{ {
@ -130,5 +127,9 @@ void AddToCalc::RedoFullParsing()
emit NeedFullParsing(); emit NeedFullParsing();
doc->SetCurrentPP(nameActivDraw);//Return current pattern piece after undo doc->SetCurrentPP(nameActivDraw);//Return current pattern piece after undo
} }
else
{
QApplication::postEvent(doc, new LiteParseEvent());
}
redoFlag = true; redoFlag = true;
} }

View File

@ -43,7 +43,7 @@ class AddToCalc : public VUndoCommand
Q_OBJECT Q_OBJECT
public: public:
AddToCalc(const QDomElement &xml, VAbstractPattern *doc, QUndoCommand *parent = nullptr); AddToCalc(const QDomElement &xml, VAbstractPattern *doc, QUndoCommand *parent = nullptr);
virtual ~AddToCalc() Q_DECL_OVERRIDE; virtual ~AddToCalc() =default;
virtual void undo() Q_DECL_OVERRIDE; virtual void undo() Q_DECL_OVERRIDE;
virtual void redo() Q_DECL_OVERRIDE; virtual void redo() Q_DECL_OVERRIDE;
protected: protected:

View File

@ -29,9 +29,11 @@
#include "vundocommand.h" #include "vundocommand.h"
#include <QDomNode> #include <QDomNode>
#include <QApplication>
#include "../ifc/ifcdef.h" #include "../ifc/ifcdef.h"
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "../vmisc/customevents.h"
#include "../vpatterndb/vnodedetail.h" #include "../vpatterndb/vnodedetail.h"
#include "../vpatterndb/vpiecenode.h" #include "../vpatterndb/vpiecenode.h"
@ -44,10 +46,6 @@ VUndoCommand::VUndoCommand(const QDomElement &xml, VAbstractPattern *doc, QUndoC
SCASSERT(doc != nullptr) SCASSERT(doc != nullptr)
} }
//---------------------------------------------------------------------------------------------------------------------
VUndoCommand::~VUndoCommand()
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VUndoCommand::RedoFullParsing() void VUndoCommand::RedoFullParsing()
{ {
@ -55,6 +53,10 @@ void VUndoCommand::RedoFullParsing()
{ {
emit NeedFullParsing(); emit NeedFullParsing();
} }
else
{
QApplication::postEvent(doc, new LiteParseEvent());
}
redoFlag = true; redoFlag = true;
} }

View File

@ -69,7 +69,7 @@ class VUndoCommand : public QObject, public QUndoCommand
Q_OBJECT Q_OBJECT
public: public:
VUndoCommand(const QDomElement &xml, VAbstractPattern *doc, QUndoCommand *parent = nullptr); VUndoCommand(const QDomElement &xml, VAbstractPattern *doc, QUndoCommand *parent = nullptr);
virtual ~VUndoCommand() Q_DECL_OVERRIDE; virtual ~VUndoCommand() =default;
signals: signals:
void ClearScene(); void ClearScene();
void NeedFullParsing(); void NeedFullParsing();