diff --git a/dev_doc/enum_type_of_QGraphicsItem b/dev_doc/enum_type_of_QGraphicsItem new file mode 100644 index 000000000..383f4e3a4 --- /dev/null +++ b/dev_doc/enum_type_of_QGraphicsItem @@ -0,0 +1,12 @@ + Type = UserType + ??? +Element + 1000 +Conductor + 1001 +Terminal + 1002 +ElementTextItem + 1003 +DiagramTextItem + 1004 +IndependentTextItem + 1005 +ConductorTextItem + 1006 +DiagramImageItem + 1007 +QetShapItem + 1008 +crossRefItem + 1009 +ElementPrimitiveDecorator + 2200 diff --git a/sources/diagram.cpp b/sources/diagram.cpp index c0b35387c..7446c324e 100644 --- a/sources/diagram.cpp +++ b/sources/diagram.cpp @@ -33,6 +33,7 @@ #include "qetapp.h" #include "qetgraphicsitem/diagramimageitem.h" #include "qetgraphicsitem/qetshapeitem.h" +#include "qetgraphicsitem/crossrefitem.h" const int Diagram::xGrid = 10; const int Diagram::yGrid = 10; @@ -80,32 +81,32 @@ Diagram::Diagram(QObject *parent) : } /** - Destructeur -*/ + * @brief Diagram::~Diagram + * Destructor + */ Diagram::~Diagram() { // clear undo stack to prevent errors, because contains pointers to this diagram and is elements. undoStack().clear(); - // suppression du QGIManager - tous les elements qu'il connait sont supprimes + //delete of QGIManager, every elements he knows are removed delete qgi_manager_; // remove of conductor setter delete conductor_setter_; - // suppression des objets gerant les deplacements + // delete of object for manage movement delete elements_mover_; delete element_texts_mover_; - // recense les items supprimables + // list removable items QList deletable_items; foreach(QGraphicsItem *qgi, items()) { if (qgi -> parentItem()) continue; if (qgraphicsitem_cast(qgi)) continue; + else if (qgraphicsitem_cast(qgi)) continue; + deletable_items << qgi; } - - // suppression des items supprimables - foreach(QGraphicsItem *qgi_d, deletable_items) { - delete qgi_d; - } + + qDeleteAll (deletable_items); } /** diff --git a/sources/qetgraphicsitem/crossrefitem.h b/sources/qetgraphicsitem/crossrefitem.h index d48705421..888bc59d2 100644 --- a/sources/qetgraphicsitem/crossrefitem.h +++ b/sources/qetgraphicsitem/crossrefitem.h @@ -39,6 +39,9 @@ class CrossRefItem : public QGraphicsObject explicit CrossRefItem(Element *elmt, QGraphicsItem *parent = 0); ~CrossRefItem(); + enum { Type = UserType + 1009 }; + virtual int type() const { return Type; } + QRectF boundingRect() const; virtual QPainterPath shape() const;