mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-04-28 08:19:58 +02:00
add pattern factory/singletton to create different type of element
add two news class for element type : simple and folio report add an empty tab for the element report in the element properties widget git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2665 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -82,12 +82,6 @@ CustomElement::CustomElement(const ElementsLocation &location, QGraphicsItem *qg
|
||||
elmt_state = 0;
|
||||
}
|
||||
|
||||
CustomElement::CustomElement(const QDomElement &xml_def_elmt, QGraphicsItem *qgi, Diagram *s, int *state) : FixedElement(qgi, s) {
|
||||
int elmt_state = -1;
|
||||
buildFromXml(xml_def_elmt, &elmt_state);
|
||||
if (state) *state = elmt_state;
|
||||
}
|
||||
|
||||
/**
|
||||
Construit l'element personnalise a partir d'un element XML representant sa
|
||||
definition.
|
||||
|
||||
@@ -35,7 +35,6 @@ class CustomElement : public FixedElement {
|
||||
// constructors, destructor
|
||||
public:
|
||||
CustomElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
|
||||
CustomElement(const QDomElement &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
|
||||
virtual ~CustomElement();
|
||||
|
||||
private:
|
||||
|
||||
@@ -28,6 +28,15 @@ class ElementTextItem;
|
||||
class Element : public QetGraphicsItem {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum linkerType{
|
||||
simple = 1,
|
||||
report = 2,
|
||||
master = 4,
|
||||
slave = 8,
|
||||
bornier = 16
|
||||
};
|
||||
|
||||
// constructors, destructor
|
||||
public:
|
||||
@@ -78,6 +87,8 @@ class Element : public QetGraphicsItem {
|
||||
virtual QString typeId() const = 0;
|
||||
/// @return the human name for this element
|
||||
virtual QString name() const = 0;
|
||||
/// @return the linkable type
|
||||
virtual int linkType() const = 0;
|
||||
|
||||
virtual bool isHighlighted() const;
|
||||
virtual void setHighlighted(bool);
|
||||
|
||||
26
sources/qetgraphicsitem/reportelement.cpp
Normal file
26
sources/qetgraphicsitem/reportelement.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright 2006-2013 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech 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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "reportelement.h"
|
||||
|
||||
ReportElement::ReportElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) :
|
||||
CustomElement(location, qgi, s, state)
|
||||
{}
|
||||
|
||||
int ReportElement::linkType() const {
|
||||
return ReportElement::report;
|
||||
}
|
||||
42
sources/qetgraphicsitem/reportelement.h
Normal file
42
sources/qetgraphicsitem/reportelement.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
Copyright 2006-2013 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech 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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef REPORTELEMENT_H
|
||||
#define REPORTELEMENT_H
|
||||
|
||||
#include "customelement.h"
|
||||
|
||||
/**
|
||||
* @brief The ReportElement class
|
||||
*this class represent an element that can be linked to an other ReportElement
|
||||
* a folio report in a diagram is a element that show a wire go on an other folio
|
||||
*/
|
||||
class ReportElement : public CustomElement {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public :
|
||||
explicit ReportElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
|
||||
|
||||
virtual int linkType() const;
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
};
|
||||
|
||||
#endif // REPORTELEMENT_H
|
||||
26
sources/qetgraphicsitem/simpleelement.cpp
Normal file
26
sources/qetgraphicsitem/simpleelement.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright 2006-2013 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech 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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "simpleelement.h"
|
||||
|
||||
SimpleElement::SimpleElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) :
|
||||
CustomElement(location, qgi, s, state)
|
||||
{}
|
||||
|
||||
int SimpleElement::linkType() const {
|
||||
return SimpleElement::simple;
|
||||
}
|
||||
42
sources/qetgraphicsitem/simpleelement.h
Normal file
42
sources/qetgraphicsitem/simpleelement.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
Copyright 2006-2013 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech 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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef SIMPLEELEMENT_H
|
||||
#define SIMPLEELEMENT_H
|
||||
|
||||
#include "customelement.h"
|
||||
|
||||
/**
|
||||
* @brief The SimpleElement class
|
||||
*this class represente a simple element with no specific attribute
|
||||
*/
|
||||
class SimpleElement : public CustomElement {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public :
|
||||
explicit SimpleElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
|
||||
|
||||
virtual int linkType() const;
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
};
|
||||
|
||||
#endif // SIMPLEELEMENT_H
|
||||
Reference in New Issue
Block a user