git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5579 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2018-11-10 12:19:30 +00:00
parent a76da57544
commit a620b4067d
7 changed files with 34 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
/* /*
Copyright 2006-2017 The QElectroTech Team Copyright 2006-2018 The QElectroTech Team
This file is part of QElectroTech. This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify QElectroTech is free software: you can redistribute it and/or modify
@@ -69,8 +69,9 @@ class ElementXmlRetroCompatibility
* @param parent, parent graphics item * @param parent, parent graphics item
* @param state, state of the instanciation * @param state, state of the instanciation
*/ */
Element::Element(const ElementsLocation &location, QGraphicsItem *parent, int *state) : Element::Element(const ElementsLocation &location, QGraphicsItem *parent, int *state, kind link_type) :
QetGraphicsItem(parent), QetGraphicsItem(parent),
m_link_type (link_type),
m_location (location) m_location (location)
{ {
if(! (location.isElement() && location.exist())) if(! (location.isElement() && location.exist()))
@@ -94,7 +95,6 @@ Element::Element(const ElementsLocation &location, QGraphicsItem *parent, int *s
} }
setPrefix(autonum::elementPrefixForLocation(location)); setPrefix(autonum::elementPrefixForLocation(location));
m_link_type = Simple;
m_uuid = QUuid::createUuid(); m_uuid = QUuid::createUuid();
setZValue(10); setZValue(10);
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable); setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);

View File

@@ -1,5 +1,5 @@
/* /*
Copyright 2006-2017 The QElectroTech Team Copyright 2006-2018 The QElectroTech Team
This file is part of QElectroTech. This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify QElectroTech is free software: you can redistribute it and/or modify
@@ -42,10 +42,20 @@ class Element : public QetGraphicsItem
friend class DiagramEventAddElement; friend class DiagramEventAddElement;
Q_OBJECT Q_OBJECT
// constructors, destructor
public: public:
Element(const ElementsLocation &location, QGraphicsItem * = nullptr, int *state = nullptr); /**
* @brief The kind enum
* Used to know the kind of this element (master, slave, report ect...)
*/
enum kind {Simple = 1,
NextReport = 2,
PreviousReport = 4,
AllReport = 6,
Master = 8,
Slave = 16,
Terminale = 32};
Element(const ElementsLocation &location, QGraphicsItem * = nullptr, int *state = nullptr, Element::kind link_type = Element::Simple);
~Element() override; ~Element() override;
private: private:
Element(const Element &); Element(const Element &);
@@ -58,18 +68,6 @@ class Element : public QetGraphicsItem
*/ */
enum { Type = UserType + 1000 }; enum { Type = UserType + 1000 };
int type() const override { return Type; } int type() const override { return Type; }
/**
* @brief The kind enum
* Used to know the kind of this element (master, slave, report ect...)
*/
enum kind {Simple = 1,
NextReport = 2,
PreviousReport = 4,
AllReport = 6,
Master = 8,
Slave = 16,
Terminale = 32};
signals: signals:
void linkedElementChanged(); //This signal is emited when the linked elements with this element change void linkedElementChanged(); //This signal is emited when the linked elements with this element change
@@ -173,7 +171,7 @@ class Element : public QetGraphicsItem
QList <Element *> connected_elements; QList <Element *> connected_elements;
QList <QUuid> tmp_uuids_link; QList <QUuid> tmp_uuids_link;
QUuid m_uuid; QUuid m_uuid;
kind m_link_type; kind m_link_type = Element::Simple;
//ATTRIBUTES related to informations //ATTRIBUTES related to informations
DiagramContext m_element_informations, m_kind_informations; DiagramContext m_element_informations, m_kind_informations;

View File

@@ -1,5 +1,5 @@
/* /*
Copyright 2006-2017 The QElectroTech Team Copyright 2006-2018 The QElectroTech Team
This file is part of QElectroTech. This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify QElectroTech is free software: you can redistribute it and/or modify
@@ -30,10 +30,8 @@
* @param state int used to know if the creation of element have error * @param state int used to know if the creation of element have error
*/ */
MasterElement::MasterElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) : MasterElement::MasterElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
Element(location, qgi, state) Element(location, qgi, state, Element::Master)
{ {}
m_link_type = Element::Master;
}
/** /**
* @brief MasterElement::~MasterElement * @brief MasterElement::~MasterElement

View File

@@ -1,5 +1,5 @@
/* /*
Copyright 2006-2017 The QElectroTech Team Copyright 2006-2018 The QElectroTech Team
This file is part of QElectroTech. This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify QElectroTech is free software: you can redistribute it and/or modify
@@ -24,11 +24,10 @@
#include "dynamicelementtextitem.h" #include "dynamicelementtextitem.h"
ReportElement::ReportElement(const ElementsLocation &location, const QString& link_type,QGraphicsItem *qgi, int *state) : ReportElement::ReportElement(const ElementsLocation &location, const QString& link_type,QGraphicsItem *qgi, int *state) :
Element(location, qgi, state) Element(location, qgi, state,
{ link_type == "next_report"? Element::NextReport : Element::PreviousReport),
link_type == "next_report"? m_link_type=NextReport : m_link_type=PreviousReport; m_inverse_report(link_type == "next_report"? Element::PreviousReport : Element::NextReport)
link_type == "next_report"? m_inverse_report=PreviousReport : m_inverse_report=NextReport; {}
}
/** /**
* @brief ReportElement::~ReportElement * @brief ReportElement::~ReportElement

View File

@@ -1,5 +1,5 @@
/* /*
Copyright 2006-2017 The QElectroTech Team Copyright 2006-2018 The QElectroTech Team
This file is part of QElectroTech. This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify QElectroTech is free software: you can redistribute it and/or modify
@@ -26,10 +26,8 @@
* @param state * @param state
*/ */
SimpleElement::SimpleElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) : SimpleElement::SimpleElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
Element(location, qgi, state) Element(location, qgi, state, Element::Simple)
{ {}
m_link_type = Simple;
}
/** /**
* @brief SimpleElement::~SimpleElement * @brief SimpleElement::~SimpleElement

View File

@@ -1,5 +1,5 @@
/* /*
Copyright 2006-2017 The QElectroTech Team Copyright 2006-2018 The QElectroTech Team
This file is part of QElectroTech. This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify QElectroTech is free software: you can redistribute it and/or modify
@@ -30,10 +30,9 @@
* @param state int used to know if the creation of element have error * @param state int used to know if the creation of element have error
*/ */
SlaveElement::SlaveElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) : SlaveElement::SlaveElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
Element(location, qgi, state) Element(location, qgi, state, Element::Slave)
{ {
m_xref_item = nullptr; m_xref_item = nullptr;
m_link_type = Slave;
} }
/** /**

View File

@@ -1,5 +1,5 @@
/* /*
Copyright 2006-2017 The QElectroTech Team Copyright 2006-2018 The QElectroTech Team
This file is part of QElectroTech. This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify QElectroTech is free software: you can redistribute it and/or modify
@@ -26,8 +26,8 @@
* @param state int used to know if the creation of element have error * @param state int used to know if the creation of element have error
*/ */
TerminalElement::TerminalElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) : TerminalElement::TerminalElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
Element(location, qgi, state) Element(location, qgi, state, Element::Terminale)
{m_link_type = Terminale;} {}
TerminalElement::~TerminalElement() {} TerminalElement::~TerminalElement() {}