QElectroTech  0.70
Public Member Functions | Private Member Functions | Private Attributes | List of all members
QGIManager Class Reference

#include <qgimanager.h>

Public Member Functions

 QGIManager (QGraphicsScene *)
 
virtual ~QGIManager ()
 
void manage (QGraphicsItem *)
 
void release (QGraphicsItem *)
 
void manage (const QList< QGraphicsItem *> &)
 
void release (const QList< QGraphicsItem *> &)
 
void setDestroyQGIOnDelete (bool)
 
bool manages (QGraphicsItem *) const
 

Private Member Functions

 QGIManager (const QGIManager &)
 

Private Attributes

QGraphicsScene * scene
 
QHash< QGraphicsItem *, int > qgi_manager
 
bool destroy_qgi_on_delete
 

Detailed Description

This class provides a QGraphicsItem manager, which can delete QGraphicsItem as soon as there is no reference to them anymore.

Definition at line 27 of file qgimanager.h.

Constructor & Destructor Documentation

◆ QGIManager() [1/2]

QGIManager::QGIManager ( QGraphicsScene *  sc)

Constructeur

Parameters
scQGraphicsScene a utiliser pour gerer au mieux les QGraphicsItem

Definition at line 24 of file qgimanager.cpp.

◆ ~QGIManager()

QGIManager::~QGIManager ( )
virtual

Destructeur Lors de sa destruction, le QGI Manager detruit les QGraphicsItem restants si ceux-ci n'appartiennent pas a la scene ; ce comportement peut etre change avec la methode setDestroyQGIOnDelete

See also
setDestroyQGIOnDelete

Definition at line 37 of file qgimanager.cpp.

References destroy_qgi_on_delete, qgi_manager, and scene.

◆ QGIManager() [2/2]

QGIManager::QGIManager ( const QGIManager )
private

Member Function Documentation

◆ manage() [1/2]

void QGIManager::manage ( QGraphicsItem *  qgi)

Demande au QGIManager de gerer un QGI

Parameters
qgiQGraphicsItem a gerer

Definition at line 48 of file qgimanager.cpp.

References qgi_manager.

Referenced by DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand(), and manage().

◆ manage() [2/2]

void QGIManager::manage ( const QList< QGraphicsItem *> &  qgis)

Demande au QGIManager de gerer plusieurs QGI

Parameters
qgisQGraphicsItems a gerer

Definition at line 73 of file qgimanager.cpp.

References manage().

◆ manages()

bool QGIManager::manages ( QGraphicsItem *  qgi) const

Permet de savoir si ce QGIManager gere ou non un item donne

Parameters
qgiQGraphicsItem dont il faut verifier la presence
Returns
true si l'item est gere, false sinon

Definition at line 101 of file qgimanager.cpp.

References qgi_manager.

◆ release() [1/2]

void QGIManager::release ( QGraphicsItem *  qgi)

Indique au QGIManager qu'une reference vers un QGI a ete detruite S'il n'y a plus de references vers ce QGI et que celui-ci n'est pas present sur la scene de ce QGIManager, alors il sera detruit.

Parameters
qgiQGraphicsItem a ne plus gerer

Definition at line 60 of file qgimanager.cpp.

References qgi_manager, and scene.

Referenced by release(), ElementScene::reset(), and DeleteQGraphicsItemCommand::~DeleteQGraphicsItemCommand().

◆ release() [2/2]

void QGIManager::release ( const QList< QGraphicsItem *> &  qgis)

Indique au QGIManager que pour chaque QGI fourni, une reference vers celui-ci a ete detruite. S'il n'y a plus de references vers un QGI et que celui-ci n'est pas present sur la scene de ce QGIManager, alors il sera detruit.

Parameters
qgisQGraphicsItems a ne plus gerer

Definition at line 84 of file qgimanager.cpp.

References release().

◆ setDestroyQGIOnDelete()

void QGIManager::setDestroyQGIOnDelete ( bool  b)

Indique au QGIManager de detruire les QGraphicsItem restants lors de sa destruction si ceux-ci n'appartiennent pas a la scene

Definition at line 92 of file qgimanager.cpp.

References destroy_qgi_on_delete.

Member Data Documentation

◆ destroy_qgi_on_delete

bool QGIManager::destroy_qgi_on_delete
private

Definition at line 39 of file qgimanager.h.

Referenced by setDestroyQGIOnDelete(), and ~QGIManager().

◆ qgi_manager

QHash<QGraphicsItem *, int> QGIManager::qgi_manager
private

Definition at line 38 of file qgimanager.h.

Referenced by manage(), manages(), release(), and ~QGIManager().

◆ scene

QGraphicsScene* QGIManager::scene
private

Definition at line 37 of file qgimanager.h.

Referenced by release(), and ~QGIManager().


The documentation for this class was generated from the following files: