QElectroTech  0.70
Public Types | Public Member Functions | Public Attributes | List of all members
DiagramContent Class Reference

#include <diagramcontent.h>

Public Types

enum  Filter {
  Elements = 1, TextFields = 2, ElementTextFields = 4, Images = 8,
  ConductorsToMove = 16, ConductorsToUpdate = 32, OtherConductors = 64, AnyConductor = 112,
  Shapes = 128, TextGroup = 256, All = 511, SelectedOnly = 512
}
 Used to filter the different items carried by this container. More...
 

Public Member Functions

 DiagramContent ()
 DiagramContent::DiagramContent. More...
 
 DiagramContent (Diagram *diagram, bool selected=true)
 DiagramContent::DiagramContent Constructor. More...
 
 DiagramContent (const DiagramContent &)
 DiagramContent::DiagramContent Copy constructor. More...
 
 ~DiagramContent ()
 
QList< DiagramTextItem * > selectedTexts () const
 DiagramContent::selectedTexts. More...
 
QList< ElementTextItemGroup * > selectedTextsGroup () const
 DiagramContent::selectedTextsGroup. More...
 
QList< Conductor * > conductors (int=AnyConductor) const
 DiagramContent::conductors. More...
 
bool hasDeletableItems () const
 DiagramContent::hasDeletableItems. More...
 
bool hasCopiableItems () const
 DiagramContent::hasCopiableItems. More...
 
QList< QGraphicsItem * > items (int=All) const
 DiagramContent::items. More...
 
QString sentence (int=All) const
 DiagramContent::sentence. More...
 
int count (int=All) const
 DiagramContent::count. More...
 
void clear ()
 DiagramContent::clear Remove all items from the diagram content. More...
 
int removeNonMovableItems ()
 DiagramContent::removeNonMovableItems Remove all non movable item. More...
 
DiagramContentoperator+= (const DiagramContent &other)
 
bool potentialIsManaged (QList< Conductor *>conductors)
 DiagramContent::potentialIsManaged. More...
 
bool hasTextEditing ()
 DiagramContent::hasTextEditing. More...
 

Public Attributes

QList< Element * > m_elements
 
QSet< IndependentTextItem * > m_text_fields
 
QSet< DiagramImageItem * > m_images
 
QSet< QetShapeItem * > m_shapes
 
QList< Conductor * > m_conductors_to_update
 
QList< Conductor * > m_conductors_to_move
 
QList< Conductor * > m_other_conductors
 
QList< Conductor * > m_potential_conductors
 
QSet< DynamicElementTextItem * > m_element_texts
 
QSet< ElementTextItemGroup * > m_texts_groups
 
QList< QGraphicsItem * > m_selected_items
 

Detailed Description

This class provides a container that makes the transmission of diagram content to other functions/methods easier. The different kind of items are made available through a handful of filter-aware methods. Considering selected elements are to be moved, the filter notably distinguishes conductors to be moved from those to be updated. Please note this container does not systematically contains a whole diagram: it may describe only a part of it, e.g. selected items.

Definition at line 43 of file diagramcontent.h.

Member Enumeration Documentation

◆ Filter

Used to filter the different items carried by this container.

Enumerator
Elements 
TextFields 
ElementTextFields 
Images 
ConductorsToMove 
ConductorsToUpdate 
OtherConductors 
AnyConductor 
Shapes 
TextGroup 
All 
SelectedOnly 

Definition at line 52 of file diagramcontent.h.

Constructor & Destructor Documentation

◆ DiagramContent() [1/3]

DiagramContent::DiagramContent ( )

◆ DiagramContent() [2/3]

DiagramContent::DiagramContent ( Diagram diagram,
bool  selected = true 
)

DiagramContent::DiagramContent Constructor.

Parameters
diagram: Construct a diagramContent and fill it with the selected item of
selected: this diagramcontent get only selected items if true.

Definition at line 42 of file diagramcontent.cpp.

References m_conductors_to_move, m_conductors_to_update, m_element_texts, m_elements, m_images, m_other_conductors, m_potential_conductors, m_selected_items, m_shapes, m_text_fields, m_texts_groups, and potentialIsManaged().

◆ DiagramContent() [3/3]

DiagramContent::DiagramContent ( const DiagramContent other)

DiagramContent::DiagramContent Copy constructor.

Parameters
other

Definition at line 116 of file diagramcontent.cpp.

◆ ~DiagramContent()

DiagramContent::~DiagramContent ( )

Definition at line 130 of file diagramcontent.cpp.

Member Function Documentation

◆ clear()

void DiagramContent::clear ( )

◆ conductors()

QList< Conductor * > DiagramContent::conductors ( int  filter = AnyConductor) const

◆ count()

int DiagramContent::count ( int  filter = All) const

◆ hasCopiableItems()

