Fix bug with internal move of nodes inside the main path.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-03-28 12:08:33 +03:00
parent e9c9d263f6
commit 39c11130f9
4 changed files with 73 additions and 1 deletions

View file

@ -54,6 +54,9 @@ int main(int argc, char *argv[])
qt_qhash_seed.store(0); // Lock producing random attribute order in XML
// Need to internally move a node inside a piece main path
qRegisterMetaTypeStreamOperators<VPieceNode>("VPieceNode");
#ifndef Q_OS_MAC // supports natively
InitHighDpiScaling(argc, argv);
#endif //Q_OS_MAC

View file

@ -97,6 +97,21 @@ VPieceNode &VPieceNode::operator=(const VPieceNode &node)
VPieceNode::~VPieceNode()
{}
// Friend functions
//---------------------------------------------------------------------------------------------------------------------
QDataStream &operator<<(QDataStream &out, const VPieceNode &p)
{
out << p.d;
return out;
}
//---------------------------------------------------------------------------------------------------------------------
QDataStream &operator>>(QDataStream &in, VPieceNode &p)
{
in >> *p.d;
return in;
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VPieceNode::GetId() const
{

View file

@ -47,6 +47,9 @@ public:
VPieceNode &operator=(const VPieceNode &node);
~VPieceNode();
friend QDataStream& operator<<(QDataStream& out, const VPieceNode& p);
friend QDataStream& operator>>(QDataStream& in, VPieceNode& p);
quint32 GetId() const;
void SetId(quint32 id);

View file

@ -92,6 +92,9 @@ public:
~VPieceNodeData();
friend QDataStream& operator<<(QDataStream& out, const VPieceNodeData& p);
friend QDataStream& operator>>(QDataStream& in, VPieceNodeData& p);
/** @brief id object id. */
quint32 m_id;
@ -116,7 +119,7 @@ public:
PieceNodeAngle m_angleType;
PassmarkLineType m_passmarkLineType;
PassmarkLineType m_passmarkLineType;
PassmarkAngleType m_passmarkAngleType;
private:
@ -126,6 +129,54 @@ private:
VPieceNodeData::~VPieceNodeData()
{}
// Friend functions
//---------------------------------------------------------------------------------------------------------------------
QDataStream &operator<<(QDataStream &out, const VPieceNodeData &p)
{
out << p.m_id
<< static_cast<int>(p.m_typeTool)
<< p.m_reverse
<< p.m_excluded
<< p.m_isPassmark
<< p.m_saBefore
<< p.m_saAfter
<< p.m_formulaWidthBefore
<< p.m_formulaWidthAfter
<< static_cast<int>(p.m_angleType)
<< static_cast<int>(p.m_passmarkLineType)
<< static_cast<int>(p.m_passmarkAngleType);
return out;
}
//---------------------------------------------------------------------------------------------------------------------
QDataStream &operator>>(QDataStream &in, VPieceNodeData &p)
{
int typeTool = 0;
int angleType = 0;
int passmarkLineType = 0;
int passmarkAngleType = 0;
in >> p.m_id
>> typeTool
>> p.m_reverse
>> p.m_excluded
>> p.m_isPassmark
>> p.m_saBefore
>> p.m_saAfter
>> p.m_formulaWidthBefore
>> p.m_formulaWidthAfter
>> angleType
>> passmarkLineType
>> passmarkAngleType;
p.m_typeTool = static_cast<Tool>(typeTool);
p.m_angleType = static_cast<PieceNodeAngle>(angleType);
p.m_passmarkLineType = static_cast<PassmarkLineType>(passmarkLineType);
p.m_passmarkAngleType = static_cast<PassmarkAngleType>(passmarkAngleType);
return in;
}
QT_WARNING_POP
#endif // VPIECENODE_P_H