mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Minor change according to the evolution of Qt class (remove QGraphicsScene from constructor of QGraphicsItem).
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3547 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -555,7 +555,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
||||
if (type_id.startsWith("embed://")) element_location.setProject(project_);
|
||||
|
||||
int state = 0;
|
||||
Element *nvel_elmt = ElementFactory::Instance()->createElement(element_location, 0, this, &state);
|
||||
Element *nvel_elmt = ElementFactory::Instance() -> createElement(element_location, 0, &state);
|
||||
if (state) {
|
||||
QString debug_message = QString("Diagram::fromXml() : Le chargement de la description de l'element %1 a echoue avec le code d'erreur %2").arg(element_location.path()).arg(state);
|
||||
qDebug() << qPrintable(debug_message);
|
||||
@@ -579,7 +579,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
||||
// Load text
|
||||
QList<IndependentTextItem *> added_texts;
|
||||
foreach (QDomElement text_xml, QET::findInDomElement(root, "inputs", "input")) {
|
||||
IndependentTextItem *iti = new IndependentTextItem(this);
|
||||
IndependentTextItem *iti = new IndependentTextItem();
|
||||
iti -> fromXml(text_xml);
|
||||
addItem(iti);
|
||||
added_texts << iti;
|
||||
@@ -623,8 +623,9 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
||||
}
|
||||
}
|
||||
if (can_add_conductor) {
|
||||
Conductor *c = new Conductor(table_adr_id.value(id_p1), table_adr_id.value(id_p2), this);
|
||||
Conductor *c = new Conductor(table_adr_id.value(id_p1), table_adr_id.value(id_p2));
|
||||
c -> fromXml(f);
|
||||
addItem(c);
|
||||
added_conductors << c;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ void DiagramView::handleTitleBlockDrop(QDropEvent *e) {
|
||||
void DiagramView::handleTextDrop(QDropEvent *e) {
|
||||
if (scene -> isReadOnly() || (e -> mimeData() -> hasText() == false) ) return;
|
||||
|
||||
IndependentTextItem *iti = new IndependentTextItem (e -> mimeData() -> text(), scene);
|
||||
IndependentTextItem *iti = new IndependentTextItem (e -> mimeData() -> text());
|
||||
|
||||
if (e -> mimeData() -> hasHtml()) {
|
||||
iti -> setHtml (e -> mimeData() -> text());
|
||||
@@ -863,7 +863,7 @@ bool DiagramView::mustIntegrateTitleBlockTemplate(const TitleBlockTemplateLocati
|
||||
bool DiagramView::addElementAtPos(const ElementsLocation &location, const QPoint &pos) {
|
||||
// construit une instance de l'element correspondant a l'emplacement
|
||||
int state;
|
||||
Element *el = ElementFactory::Instance()->createElement(location, 0, diagram(), &state);
|
||||
Element *el = ElementFactory::Instance()->createElement(location, 0, &state);
|
||||
if (state) {
|
||||
delete el;
|
||||
return(false);
|
||||
|
||||
@@ -196,7 +196,7 @@ QPixmap ElementsCollectionCache::pixmap() const {
|
||||
*/
|
||||
bool ElementsCollectionCache::fetchData(const ElementsLocation &location) {
|
||||
int state;
|
||||
Element *custom_elmt = ElementFactory::Instance()->createElement(location, 0, 0, &state);
|
||||
Element *custom_elmt = ElementFactory::Instance() -> createElement(location, 0, &state);
|
||||
if (state) {
|
||||
qDebug() << "ElementsCollectionCache::fetchData() : Le chargement du composant" << qPrintable(location.toString()) << "a echoue avec le code d'erreur" << state;
|
||||
} else {
|
||||
|
||||
@@ -294,7 +294,7 @@ void ElementsPanel::startElementDrag(const ElementsLocation &location) {
|
||||
|
||||
// element temporaire pour fournir un apercu
|
||||
int elmt_creation_state;
|
||||
Element *temp_elmt = ElementFactory::Instance()->createElement(location, 0, 0, &elmt_creation_state);
|
||||
Element *temp_elmt = ElementFactory::Instance() -> createElement(location, 0, &elmt_creation_state);
|
||||
if (elmt_creation_state) {
|
||||
delete temp_elmt;
|
||||
return;
|
||||
|
||||
@@ -31,29 +31,31 @@ ElementFactory* ElementFactory::factory_ = 0;
|
||||
* @brief ElementFactory::createElement
|
||||
* @param location create element at this location
|
||||
* @param qgi parent item for this elemnt
|
||||
* @param s diagram of the element
|
||||
* @param state state of the creation
|
||||
* @return the element or 0
|
||||
*/
|
||||
Element * ElementFactory::createElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) {
|
||||
Element * ElementFactory::createElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state)
|
||||
{
|
||||
// recupere la definition de l'element
|
||||
ElementsCollectionItem *element_item = QETApp::collectionItem(location);
|
||||
ElementDefinition *element_definition;
|
||||
if (!element_item ||\
|
||||
!element_item -> isElement() ||\
|
||||
!(element_definition = qobject_cast<ElementDefinition *>(element_item))) {
|
||||
!(element_definition = qobject_cast<ElementDefinition *>(element_item)))
|
||||
{
|
||||
if (state) *state = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (element_definition->xml().hasAttribute("link_type")) {
|
||||
if (element_definition->xml().hasAttribute("link_type"))
|
||||
{
|
||||
QString link_type = element_definition->xml().attribute("link_type");
|
||||
if (link_type == "next_report" || link_type == "previous_report") return (new ReportElement(location, link_type, qgi, s, state));
|
||||
if (link_type == "master") return (new MasterElement (location, qgi, s, state));
|
||||
if (link_type == "slave") return (new SlaveElement (location, qgi, s, state));
|
||||
if (link_type == "terminal") return (new TerminalElement (location, qgi, s, state));
|
||||
if (link_type == "next_report" || link_type == "previous_report") return (new ReportElement(location, link_type, qgi, state));
|
||||
if (link_type == "master") return (new MasterElement (location, qgi, state));
|
||||
if (link_type == "slave") return (new SlaveElement (location, qgi, state));
|
||||
if (link_type == "terminal") return (new TerminalElement (location, qgi, state));
|
||||
}
|
||||
|
||||
//default if nothing match for link_type
|
||||
return (new SimpleElement(location, qgi, s, state));
|
||||
return (new SimpleElement(location, qgi, state));
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ class ElementFactory
|
||||
}
|
||||
return factory_;
|
||||
}
|
||||
|
||||
// delete the instance of factory
|
||||
static void dropInstance () {
|
||||
static QMutex mutex;
|
||||
@@ -55,6 +56,7 @@ class ElementFactory
|
||||
mutex.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
//attributes
|
||||
private:
|
||||
static ElementFactory* factory_;
|
||||
@@ -67,7 +69,7 @@ class ElementFactory
|
||||
~ElementFactory() {}
|
||||
|
||||
public:
|
||||
Element * createElement (const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
|
||||
Element * createElement (const ElementsLocation &, QGraphicsItem * = 0, int * = 0);
|
||||
};
|
||||
//ElementFactory ElementFactory::factory_ = 0;
|
||||
#endif // ELEMENTFACTORY_H
|
||||
|
||||
@@ -39,9 +39,9 @@ QBrush Conductor::square_brush = QBrush(Qt::darkGreen);
|
||||
@param p2 Seconde Borne a laquelle le conducteur est lie
|
||||
@param parent_diagram QGraphicsScene a laquelle appartient le conducteur
|
||||
*/
|
||||
Conductor::Conductor(Terminal *p1, Terminal* p2, Diagram *parent_diagram) :
|
||||
Conductor::Conductor(Terminal *p1, Terminal* p2) :
|
||||
QObject(),
|
||||
QGraphicsPathItem(0, parent_diagram),
|
||||
QGraphicsPathItem(0),
|
||||
terminal1(p1),
|
||||
terminal2(p2),
|
||||
bMouseOver(false),
|
||||
|
||||
@@ -43,7 +43,7 @@ class Conductor : public QObject, public QGraphicsPathItem {
|
||||
|
||||
// constructors, destructor
|
||||
public:
|
||||
Conductor(Terminal *, Terminal *, Diagram * = 0);
|
||||
Conductor(Terminal *, Terminal *);
|
||||
virtual ~Conductor();
|
||||
|
||||
private:
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
@param parent_conductor Conducteur auquel ce texte est rattache
|
||||
@param parent_diagram Schema auquel ce texte et son conducteur parent sont rattaches
|
||||
*/
|
||||
ConductorTextItem::ConductorTextItem(Conductor *parent_conductor, Diagram *parent_diagram) :
|
||||
DiagramTextItem(parent_conductor, parent_diagram),
|
||||
ConductorTextItem::ConductorTextItem(Conductor *parent_conductor) :
|
||||
DiagramTextItem(parent_conductor),
|
||||
parent_conductor_(parent_conductor),
|
||||
moved_by_user_(false),
|
||||
rotate_by_user_(false)
|
||||
@@ -40,8 +40,8 @@ ConductorTextItem::ConductorTextItem(Conductor *parent_conductor, Diagram *paren
|
||||
@param parent_conductor Conducteur auquel ce texte est rattache
|
||||
@param parent_diagram Schema auquel ce texte et son conducteur parent sont rattaches
|
||||
*/
|
||||
ConductorTextItem::ConductorTextItem(const QString &text, Conductor *parent_conductor, Diagram *parent_diagram) :
|
||||
DiagramTextItem(text, parent_conductor, parent_diagram),
|
||||
ConductorTextItem::ConductorTextItem(const QString &text, Conductor *parent_conductor) :
|
||||
DiagramTextItem(text, parent_conductor),
|
||||
parent_conductor_(parent_conductor),
|
||||
moved_by_user_(false),
|
||||
rotate_by_user_(false)
|
||||
|
||||
@@ -31,8 +31,8 @@ class ConductorTextItem : public DiagramTextItem {
|
||||
|
||||
// constructors, destructor
|
||||
public:
|
||||
ConductorTextItem(Conductor * = 0, Diagram * = 0);
|
||||
ConductorTextItem(const QString &, Conductor * = 0, Diagram * = 0);
|
||||
ConductorTextItem(Conductor * = 0);
|
||||
ConductorTextItem(const QString &, Conductor * = 0);
|
||||
virtual ~ConductorTextItem();
|
||||
private:
|
||||
ConductorTextItem(const ConductorTextItem &);
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
- 7 : L'analyse d'un element XML decrivant une partie du dessin de l'element a echoue
|
||||
- 8 : Aucune partie du dessin n'a pu etre chargee
|
||||
*/
|
||||
CustomElement::CustomElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) :
|
||||
FixedElement(qgi, s),
|
||||
CustomElement::CustomElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
|
||||
FixedElement(qgi),
|
||||
elmt_state(-1),
|
||||
location_(location),
|
||||
forbid_antialiasing(false)
|
||||
@@ -759,7 +759,7 @@ Terminal *CustomElement::parseTerminal(QDomElement &e) {
|
||||
else if (e.attribute("orientation") == "e") terminalo = Qet::East;
|
||||
else if (e.attribute("orientation") == "w") terminalo = Qet::West;
|
||||
else return(0);
|
||||
Terminal *new_terminal = new Terminal(terminalx, terminaly, terminalo, this, qobject_cast<Diagram *>(scene()));
|
||||
Terminal *new_terminal = new Terminal(terminalx, terminaly, terminalo, this);
|
||||
new_terminal -> setZValue(420); // valeur arbitraire pour maintenir les bornes au-dessus des champs de texte
|
||||
list_terminals << new_terminal;
|
||||
return(new_terminal);
|
||||
|
||||
@@ -36,7 +36,7 @@ class CustomElement : public FixedElement {
|
||||
|
||||
// constructors, destructor
|
||||
public:
|
||||
CustomElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
|
||||
CustomElement(const ElementsLocation &, QGraphicsItem * = 0, int * = 0);
|
||||
virtual ~CustomElement();
|
||||
|
||||
private:
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
@param parent Le QGraphicsItem parent du champ de texte
|
||||
@param parent_diagram Le schema auquel appartient le champ de texte
|
||||
*/
|
||||
DiagramTextItem::DiagramTextItem(QGraphicsItem *parent, Diagram *parent_diagram) :
|
||||
QGraphicsTextItem(parent, parent_diagram),
|
||||
DiagramTextItem::DiagramTextItem(QGraphicsItem *parent) :
|
||||
QGraphicsTextItem(parent),
|
||||
bMouseOver(false),
|
||||
previous_text_(),
|
||||
rotation_angle_(0.0),
|
||||
@@ -43,8 +43,8 @@ DiagramTextItem::DiagramTextItem(QGraphicsItem *parent, Diagram *parent_diagram)
|
||||
@param parent Le QGraphicsItem parent du champ de texte
|
||||
@param parent_diagram Le schema auquel appartient le champ de texte
|
||||
*/
|
||||
DiagramTextItem::DiagramTextItem(const QString &text, QGraphicsItem *parent, Diagram *parent_diagram) :
|
||||
QGraphicsTextItem(text, parent, parent_diagram),
|
||||
DiagramTextItem::DiagramTextItem(const QString &text, QGraphicsItem *parent) :
|
||||
QGraphicsTextItem(text, parent),
|
||||
bMouseOver(false),
|
||||
previous_text_(text),
|
||||
rotation_angle_(0.0)
|
||||
|
||||
@@ -33,8 +33,8 @@ class DiagramTextItem : public QGraphicsTextItem {
|
||||
Q_OBJECT
|
||||
// constructors, destructor
|
||||
public:
|
||||
DiagramTextItem(QGraphicsItem * = 0, Diagram * = 0);
|
||||
DiagramTextItem(const QString &, QGraphicsItem * = 0, Diagram * = 0);
|
||||
DiagramTextItem(QGraphicsItem * = 0);
|
||||
DiagramTextItem(const QString &, QGraphicsItem * = 0);
|
||||
virtual ~DiagramTextItem();
|
||||
|
||||
private:
|
||||
|
||||
@@ -30,14 +30,12 @@
|
||||
/**
|
||||
Constructeur pour un element sans scene ni parent
|
||||
*/
|
||||
Element::Element(QGraphicsItem *parent, Diagram *scene) :
|
||||
Element::Element(QGraphicsItem *parent) :
|
||||
QetGraphicsItem(parent),
|
||||
internal_connections_(false),
|
||||
must_highlight_(false),
|
||||
bMouseOver(false)
|
||||
{
|
||||
Q_UNUSED(scene);
|
||||
|
||||
link_type_ = Simple;
|
||||
uuid_ = QUuid::createUuid();
|
||||
setZValue(10);
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "qetgraphicsitem.h"
|
||||
#include "diagramcontext.h"
|
||||
|
||||
class Diagram;
|
||||
class ElementTextItem;
|
||||
class QETProject;
|
||||
class Terminal;
|
||||
@@ -32,12 +31,11 @@ class Conductor;
|
||||
This is the base class for electrical elements.
|
||||
*/
|
||||
class Element : public QetGraphicsItem {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
// constructors, destructor
|
||||
public:
|
||||
Element(QGraphicsItem * = 0, Diagram * = 0);
|
||||
Element(QGraphicsItem * = 0);
|
||||
virtual ~Element();
|
||||
private:
|
||||
Element(const Element &);
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
@param parent_element Le QGraphicsItem parent du champ de texte
|
||||
@param parent_diagram Le schema auquel appartient le champ de texte
|
||||
*/
|
||||
ElementTextItem::ElementTextItem(Element *parent_element, Diagram *parent_diagram) :
|
||||
DiagramTextItem(parent_element, parent_diagram),
|
||||
ElementTextItem::ElementTextItem(Element *parent_element) :
|
||||
DiagramTextItem(parent_element),
|
||||
parent_element_(parent_element),
|
||||
follow_parent_rotations(false),
|
||||
original_rotation_angle_(0.0)
|
||||
@@ -39,8 +39,8 @@ ElementTextItem::ElementTextItem(Element *parent_element, Diagram *parent_diagra
|
||||
@param parent_diagram Le schema auquel appartient le champ de texte
|
||||
@param text Le texte affiche par le champ de texte
|
||||
*/
|
||||
ElementTextItem::ElementTextItem(const QString &text, Element *parent_element, Diagram *parent_diagram) :
|
||||
DiagramTextItem(text, parent_element, parent_diagram),
|
||||
ElementTextItem::ElementTextItem(const QString &text, Element *parent_element) :
|
||||
DiagramTextItem(text, parent_element),
|
||||
parent_element_(parent_element),
|
||||
follow_parent_rotations(false),
|
||||
original_rotation_angle_(0.0)
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "diagramtextitem.h"
|
||||
|
||||
class Diagram;
|
||||
class Element;
|
||||
|
||||
/**
|
||||
@@ -32,8 +31,8 @@ class ElementTextItem : public DiagramTextItem {
|
||||
Q_OBJECT
|
||||
// constructors, destructor
|
||||
public:
|
||||
ElementTextItem(Element * = 0, Diagram * = 0);
|
||||
ElementTextItem(const QString &, Element * = 0, Diagram * = 0);
|
||||
ElementTextItem(Element * = 0);
|
||||
ElementTextItem(const QString &, Element * = 0);
|
||||
virtual ~ElementTextItem();
|
||||
|
||||
// attributes
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
/**
|
||||
Constructeur
|
||||
*/
|
||||
FixedElement::FixedElement(QGraphicsItem *parent, Diagram *scene) : Element(parent, scene) {
|
||||
FixedElement::FixedElement(QGraphicsItem *parent) : Element(parent) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
*/
|
||||
#ifndef ELEMENTFIXE_H
|
||||
#define ELEMENTFIXE_H
|
||||
|
||||
#include "element.h"
|
||||
|
||||
/**
|
||||
This class represents an element having a fixed number of terminals.
|
||||
*/
|
||||
@@ -27,7 +29,7 @@ class FixedElement : public Element {
|
||||
|
||||
// constructors, destructor
|
||||
public:
|
||||
FixedElement(QGraphicsItem * = 0, Diagram * = 0);
|
||||
FixedElement(QGraphicsItem * = 0);
|
||||
virtual ~FixedElement();
|
||||
|
||||
// methods
|
||||
|
||||
@@ -29,10 +29,9 @@
|
||||
*/
|
||||
GhostElement::GhostElement(
|
||||
const ElementsLocation &location,
|
||||
QGraphicsItem *qgi,
|
||||
Diagram *d
|
||||
QGraphicsItem *qgi
|
||||
) :
|
||||
CustomElement(location, qgi, d)
|
||||
CustomElement(location, qgi)
|
||||
{
|
||||
QString tooltip_string = QString(
|
||||
tr("<u>\311l\351ment manquant\240:</u> %1")
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#ifndef GHOST_ELEMENT_H
|
||||
#define GHOST_ELEMENT_H
|
||||
#include "customelement.h"
|
||||
class Diagram;
|
||||
class QGraphicsItem;
|
||||
class ElementsLocation;
|
||||
class Terminal;
|
||||
@@ -37,7 +36,7 @@ class GhostElement : public CustomElement {
|
||||
|
||||
// constructor, destructor
|
||||
public:
|
||||
GhostElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0);
|
||||
GhostElement(const ElementsLocation &, QGraphicsItem * = 0);
|
||||
virtual ~GhostElement();
|
||||
|
||||
// methods
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
Constructeur
|
||||
@param parent_diagram Le schema auquel est rattache le champ de texte
|
||||
*/
|
||||
IndependentTextItem::IndependentTextItem(Diagram *parent_diagram) :
|
||||
DiagramTextItem(0, parent_diagram)
|
||||
IndependentTextItem::IndependentTextItem() :
|
||||
DiagramTextItem(0)
|
||||
{}
|
||||
|
||||
/**
|
||||
@@ -31,8 +31,8 @@ IndependentTextItem::IndependentTextItem(Diagram *parent_diagram) :
|
||||
@param text Le texte affiche par le champ de texte
|
||||
@param parent_diagram Le schema auquel est rattache le champ de texte
|
||||
*/
|
||||
IndependentTextItem::IndependentTextItem(const QString &text, Diagram *parent_diagram) :
|
||||
DiagramTextItem(text, 0, parent_diagram)
|
||||
IndependentTextItem::IndependentTextItem(const QString &text) :
|
||||
DiagramTextItem(text, 0)
|
||||
{}
|
||||
|
||||
/// Destructeur
|
||||
|
||||
@@ -28,8 +28,8 @@ class IndependentTextItem : public DiagramTextItem {
|
||||
Q_OBJECT
|
||||
// constructors, destructor
|
||||
public:
|
||||
IndependentTextItem(Diagram * = 0);
|
||||
IndependentTextItem(const QString &, Diagram* = 0);
|
||||
IndependentTextItem();
|
||||
IndependentTextItem(const QString &);
|
||||
virtual ~IndependentTextItem();
|
||||
|
||||
// attributes
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
* @param s parent diagram
|
||||
* @param state int used to know if the creation of element have error
|
||||
*/
|
||||
MasterElement::MasterElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) :
|
||||
CustomElement(location, qgi, s, state),
|
||||
MasterElement::MasterElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
|
||||
CustomElement(location, qgi, state),
|
||||
cri_ (nullptr)
|
||||
{
|
||||
link_type_ = Master;
|
||||
|
||||
@@ -33,7 +33,7 @@ class MasterElement : public CustomElement
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MasterElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
|
||||
explicit MasterElement(const ElementsLocation &, QGraphicsItem * = 0, int * = 0);
|
||||
~MasterElement();
|
||||
|
||||
virtual void linkToElement (Element *elmt);
|
||||
|
||||
@@ -21,17 +21,13 @@
|
||||
#include "qetproject.h"
|
||||
#include "diagram.h"
|
||||
|
||||
ReportElement::ReportElement(const ElementsLocation &location, QString link_type,QGraphicsItem *qgi, Diagram *s, int *state) :
|
||||
CustomElement(location, qgi, s, state)
|
||||
ReportElement::ReportElement(const ElementsLocation &location, QString link_type,QGraphicsItem *qgi, int *state) :
|
||||
CustomElement(location, qgi, state)
|
||||
{
|
||||
if (!texts().isEmpty())
|
||||
texts().first()->setNoEditable();
|
||||
link_type == "next_report"? link_type_=NextReport : link_type_=PreviousReport;
|
||||
link_type == "next_report"? inverse_report=PreviousReport : inverse_report=NextReport;
|
||||
if (s) {
|
||||
label_ = s->defaultReportProperties();
|
||||
connect(s, SIGNAL(reportPropertiesChanged(QString)), this, SLOT(setLabel(QString)));
|
||||
}
|
||||
}
|
||||
|
||||
ReportElement::~ReportElement() {
|
||||
@@ -44,21 +40,35 @@ ReportElement::~ReportElement() {
|
||||
* @param elmt
|
||||
* element to be linked with this
|
||||
*/
|
||||
void ReportElement::linkToElement(Element * elmt) {
|
||||
void ReportElement::linkToElement(Element * elmt)
|
||||
{
|
||||
if (!diagram() && !elmt -> diagram())
|
||||
{
|
||||
qDebug() << "ReportElement : linkToElement : Unable to link this or element to link isn't in a diagram";
|
||||
return;
|
||||
}
|
||||
|
||||
//ensure elmt isn't already linked
|
||||
bool i = true;
|
||||
if (!this->isFree()){
|
||||
if (!this -> isFree())
|
||||
{
|
||||
if (connected_elements.first() == elmt) i = false;
|
||||
}
|
||||
|
||||
//ensure elmt is an inverse report of this element
|
||||
if ((elmt->linkType() == inverse_report) && i) {
|
||||
if ((elmt->linkType() == inverse_report) && i)
|
||||
{
|
||||
unlinkAllElements();
|
||||
connected_elements << elmt;
|
||||
|
||||
connect(elmt, SIGNAL( xChanged() ), this, SLOT( updateLabel() ));
|
||||
connect(elmt, SIGNAL( yChanged() ), this, SLOT( updateLabel() ));
|
||||
connect(diagram(), SIGNAL( reportPropertiesChanged(QString) ), this, SLOT( setLabel(QString) ));
|
||||
connect(diagram() -> project(), SIGNAL( projectDiagramsOrderChanged(QETProject*,int,int) ), this, SLOT( updateLabel() ));
|
||||
|
||||
label_ = diagram() -> defaultReportProperties();
|
||||
updateLabel();
|
||||
|
||||
elmt -> linkToElement(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class ReportElement : public CustomElement {
|
||||
Q_OBJECT
|
||||
|
||||
public :
|
||||
explicit ReportElement(const ElementsLocation &,QString link_type, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
|
||||
explicit ReportElement(const ElementsLocation &,QString link_type, QGraphicsItem * = 0, int * = 0);
|
||||
~ReportElement();
|
||||
virtual void linkToElement(Element *);
|
||||
virtual void unlinkAllElements();
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
* @param s
|
||||
* @param state
|
||||
*/
|
||||
SimpleElement::SimpleElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) :
|
||||
CustomElement(location, qgi, s, state),
|
||||
SimpleElement::SimpleElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
|
||||
CustomElement(location, qgi, state),
|
||||
m_comment_item (nullptr)
|
||||
{
|
||||
link_type_ = Simple;
|
||||
|
||||
@@ -32,7 +32,7 @@ class SimpleElement : public CustomElement {
|
||||
Q_OBJECT
|
||||
|
||||
public :
|
||||
explicit SimpleElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
|
||||
explicit SimpleElement(const ElementsLocation &, QGraphicsItem * = 0, int * = 0);
|
||||
~SimpleElement();
|
||||
|
||||
virtual void initLink(QETProject *project);
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
* @param s parent diagram
|
||||
* @param state int used to know if the creation of element have error
|
||||
*/
|
||||
SlaveElement::SlaveElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) :
|
||||
CustomElement(location, qgi, s, state)
|
||||
SlaveElement::SlaveElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
|
||||
CustomElement(location, qgi, state)
|
||||
{
|
||||
Xref_item = NULL;
|
||||
link_type_ = Slave;
|
||||
|
||||
@@ -24,7 +24,7 @@ class SlaveElement : public CustomElement
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SlaveElement (const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
|
||||
explicit SlaveElement (const ElementsLocation &, QGraphicsItem * = 0, int * = 0);
|
||||
~SlaveElement();
|
||||
virtual void linkToElement(Element *elmt);
|
||||
virtual void unlinkAllElements();
|
||||
|
||||
@@ -76,8 +76,8 @@ void Terminal::init(QPointF pf, Qet::Orientation o, QString number, QString name
|
||||
@param e Element auquel cette borne appartient
|
||||
@param s Scene sur laquelle figure cette borne
|
||||
*/
|
||||
Terminal::Terminal(QPointF pf, Qet::Orientation o, Element *e, Diagram *s) :
|
||||
QGraphicsItem(e, s),
|
||||
Terminal::Terminal(QPointF pf, Qet::Orientation o, Element *e) :
|
||||
QGraphicsItem(e),
|
||||
parent_element_(e),
|
||||
hovered_color_(Terminal::neutralColor)
|
||||
{
|
||||
@@ -92,8 +92,8 @@ Terminal::Terminal(QPointF pf, Qet::Orientation o, Element *e, Diagram *s) :
|
||||
@param e Element auquel cette borne appartient
|
||||
@param s Scene sur laquelle figure cette borne
|
||||
*/
|
||||
Terminal::Terminal(qreal pf_x, qreal pf_y, Qet::Orientation o, Element *e, Diagram *s) :
|
||||
QGraphicsItem(e, s),
|
||||
Terminal::Terminal(qreal pf_x, qreal pf_y, Qet::Orientation o, Element *e) :
|
||||
QGraphicsItem(e),
|
||||
parent_element_(e),
|
||||
hovered_color_(Terminal::neutralColor)
|
||||
{
|
||||
@@ -110,8 +110,8 @@ Terminal::Terminal(qreal pf_x, qreal pf_y, Qet::Orientation o, Element *e, Diagr
|
||||
@param e Element auquel cette borne appartient
|
||||
@param s Scene sur laquelle figure cette borne
|
||||
*/
|
||||
Terminal::Terminal(QPointF pf, Qet::Orientation o, QString num, QString name, bool hiddenName, Element *e, Diagram *s) :
|
||||
QGraphicsItem(e, s),
|
||||
Terminal::Terminal(QPointF pf, Qet::Orientation o, QString num, QString name, bool hiddenName, Element *e) :
|
||||
QGraphicsItem(e),
|
||||
parent_element_(e),
|
||||
hovered_color_(Terminal::neutralColor)
|
||||
{
|
||||
|
||||
@@ -31,9 +31,9 @@ class Terminal : public QGraphicsItem {
|
||||
|
||||
// constructors, destructor
|
||||
public:
|
||||
Terminal(QPointF, Qet::Orientation, Element * = 0, Diagram * = 0);
|
||||
Terminal(qreal, qreal, Qet::Orientation, Element * = 0, Diagram * = 0);
|
||||
Terminal(QPointF, Qet::Orientation, QString number, QString name, bool hiddenName, Element * = 0, Diagram * = 0);
|
||||
Terminal(QPointF, Qet::Orientation, Element * = 0);
|
||||
Terminal(qreal, qreal, Qet::Orientation, Element * = 0);
|
||||
Terminal(QPointF, Qet::Orientation, QString number, QString name, bool hiddenName, Element * = 0);
|
||||
virtual ~Terminal();
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user