bool DiagramContent::hasCopiableItems ( ) const

DiagramContent::hasCopiableItems.

Returns
true if this diagram content have copiable items.

Definition at line 222 of file diagramcontent.cpp.

References m_elements, m_images, m_shapes, and m_text_fields.

Referenced by QETDiagramEditor::slot_updateComplexActions().

◆ hasDeletableItems()

bool DiagramContent::hasDeletableItems ( ) const

DiagramContent::hasDeletableItems.

Returns
true if this diagram content have deletable item The deletable items correspond to the selected items of diagram at the moment of the creation of this DiagramContent, with the constructor : DiagramContent::DiagramContent(Diagram *diagram)

Definition at line 200 of file diagramcontent.cpp.

References m_selected_items, IndependentTextItem::Type, DiagramImageItem::Type, DynamicElementTextItem::Type, QetShapeItem::Type, Conductor::Type, and Element::Type.

Referenced by QETDiagramEditor::slot_updateComplexActions().

◆ hasTextEditing()

bool DiagramContent::hasTextEditing ( )

DiagramContent::hasTextEditing.

Returns
true if handle a text currently in editing intercation

Definition at line 362 of file diagramcontent.cpp.

References selectedTexts().

Referenced by DiagramView::keyPressEvent().

◆ items()

QList< QGraphicsItem * > DiagramContent::items ( int  filter = All) const

◆ operator+=()

DiagramContent & DiagramContent::operator+= ( const DiagramContent other)

◆ potentialIsManaged()

bool DiagramContent::potentialIsManaged ( QList< Conductor *>  conductors)

DiagramContent::potentialIsManaged.

Parameters
conductorsa list of conductors at the same potential.
Returns
true, if m_potential_conductors already have a conductor of this potential.

Definition at line 345 of file diagramcontent.cpp.

References conductors(), and m_potential_conductors.

Referenced by DiagramContent(), and operator+=().

◆ removeNonMovableItems()

int DiagramContent::removeNonMovableItems ( )

DiagramContent::removeNonMovableItems Remove all non movable item.

Returns
: return the numbers of removed item

Definition at line 255 of file diagramcontent.cpp.

References m_elements, m_images, and m_shapes.

Referenced by ElementsMover::beginMovement().

◆ selectedTexts()

QList< DiagramTextItem * > DiagramContent::selectedTexts ( ) const

DiagramContent::selectedTexts.

Returns
a list of every selected texts (every kind of texts) Note that the returned list of texts, correspond to the selected texts at the moment of the creation of this DiagramContent, with the constructor : DiagramContent::DiagramContent(Diagram *diagram)

Definition at line 140 of file diagramcontent.cpp.

References m_selected_items, IndependentTextItem::Type, ConductorTextItem::Type, and DynamicElementTextItem::Type.

Referenced by hasTextEditing(), DiagramView::keyPressEvent(), RotateTextsCommand::RotateTextsCommand(), and QETDiagramEditor::slot_updateComplexActions().

◆ selectedTextsGroup()

QList< ElementTextItemGroup * > DiagramContent::selectedTextsGroup ( ) const

DiagramContent::selectedTextsGroup.

Returns
a list of selected texts group Note that the returned list of texts group, correspond to the selected texts group at the moment of the creation of this DiagramContent, with the constructor : DiagramContent::DiagramContent(Diagram *diagram)

Definition at line 160 of file diagramcontent.cpp.

References m_selected_items.

Referenced by RotateTextsCommand::RotateTextsCommand(), and QETDiagramEditor::slot_updateComplexActions().

◆ sentence()

QString DiagramContent::sentence ( int  filter = All) const

Member Data Documentation

◆ m_conductors_to_move

QList<Conductor *> DiagramContent::m_conductors_to_move

◆ m_conductors_to_update

QList<Conductor *> DiagramContent::m_conductors_to_update

◆ m_element_texts

QSet<DynamicElementTextItem *> DiagramContent::m_element_texts

◆ m_elements

QList<Element *> DiagramContent::m_elements

◆ m_images

QSet<DiagramImageItem *> DiagramContent::m_images

◆ m_other_conductors

QList<Conductor *> DiagramContent::m_other_conductors

Definition at line 73 of file diagramcontent.h.

Referenced by clear(), conductors(), count(), DiagramContent(), and operator+=().

◆ m_potential_conductors

QList<Conductor *> DiagramContent::m_potential_conductors

◆ m_selected_items

QList<QGraphicsItem *> DiagramContent::m_selected_items

◆ m_shapes

QSet<QetShapeItem *> DiagramContent::m_shapes

◆ m_text_fields

QSet<IndependentTextItem *> DiagramContent::m_text_fields

◆ m_texts_groups

QSet<ElementTextItemGroup *> DiagramContent::m_texts_groups

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