Add ability to store informations for element like label, manufacturer, ref etc....

Add widget to edit it, save/load works
Informations are stored in a diagramcontext, this class was modified (new feature) to store information
but keep compatibilty with older version.  


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2850 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2014-02-12 17:36:35 +00:00
parent 2c8bf84795
commit b361788873
14 changed files with 510 additions and 16 deletions

View File

@@ -21,6 +21,7 @@
#include "terminal.h"
#include "qetgraphicsitem.h"
#include <QUuid>
#include "elementsproperties.h"
class Diagram;
class ElementTextItem;
@@ -35,8 +36,7 @@ class Element : public QetGraphicsItem {
// constructors, destructor
public:
Element(QGraphicsItem * = 0, Diagram * = 0);
virtual ~Element();
virtual ~Element();
private:
Element(const Element &);
@@ -55,15 +55,11 @@ class Element : public QetGraphicsItem {
AllSlave = 48,
Bornier = 64};
protected:
QList <Element *> connected_elements;
QList <QUuid> tmp_uuids_link;
private:
QSize dimensions;
QPoint hotspot_coord;
QPixmap preview;
QUuid uuid_;
// methods
public:
@@ -98,19 +94,41 @@ class Element : public QetGraphicsItem {
/// @return the maximum number of terminals for this element
virtual int maxTerminalsCount() const = 0;
// related method for link between element
/**
*related method and attributes,
*about none graphic thing
*like the linked element or information about this element
*/
//METHODS related to linked element
public:
bool isFree () const;
virtual void linkToElement(Element *) {}
virtual void unlinkAllElements() {}
virtual void unlinkElement(Element *elmt) {}
virtual void unlinkElement(Element *) {}
void initLink(QETProject *);
QList<Element *> linkedElements () const;
//create new uuid for this element
void newUuid() {uuid_ = QUuid::createUuid();}
void newUuid() {uuid_ = QUuid::createUuid();} //create new uuid for this element
//ATTRIBUTES related to linked element
protected:
QList <Element *> connected_elements;
QList <QUuid> tmp_uuids_link;
QUuid uuid_;
//METHODS related to information
public:
DiagramContext informations()const {return informations_;}
void setInformations(DiagramContext dc) {informations_ = dc;}
//ATTRIBUTES
protected:
DiagramContext informations_;
/**
Draw this element
*/
public:
virtual void paint(QPainter *, const QStyleOptionGraphicsItem *) = 0;
/// @return This element type ID
virtual QString typeId() const = 0;