QElectroTech  0.70
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
Diagram Class Reference

#include <diagram.h>

Public Types

enum  BorderOptions { EmptyBorder, TitleBlock, Columns }
 
enum  NumerotationType { Conductors }
 Represents available option of Numerotation type. More...
 

Public Slots

void adjustSceneRect ()
 Diagram::adjustSceneRect Recalcul and adjust the size of the scene. More...
 
void titleChanged (const QString &)
 
void titleBlockTemplateChanged (const QString &)
 
void titleBlockTemplateRemoved (const QString &, const QString &=QString())
 
void setTitleBlockTemplate (const QString &)
 
void updateLabels ()
 Diagram::updateLabels Update elements and conductors that reference folio field in their labels. More...
 
void loadElmtFolioSeq ()
 Diagram::loadElmtFolioSeq This class loads all folio sequential variables related to the current autonum. More...
 
void loadCndFolioSeq ()
 Diagram::loadCndFolioSeq This class loads all conductor folio sequential variables related to the current autonum. More...
 
void selectAll ()
 
void deselectAll ()
 
void invertSelection ()
 

Signals

void showDiagram (Diagram *)
 
void usedTitleBlockTemplateChanged (const QString &)
 
void diagramTitleChanged (Diagram *, const QString &)
 
void findElementRequired (const ElementsLocation &)
 
void editElementRequired (const ElementsLocation &)
 Signal emitted when users wish to locate an element from the diagram within elements collection. More...
 
void diagramActivated ()
 Signal emitted when users wish to edit an element from the diagram. More...
 

Public Member Functions

 Diagram (QETProject *project)
 Diagram::Diagram Constructor. More...
 
 ~Diagram () override
 Diagram::~Diagram Destructor. More...
 
void setEventInterface (DiagramEventInterface *event_interface)
 Diagram::setEventInterface Set event_interface has current interface. Diagram become the ownership of event_interface If there is a previous interface, they will be delete before and call init() to the new interface. More...
 
void clearEventInterface ()
 Diagram::clearEventInterface Clear the current event interface. More...
 
QString conductorsAutonumName () const
 Diagram::conductorsAutonumName. More...
 
void setConductorsAutonumName (const QString &name)
 Diagram::setConductorsAutonumName. More...
 
QETProjectproject () const
 
void setProject (QETProject *)
 Diagram::setProject Set parent project of this diagram, project also become the parent QObject of this diagram. More...
 
int folioIndex () const
 
qreal declaredQElectroTechVersion (bool=true) const
 
void showMe ()
 
bool isReadOnly () const
 Diagram::isReadOnly. More...
 
void setConductor (bool)
 
void setConductorStart (QPointF)
 
void setConductorStop (QPointF)
 
QList< QSet< Conductor * > > potentials ()
 Diagram::potential. More...
 
QDomDocument toXml (bool=true)
 
bool initFromXml (QDomElement &, QPointF=QPointF(), bool=true, DiagramContent *=nullptr)
 
bool fromXml (QDomDocument &, QPointF=QPointF(), bool=true, DiagramContent *=nullptr)
 
bool fromXml (QDomElement &, QPointF=QPointF(), bool=true, DiagramContent *=nullptr)
 
void folioSequentialsToXml (QHash< QString, QStringList > *, QDomElement *, const QString &, const QString &, QDomDocument *)
 Diagram::folioSequentialsToXml. More...
 
void folioSequentialsFromXml (const QDomElement &, QHash< QString, QStringList > *, const QString &, const QString &, const QString &, const QString &)
 Diagram::folioSequentialsFromXml Load folio sequential from QDomElement. More...
 
void refreshContents ()
 Diagram::refreshContents refresh all content of diagram. More...
 
virtual void addItem (QGraphicsItem *item)
 Diagram::addItem Réimplemented from QGraphicsScene::addItem(QGraphicsItem *item) Do some specific operation if item need it (for exemple an element) More...
 
virtual void removeItem (QGraphicsItem *item)
 Diagram::removeItem Réimplemented from QGraphicsScene::removeItem(QGraphicsItem *item) Do some specific operation if item need it (for exemple an element) More...
 
ExportProperties applyProperties (const ExportProperties &)
 
void setDisplayGrid (bool)
 
bool displayGrid ()
 
void setUseBorder (bool)
 
bool useBorder ()
 
void setBorderOptions (BorderOptions)
 
BorderOptions borderOptions ()
 
DiagramPosition convertPosition (const QPointF &)
 
bool drawTerminals () const
 
void setDrawTerminals (bool)
 
bool drawColoredConductors () const
 
void setDrawColoredConductors (bool)
 
QString title () const
 
bool toPaintDevice (QPaintDevice &, int=-1, int=-1, Qt::AspectRatioMode=Qt::KeepAspectRatio)
 
QSize imageSize () const
 
bool isEmpty () const
 
QList< Element * > elements () const
 
QList< Conductor * > conductors () const
 Diagram::conductors Return the list containing all conductors. More...
 
QSet< Conductor * > selectedConductors () const
 
DiagramContent content () const
 
bool canRotateSelection () const
 Diagram::canRotateSelection. More...
 
ElementsMoverelementsMover ()
 
ElementTextsMoverelementTextsMover ()
 
bool usesElement (const ElementsLocation &)
 
bool usesTitleBlockTemplate (const QString &)
 
QUndoStack & undoStack ()
 
QGIManagerqgiManager ()
 
void freezeElements (bool freeze)
 Diagram::freezeElements Freeze every existent element label. More...
 
void unfreezeElements ()
 Diagram::unfreezeElements Unfreeze every existent element label. More...
 
void setFreezeNewElements (bool)
 Diagram::freezeNewElements Set new element label to be frozen. More...
 
bool freezeNewElements ()
 Diagram::freezeNewElements. More...
 
void freezeConductors (bool freeze)
 Diagram::freezeConductors Freeze every existent conductor label. More...
 
void setFreezeNewConductors (bool)
 Diagram::setfreezeNewConductors Set new conductor label to be frozen. More...
 
bool freezeNewConductors ()
 Diagram::freezeNewConductors. More...
 
void insertFolioSeqHash (QHash< QString, QStringList > *hash, const QString &title, const QString &seq, NumerotationContext *nc)
 Diagram::insertFolioSeqHash This class inserts a stringlist containing all sequential variables related to an autonum in a QHash. More...
 
void loadFolioSeqHash (QHash< QString, QStringList > *hash, const QString &title, const QString &seq, NumerotationContext *nc)
 Diagram::loadFolioSeqHash This class loads all folio sequential variables related to the current autonum. More...
 
void changeZValue (QET::DepthOption option)
 Diagram::changeZValue Change the Z value of the current selected item, according to . More...
 

Static Public Member Functions

static bool clipboardMayContainDiagram ()
 
static QPointF snapToGrid (const QPointF &p)
 Diagram::snapToGrid Return a nearest snap point of p. More...
 

Public Attributes

ConductorProperties defaultConductorProperties
 Default properties for new conductors. More...
 
BorderTitleBlock border_and_titleblock
 Diagram dimensions and title block. More...
 
QHash< QString, QStringList > m_elmt_unitfolio_max
 Hash containing max values for folio sequential autonums in this diagram. More...
 
QHash< QString, QStringList > m_elmt_tenfolio_max
 
QHash< QString, QStringList > m_elmt_hundredfolio_max
 
QHash< QString, QStringList > m_cnd_unitfolio_max
 Hash containing max values for folio sequential autonums in this diagram. More...
 
QHash< QString, QStringList > m_cnd_tenfolio_max
 
QHash< QString, QStringList > m_cnd_hundredfolio_max
 

Static Public Attributes

static int xGrid = 10
 abscissa grid step size More...
 
static int yGrid = 10
 ordinate grid step size More...
 
static int xKeyGrid = 10
 Key grid x step size. More...
 
static int yKeyGrid = 10
 Key grid y step size. More...
 
static int xKeyGridFine = 1
 Key grid fine x step size. More...
 
static int yKeyGridFine = 1
 Key grid fine y step size. More...
 
static const qreal margin = 5.0
 margin around the diagram More...
 
static QColor background_color = Qt::white
 background color of diagram More...
 

Protected Member Functions

void drawBackground (QPainter *, const QRectF &) override
 
void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override
 Diagram::mouseDoubleClickEvent This event is managed by diagram event interface if any. More...
 
void mousePressEvent (QGraphicsSceneMouseEvent *event) override
 Diagram::mousePressEvent This event is managed by diagram event interface if any. More...
 
void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override
 Diagram::mouseMoveEvent This event is managed by diagram event interface if any. More...
 
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override
 Diagram::mouseReleaseEvent This event is managed by diagram event interface if any. More...
 
void wheelEvent (QGraphicsSceneWheelEvent *event) override
 Diagram::wheelEvent This event is managed by diagram event interface if any. More...
 
void keyPressEvent (QKeyEvent *event) override
 Diagram::keyPressEvent This event is managed by diagram event interface if any. Else move selected elements. More...
 
void keyReleaseEvent (QKeyEvent *) override
 Diagram::keyReleaseEvent This event is managed by diagram event interface if any. Else move selected element. More...
 

Private Member Functions

 Diagram (const Diagram &diagram)
 

Private Attributes

QGraphicsLineItem * conductor_setter_
 
ElementsMover m_elements_mover
 
ElementTextsMover m_element_texts_mover
 
QGIManagerqgi_manager_
 
QETProjectm_project
 
QDomDocument xml_document_
 
qreal diagram_qet_version_
 
bool draw_grid_
 
bool use_border_
 
bool draw_terminals_
 
bool draw_colored_conductors_
 
QString m_conductors_autonum_name
 
DiagramEventInterfacem_event_interface
 
bool m_freeze_new_elements
 
bool m_freeze_new_conductors_
 

Detailed Description

This class represents an electric diagram. It manages its various child elements, conductors and texts and handles their graphic rendering.

Definition at line 49 of file diagram.h.

Member Enumeration Documentation

◆ BorderOptions

Represents available options when rendering a particular diagram: EmptyBorder: display border only TitleBlock: display title block Columns: display columns

Enumerator
EmptyBorder 
TitleBlock 
Columns 

Definition at line 68 of file diagram.h.

◆ NumerotationType

Represents available option of Numerotation type.

Enumerator
Conductors 

Definition at line 70 of file diagram.h.

Constructor & Destructor Documentation

◆ Diagram() [1/2]

Diagram::Diagram ( QETProject project)

◆ ~Diagram()

Diagram::~Diagram ( )
override

Diagram::~Diagram Destructor.

Definition at line 100 of file diagram.cpp.

References conductor_setter_, m_event_interface, qgi_manager_, and undoStack().

◆ Diagram() [2/2]

Diagram::Diagram ( const Diagram diagram)
private

Member Function Documentation

◆ addItem()

void Diagram::addItem ( QGraphicsItem *  item)
virtual

Diagram::addItem Réimplemented from QGraphicsScene::addItem(QGraphicsItem *item) Do some specific operation if item need it (for exemple an element)

Parameters
item

Definition at line 1108 of file diagram.cpp.

References Terminal::addConductor(), Conductor::calculateTextItemPosition(), isReadOnly(), Conductor::terminal1, Conductor::terminal2, and Conductor::Type.

Referenced by fromXml(), DiagramEventAddImage::mouseMoveEvent(), DiagramEventAddShape::mousePressEvent(), PasteDiagramCommand::redo(), DeleteQGraphicsItemCommand::undo(), and DiagramEventAddShape::updateHelpCross().

◆ adjustSceneRect

void Diagram::adjustSceneRect ( )
slot

◆ applyProperties()

ExportProperties Diagram::applyProperties ( const ExportProperties new_properties)

◆ borderOptions()

Diagram::BorderOptions Diagram::borderOptions ( )
inline
Returns
The rendering optios for the diagram border
See also
setBorderOptions

Definition at line 329 of file diagram.h.

References border_and_titleblock, Columns, BorderTitleBlock::columnsAreDisplayed(), EmptyBorder, TitleBlock, and BorderTitleBlock::titleBlockIsDisplayed().

◆ canRotateSelection()

bool Diagram::canRotateSelection ( ) const

Diagram::canRotateSelection.

Returns
True if a least one of selected items can be rotated

Definition at line 1791 of file diagram.cpp.

References IndependentTextItem::Type, ConductorTextItem::Type, DiagramImageItem::Type, DynamicElementTextItem::Type, and Element::Type.

Referenced by QETDiagramEditor::slot_updateComplexActions().

◆ changeZValue()

void Diagram::changeZValue ( QET::DepthOption  option)

◆ clearEventInterface()

void Diagram::clearEventInterface ( )

Diagram::clearEventInterface Clear the current event interface.

Definition at line 475 of file diagram.cpp.

References m_event_interface.

◆ clipboardMayContainDiagram()

bool Diagram::clipboardMayContainDiagram ( )
static
Returns
true si le presse-papier semble contenir un schema

Definition at line 1706 of file diagram.cpp.

Referenced by DiagramView::contextMenuEvent(), and QETDiagramEditor::slot_updatePasteAction().

◆ conductors()

QList< Conductor * > Diagram::conductors ( ) const

Diagram::conductors Return the list containing all conductors.

Definition at line 1490 of file diagram.cpp.

Referenced by freezeConductors(), potentials(), refreshContents(), toXml(), and updateLabels().

◆ conductorsAutonumName()

QString Diagram::conductorsAutonumName ( ) const

◆ content()

DiagramContent Diagram::content ( ) const
Returns
Le contenu du schema. Les conducteurs sont tous places dans conductorsToMove.

Definition at line 1773 of file diagram.cpp.

References DiagramContent::m_conductors_to_move, DiagramContent::m_elements, and DiagramContent::m_text_fields.

Referenced by potentials(), and updateLabels().

◆ convertPosition()

DiagramPosition Diagram::convertPosition ( const QPointF &  pos)
Parameters
posPosition cartesienne (ex : 10.3, 45.2) a transformer en position dans la grille (ex : B2)
Returns
la position dans la grille correspondant a pos

Definition at line 1637 of file diagram.cpp.

References border_and_titleblock, BorderTitleBlock::convertPosition(), and DiagramPosition::setPosition().

Referenced by autonum::AssignVariables::AssignVariables(), and comparPos().

◆ declaredQElectroTechVersion()

qreal Diagram::declaredQElectroTechVersion ( bool  fallback_to_project = true) const
Parameters
fallback_to_projectWhen a diagram does not have a declared version, this method will use the one declared by its parent project only if fallback_to_project is true.
Returns
the declared QElectroTech version of this diagram

Definition at line 1749 of file diagram.cpp.

References diagram_qet_version_, and m_project.

Referenced by fromXml().

◆ deselectAll

void Diagram::deselectAll ( )
slot

Deslectionne tous les objets selectionnes

Definition at line 1222 of file diagram.cpp.

References isEmpty().

◆ diagramActivated

void Diagram::diagramActivated ( )
signal

Signal emitted when users wish to edit an element from the diagram.

Referenced by Diagram().

◆ diagramTitleChanged

void Diagram::diagramTitleChanged ( Diagram ,
const QString &   
)
signal

◆ displayGrid()

bool Diagram::displayGrid ( )
inline
Returns
true if the grid is drawn, false otherwise.

Definition at line 290 of file diagram.h.

References draw_grid_.

Referenced by applyProperties().

◆ drawBackground()

void Diagram::drawBackground ( QPainter *  p,
const QRectF &  r 
)
overrideprotected

Dessine l'arriere-plan du schema, cad la grille.

Parameters
pLe QPainter a utiliser pour dessiner
rLe rectangle de la zone a dessiner

Definition at line 131 of file diagram.cpp.

References background_color, border_and_titleblock, BorderTitleBlock::draw(), draw_grid_, BorderTitleBlock::insideBorderRect(), use_border_, xGrid, and yGrid.

◆ drawColoredConductors()

bool Diagram::drawColoredConductors ( ) const
inline
Returns
true if conductors colors are rendered, false otherwise.

Definition at line 352 of file diagram.h.

References draw_colored_conductors_.

Referenced by applyProperties().

◆ drawTerminals()

bool Diagram::drawTerminals ( ) const
inline
Returns
true if terminals are rendered, false otherwise

Definition at line 347 of file diagram.h.

References draw_terminals_.

Referenced by applyProperties().

◆ editElementRequired

void Diagram::editElementRequired ( const ElementsLocation )
signal

Signal emitted when users wish to locate an element from the diagram within elements collection.

Referenced by ElementPropertiesWidget::editElement().

◆ elements()

QList< Element * > Diagram::elements ( ) const

◆ elementsMover()

ElementsMover & Diagram::elementsMover ( )

◆ elementTextsMover()

ElementTextsMover & Diagram::elementTextsMover ( )

◆ findElementRequired

void Diagram::findElementRequired ( const ElementsLocation )
signal

◆ folioIndex()

int Diagram::folioIndex ( ) const
Returns
the folio number of this diagram within its parent project, or -1 if it is has no parent project

Definition at line 1738 of file diagram.cpp.

References m_project.

Referenced by autonum::AssignVariables::AssignVariables(), comparPos(), DiagramFolioList::drawBackground(), AutoNumberingManagementW::on_m_apply_folios_rb_clicked(), and ProjectView::updateTabTitle().

◆ folioSequentialsFromXml()

void Diagram::folioSequentialsFromXml ( const QDomElement &  root,
QHash< QString, QStringList > *  hash,
const QString &  folioSeq,
const QString &  seq,
const QString &  type,
const QString &  autonumFolioSeqType 
)

Diagram::folioSequentialsFromXml Load folio sequential from QDomElement.

Parameters
rootcontaining all folio sequentials
hashto be loaded with content
folioSeqtype
seqtype
typeof sequential

Definition at line 1067 of file diagram.cpp.

References QET::findInDomElement(), and title().

Referenced by fromXml().

◆ folioSequentialsToXml()

void Diagram::folioSequentialsToXml ( QHash< QString, QStringList > *  hash,
QDomElement *  domElement,
const QString &  seq_type,
const QString &  type,
QDomDocument *  doc 
)

Diagram::folioSequentialsToXml.

  • *+ * Add folio sequential to QDomElement
  • *
    Parameters
    domElementto add attributes
  • *
    Parameters
    hashto retrieve content with content
  • *
    Parameters
    sequentialtype

Definition at line 779 of file diagram.cpp.

Referenced by toXml().

◆ freezeConductors()

void Diagram::freezeConductors ( bool  freeze)

Diagram::freezeConductors Freeze every existent conductor label.

Definition at line 1571 of file diagram.cpp.

References conductors(), and Conductor::setFreezeLabel().

◆ freezeElements()

void Diagram::freezeElements ( bool  freeze)

Diagram::freezeElements Freeze every existent element label.

Definition at line 1535 of file diagram.cpp.

References elements(), and Element::freezeLabel().

◆ freezeNewConductors()

bool Diagram::freezeNewConductors ( )

Diagram::freezeNewConductors.

Returns
current freeze new conductor status .

Definition at line 1589 of file diagram.cpp.

References m_freeze_new_conductors_.

Referenced by DiagramEventAddElement::addElement(), and MultiPasteDialog::on_m_button_box_accepted().

◆ freezeNewElements()

bool Diagram::freezeNewElements ( )

Diagram::freezeNewElements.

Returns
current freeze new element status .

Definition at line 1563 of file diagram.cpp.

References m_freeze_new_elements.

◆ fromXml() [1/2]

bool Diagram::fromXml ( QDomDocument &  document,
QPointF  position = QPointF(),
bool  consider_informations = true,
DiagramContent content_ptr = nullptr 
)

Importe le schema decrit dans un document XML. Si une position est precisee, les elements importes sont positionnes de maniere a ce que le coin superieur gauche du plus petit rectangle pouvant les entourant tous (le bounding rect) soit a cette position.

Parameters
documentLe document XML a analyser
positionLa position du schema importe
consider_informationsSi vrai, les informations complementaires (auteur, titre, ...) seront prises en compte
content_ptrsi ce pointeur vers un DiagramContent est different de 0, il sera rempli avec le contenu ajoute au schema par le fromXml
Returns
true si l'import a reussi, false sinon

Definition at line 804 of file diagram.cpp.

Referenced by fromXml(), initFromXml(), DiagramView::paste(), and MultiPasteDialog::updatePreview().

◆ fromXml() [2/2]

bool Diagram::fromXml ( QDomElement &  document,
QPointF  position = QPointF(),
bool  consider_informations = true,
DiagramContent content_ptr = nullptr 
)

Importe le schema decrit dans un element XML. Si une position est precisee, les elements importes sont positionnes de maniere a ce que le coin superieur gauche du plus petit rectangle pouvant les entourant tous (le bounding rect) soit a cette position.

Parameters
documentLe document XML a analyser
positionLa position du schema importe
consider_informationsSi vrai, les informations complementaires (auteur, titre, ...) seront prises en compte
content_ptrsi ce pointeur vers un DiagramContent est different de 0, il sera rempli avec le contenu ajoute au schema par le fromXml
Returns
true si l'import a reussi, false sinon

Definition at line 844 of file diagram.cpp.

References addItem(), adjustSceneRect(), border_and_titleblock, BorderTitleBlock::borderFromXml(), QET::Icons::Conductor, declaredQElectroTechVersion(), defaultConductorProperties, diagram_qet_version_, QET::findInDomElement(), folioSequentialsFromXml(), ConductorProperties::fromXml(), Element::fromXml(), fromXml(), ElementCollectionHandler::importFromProject(), ElementFactory::Instance(), Conductor::isValid(), m_cnd_hundredfolio_max, m_cnd_tenfolio_max, m_cnd_unitfolio_max, m_conductors_autonum_name, m_elmt_hundredfolio_max, m_elmt_tenfolio_max, m_elmt_unitfolio_max, m_freeze_new_conductors_, m_freeze_new_elements, m_project, ElementsLocation::path(), QETApp::project(), QETProject::ProjectParsingRunning, removeItem(), snapToGrid(), BorderTitleBlock::titleBlockFromXml(), Conductor::valideXml(), and Element::valideXml().

◆ imageSize()

QSize Diagram::imageSize ( ) const

Permet de connaitre les dimensions qu'aura l'image generee par la methode toImage()

Returns
La taille de l'image generee par toImage()

Definition at line 551 of file diagram.cpp.

References border_and_titleblock, BorderTitleBlock::borderAndTitleBlockRect(), margin, and use_border_.

◆ initFromXml()

bool Diagram::initFromXml ( QDomElement &  document,
QPointF  position = QPointF(),
bool  consider_informations = true,
DiagramContent content_ptr = nullptr 
)

Importe le schema decrit dans un element XML. Cette methode delegue son travail a Diagram::fromXml Si l'import reussit, cette methode initialise egalement le document XML interne permettant de bien gerer l'enregistrement de ce schema dans le projet auquel il appartient.

See also
Diagram::fromXml
Parameters
documentLe document XML a analyser
positionLa position du schema importe
consider_informationsSi vrai, les informations complementaires (auteur, titre, ...) seront prises en compte
content_ptrsi ce pointeur vers un DiagramContent est different de 0, il sera rempli avec le contenu ajoute au schema par le fromXml
Returns
true si l'import a reussi, false sinon

Definition at line 824 of file diagram.cpp.

References fromXml().

◆ insertFolioSeqHash()

void Diagram::insertFolioSeqHash ( QHash< QString, QStringList > *  hash,
const QString &  title,
const QString &  type,
NumerotationContext nc 
)

Diagram::insertFolioSeqHash This class inserts a stringlist containing all sequential variables related to an autonum in a QHash.

Parameters
Hashto be accessed
autonumtitle
sequentialto be treated
typeto be treated
NumerotationContext to be manipulated

Definition at line 1263 of file diagram.cpp.

References NumerotationContext::itemAt(), NumerotationContext::replaceValue(), NumerotationContext::size(), and title().

Referenced by loadCndFolioSeq(), and loadElmtFolioSeq().

◆ invertSelection

void Diagram::invertSelection ( )
slot

Inverse l'etat de selection de tous les objets du schema

Definition at line 1231 of file diagram.cpp.

References isEmpty().

◆ isEmpty()

bool Diagram::isEmpty ( ) const
Returns
true si le schema est considere comme vide, false sinon. Un schema vide ne contient ni element, ni conducteur, ni champ de texte

Definition at line 574 of file diagram.cpp.

Referenced by DiagramView::contextMenuActions(), DiagramView::contextMenuEvent(), deselectAll(), invertSelection(), DiagramEventAddImage::openDialog(), selectAll(), and toXml().

◆ isReadOnly()

bool Diagram::isReadOnly ( ) const

◆ keyPressEvent()

void Diagram::keyPressEvent ( QKeyEvent *  event)
overrideprotected

◆ keyReleaseEvent()

void Diagram::keyReleaseEvent ( QKeyEvent *  e)
overrideprotected

Diagram::keyReleaseEvent This event is managed by diagram event interface if any. Else move selected element.

Parameters
e

Definition at line 418 of file diagram.cpp.

References ElementsMover::endMovement(), isReadOnly(), DiagramEventInterface::keyReleaseEvent(), m_elements_mover, and m_event_interface.

◆ loadCndFolioSeq

void Diagram::loadCndFolioSeq ( )
slot

◆ loadElmtFolioSeq

void Diagram::loadElmtFolioSeq ( )
slot

◆ loadFolioSeqHash()

void Diagram::loadFolioSeqHash ( QHash< QString, QStringList > *  hash,
const QString &  title,
const QString &  type,
NumerotationContext nc 
)

Diagram::loadFolioSeqHash This class loads all folio sequential variables related to the current autonum.

Parameters
Hashto be accessed
autonumtitle
sequentialto be treated
typeto be treated
NumerotationContext to be manipulated

Definition at line 1284 of file diagram.cpp.

References NumerotationContext::itemAt(), NumerotationContext::replaceValue(), NumerotationContext::size(), and title().

Referenced by loadCndFolioSeq(), and loadElmtFolioSeq().

◆ mouseDoubleClickEvent()

void Diagram::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected

Diagram::mouseDoubleClickEvent This event is managed by diagram event interface if any.

Parameters
event:

Definition at line 189 of file diagram.cpp.

References m_event_interface, and DiagramEventInterface::mouseDoubleClickEvent().

◆ mouseMoveEvent()

void Diagram::mouseMoveEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected

Diagram::mouseMoveEvent This event is managed by diagram event interface if any.

Parameters
event

Definition at line 227 of file diagram.cpp.

References m_event_interface, and DiagramEventInterface::mouseMoveEvent().

◆ mousePressEvent()

void Diagram::mousePressEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected

Diagram::mousePressEvent This event is managed by diagram event interface if any.

Parameters
event

Definition at line 208 of file diagram.cpp.

References m_event_interface, and DiagramEventInterface::mousePressEvent().

◆ mouseReleaseEvent()

void Diagram::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected

Diagram::mouseReleaseEvent This event is managed by diagram event interface if any.

Parameters
event

Definition at line 246 of file diagram.cpp.

References m_event_interface, and DiagramEventInterface::mouseReleaseEvent().

◆ potentials()

QList< QSet< Conductor * > > Diagram::potentials ( )

Diagram::potential.

Returns
all potential in the diagram each potential are in the QList and each conductors of one potential are in the QSet

Definition at line 583 of file diagram.cpp.

References DiagramContent::conductors(), conductors(), and content().

◆ project()

QETProject * Diagram::project ( ) const
Returns
le projet auquel ce schema appartient ou 0 s'il s'agit d'un schema independant.

Definition at line 1716 of file diagram.cpp.

References m_project.

Referenced by MasterElement::aboutDeleteXref(), DiagramEventAddElement::addElement(), autonum::AssignVariables::assignProjectVar(), ElementTextItemGroup::autoPos(), DiagramEventAddElement::buildElement(), Diagram(), DiagramFolioList::DiagramFolioList(), DiagramPropertiesDialog::DiagramPropertiesDialog(), DiagramFolioList::drawBackground(), DiagramPropertiesDialog::editAutoFolioNum(), DiagramPropertiesDialog::editAutonum(), CrossRefItem::elementPositionText(), DiagramView::handleTitleBlockDrop(), CrossRefItem::init(), MasterElement::linkToElement(), loadCndFolioSeq(), loadElmtFolioSeq(), ConductorAutoNumerotation::newProperties(), ConductorAutoNumerotation::numerateNewConductor(), MultiPasteDialog::on_m_button_box_accepted(), refreshContents(), DynamicElementTextItem::removeConnectionForReportFormula(), DynamicElementTextItem::reportChanged(), DynamicElementTextItem::reportFormulaChanged(), DynamicElementTextItem::setConnectionForReportFormula(), MasterPropertiesWidget::setElement(), ElementTextItemGroup::setHoldToBottomPage(), setProject(), CrossRefItem::setUpConnection(), Conductor::setUpConnectionForFormula(), Element::setUpFormula(), DynamicElementTextItem::setupFormulaConnection(), undoStack(), CrossRefItem::updateProperties(), ElementTextItemGroup::updateXref(), DynamicElementTextItem::updateXref(), MasterElement::xrefPropertiesChanged(), and DiagramFolioList::~DiagramFolioList().

◆ qgiManager()

QGIManager & Diagram::qgiManager ( )
inline
Returns
the diagram graphics item manager

Definition at line 342 of file diagram.h.

References qgi_manager_.

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

◆ refreshContents()

void Diagram::refreshContents ( )

Diagram::refreshContents refresh all content of diagram.

  • refresh conductor text.
  • linking the elements waiting to be linked
  • Refresh the connection of the dynamic element text item (use for text with source of text label)

Definition at line 1089 of file diagram.cpp.

References conductors(), elements(), and project().

◆ removeItem()

void Diagram::removeItem ( QGraphicsItem *  item)
virtual

◆ selectAll

void Diagram::selectAll ( )
slot

Selectionne tous les objets du schema

Definition at line 1210 of file diagram.cpp.

References isEmpty().

◆ selectedConductors()

QSet< Conductor * > Diagram::selectedConductors ( ) const
Returns
la liste des conducteurs selectionnes sur le schema

Definition at line 1695 of file diagram.cpp.

Referenced by QETDiagramEditor::slot_updateComplexActions().

◆ setBorderOptions()

void Diagram::setBorderOptions ( Diagram::BorderOptions  bo)
inline

Set the rendering options for the diagram border (including rows/colums headers and the title block)

Parameters
boEnabled options ORed together
See also
BorderOptions

Definition at line 319 of file diagram.h.

References border_and_titleblock, Columns, BorderTitleBlock::displayBorder(), BorderTitleBlock::displayColumns(), BorderTitleBlock::displayTitleBlock(), EmptyBorder, and TitleBlock.

◆ setConductor()

void Diagram::setConductor ( bool  adding)
inline

Display or hide the conductor setter, i.e. a dashed conductor stub which appears when creating a conductor between two terminals.

Parameters
pftrue pour ajouter le poseur de conducteur, false pour l'enlever

Definition at line 253 of file diagram.h.

◆ setConductorsAutonumName()

void Diagram::setConductorsAutonumName ( const QString &  name)

◆ setConductorStart()

void Diagram::setConductorStart ( QPointF  start)
inline

Set the start point of the conductor setter.

Parameters
startthe point (in scene coordinates) which the newly created conductor should start from.

Definition at line 266 of file diagram.h.

References conductor_setter_.

◆ setConductorStop()

void Diagram::setConductorStop ( QPointF  end)
inline

Set the end point of the conductor setter.

Parameters
endthe point (in scene coordinates) upon to which the newly created conductor should be drawn.

Definition at line 275 of file diagram.h.

References conductor_setter_.

◆ setDisplayGrid()

void Diagram::setDisplayGrid ( bool  dg)
inline

Set whether the diagram grid should be drawn.

Parameters
dgtrue to render the grid, false otherwise.

Definition at line 283 of file diagram.h.

References draw_grid_.

Referenced by DiagramView::adjustGridToZoom(), applyProperties(), and QETDiagramEditor::setUpActions().

◆ setDrawColoredConductors()

void Diagram::setDrawColoredConductors ( bool  dcc)

Definit s'il faut respecter ou non les couleurs des conducteurs. Si non, les conducteurs sont tous dessines en noir.

Parameters
dcctrue pour respecter les couleurs, false sinon

Definition at line 1688 of file diagram.cpp.

References draw_colored_conductors_.

Referenced by applyProperties().

◆ setDrawTerminals()

void Diagram::setDrawTerminals ( bool  dt)

Definit s'il faut afficher ou non les bornes

Parameters
dttrue pour afficher les bornes, false sinon

Definition at line 1675 of file diagram.cpp.

Referenced by applyProperties().

◆ setEventInterface()

void Diagram::setEventInterface ( DiagramEventInterface event_interface)

Diagram::setEventInterface Set event_interface has current interface. Diagram become the ownership of event_interface If there is a previous interface, they will be delete before and call init() to the new interface.

Parameters
event_interface

Definition at line 455 of file diagram.cpp.

References DiagramEventInterface::finish(), and m_event_interface.

Referenced by QETDiagramEditor::addItemGroupTriggered(), and DiagramView::handleElementDrop().

◆ setFreezeNewConductors()

void Diagram::setFreezeNewConductors ( bool  b)

Diagram::setfreezeNewConductors Set new conductor label to be frozen.

Definition at line 1581 of file diagram.cpp.

References m_freeze_new_conductors_.

◆ setFreezeNewElements()

void Diagram::setFreezeNewElements ( bool  b)

Diagram::freezeNewElements Set new element label to be frozen.

Definition at line 1555 of file diagram.cpp.

References m_freeze_new_elements.

◆ setProject()

void Diagram::setProject ( QETProject project)

Diagram::setProject Set parent project of this diagram, project also become the parent QObject of this diagram.

Parameters
projectnew project

Definition at line 1725 of file diagram.cpp.

References m_project, and project().

Referenced by Diagram().

◆ setTitleBlockTemplate

void Diagram::setTitleBlockTemplate ( const QString &  template_name)
slot

Set the template to use to render the title block of this diagram.

Parameters
template_nameName of the title block template.

Definition at line 1195 of file diagram.cpp.

References border_and_titleblock, QETProject::embeddedTitleBlockTemplatesCollection(), TitleBlockTemplatesProjectCollection::getTemplate(), m_project, BorderTitleBlock::titleBlockTemplateName(), BorderTitleBlock::titleBlockTemplateRemoved(), and usedTitleBlockTemplateChanged().

Referenced by Diagram().

◆ setUseBorder()

void Diagram::setUseBorder ( bool  ub)
inline

Set whether the diagram border (including rows/colums headers and the title block) should be rendered along with the diagram. When set to false, the size of the smallest rectangle containing all items is considered as the diagram size.

Parameters
ubtrue to take the border into account, false otherwise

Definition at line 301 of file diagram.h.

References use_border_.

Referenced by applyProperties().

◆ showDiagram

void Diagram::showDiagram ( Diagram )
signal

Referenced by showMe().

◆ showMe()

void Diagram::showMe ( )
inline

◆ snapToGrid()

QPointF Diagram::snapToGrid ( const QPointF &  p)
static

◆ title()

QString Diagram::title ( ) const

◆ titleBlockTemplateChanged

void Diagram::titleBlockTemplateChanged ( const QString &  template_name)
slot

This slot may be used to inform the diagram object that the given title block template has changed. The diagram will thus flush its title block-dedicated rendering cache.

Parameters
template_nameName of the title block template that has changed

Definition at line 1168 of file diagram.cpp.

References border_and_titleblock, BorderTitleBlock::titleBlockTemplateChanged(), and BorderTitleBlock::titleBlockTemplateName().

◆ titleBlockTemplateRemoved

void Diagram::titleBlockTemplateRemoved ( const QString &  template_name,
const QString &  new_template = QString() 
)
slot

This slot has to be be used to inform this class that the given title block template is about to be removed and is no longer accessible. This class will either use the provided optional TitleBlockTemplate or the default title block provided by QETApp::defaultTitleBlockTemplate()

Parameters
template_nameName of the title block template that has changed
new_template(Optional) Name of the title block template to use instead

Definition at line 1183 of file diagram.cpp.

References border_and_titleblock, QETProject::embeddedTitleBlockTemplatesCollection(), TitleBlockTemplatesProjectCollection::getTemplate(), m_project, BorderTitleBlock::titleBlockTemplateName(), and BorderTitleBlock::titleBlockTemplateRemoved().

◆ titleChanged

void Diagram::titleChanged ( const QString &  title)
slot

Definition at line 1158 of file diagram.cpp.

References diagramTitleChanged(), and title().

Referenced by Diagram().

◆ toPaintDevice()

bool Diagram::toPaintDevice ( QPaintDevice &  pix,
int  width = -1,
int  height = -1,
Qt::AspectRatioMode  aspectRatioMode = Qt::KeepAspectRatio 
)

Exporte le schema vers une image

Returns
Une QImage representant le schema

Definition at line 504 of file diagram.cpp.

References border_and_titleblock, BorderTitleBlock::borderAndTitleBlockRect(), margin, and use_border_.

◆ toXml()

QDomDocument Diagram::toXml ( bool  whole_content = true)

Exporte tout ou partie du schema

Parameters
whole_contentBooleen (a vrai par defaut) indiquant si le XML genere doit representer l'integralite du schema ou seulement le contenu selectionne
Returns
Un Document XML (QDomDocument)

Definition at line 604 of file diagram.cpp.

References border_and_titleblock, BorderTitleBlock::borderToXml(), conductors(), defaultConductorProperties, elements(), folioSequentialsToXml(), isEmpty(), m_cnd_hundredfolio_max, m_cnd_tenfolio_max, m_cnd_unitfolio_max, m_conductors_autonum_name, m_elmt_hundredfolio_max, m_elmt_tenfolio_max, m_elmt_unitfolio_max, m_freeze_new_conductors_, m_freeze_new_elements, m_project, QETApp::projectId(), BorderTitleBlock::titleBlockToXml(), ConductorProperties::toXml(), and QET::version.

Referenced by MultiPasteDialog::MultiPasteDialog(), and QETProject::toXml().

◆ undoStack()

QUndoStack & Diagram::undoStack ( )
inline

◆ unfreezeElements()

void Diagram::unfreezeElements ( )

Diagram::unfreezeElements Unfreeze every existent element label.

Definition at line 1545 of file diagram.cpp.

References elements(), and Element::freezeLabel().

◆ updateLabels

void Diagram::updateLabels ( )
slot

Diagram::updateLabels Update elements and conductors that reference folio field in their labels.

Definition at line 1245 of file diagram.cpp.

References conductors(), and content().

Referenced by Diagram().

◆ useBorder()

bool Diagram::useBorder ( )
inline
Returns
true if the border is rendered and take into account, false otherwise.

Definition at line 309 of file diagram.h.

References use_border_.

Referenced by applyProperties().

◆ usedTitleBlockTemplateChanged

void Diagram::usedTitleBlockTemplateChanged ( const QString &  )
signal

Referenced by setTitleBlockTemplate().

◆ usesElement()

bool Diagram::usesElement ( const ElementsLocation location)

Permet de savoir si un element est utilise sur un schema

Parameters
locationEmplacement d'un element
Returns
true si l'element location est utilise sur ce schema, false sinon

Definition at line 1512 of file diagram.cpp.

References elements().

◆ usesTitleBlockTemplate()

bool Diagram::usesTitleBlockTemplate ( const QString &  name)
Parameters
atitle block template name
Returns
true if the provided template is used by this diagram, false otherwise.

Definition at line 1527 of file diagram.cpp.

References border_and_titleblock, and BorderTitleBlock::titleBlockTemplateName().

◆ wheelEvent()

void Diagram::wheelEvent ( QGraphicsSceneWheelEvent *  event)
overrideprotected

Diagram::wheelEvent This event is managed by diagram event interface if any.

Parameters
event

Definition at line 265 of file diagram.cpp.

References m_event_interface, and DiagramEventInterface::wheelEvent().

Member Data Documentation

◆ background_color

QColor Diagram::background_color = Qt::white
static

◆ border_and_titleblock

BorderTitleBlock Diagram::border_and_titleblock

◆ conductor_setter_

QGraphicsLineItem* Diagram::conductor_setter_
private

Definition at line 102 of file diagram.h.

Referenced by Diagram(), setConductorStart(), setConductorStop(), and ~Diagram().

◆ defaultConductorProperties

ConductorProperties Diagram::defaultConductorProperties

Default properties for new conductors.

Definition at line 72 of file diagram.h.

Referenced by Conductor::Conductor(), fromXml(), and toXml().

◆ diagram_qet_version_

qreal Diagram::diagram_qet_version_
private

Definition at line 110 of file diagram.h.

Referenced by declaredQElectroTechVersion(), and fromXml().

◆ draw_colored_conductors_

bool Diagram::draw_colored_conductors_
private

Definition at line 115 of file diagram.h.

Referenced by drawColoredConductors(), and setDrawColoredConductors().

◆ draw_grid_

bool Diagram::draw_grid_
private

Definition at line 112 of file diagram.h.

Referenced by displayGrid(), drawBackground(), and setDisplayGrid().

◆ draw_terminals_

bool Diagram::draw_terminals_
private

Definition at line 114 of file diagram.h.

Referenced by drawTerminals().

◆ m_cnd_hundredfolio_max

QHash<QString, QStringList> Diagram::m_cnd_hundredfolio_max

Definition at line 99 of file diagram.h.

Referenced by fromXml(), loadCndFolioSeq(), and toXml().

◆ m_cnd_tenfolio_max

QHash<QString, QStringList> Diagram::m_cnd_tenfolio_max

Definition at line 98 of file diagram.h.

Referenced by fromXml(), loadCndFolioSeq(), and toXml().

◆ m_cnd_unitfolio_max

QHash<QString, QStringList> Diagram::m_cnd_unitfolio_max

Hash containing max values for folio sequential autonums in this diagram.

Definition at line 97 of file diagram.h.

Referenced by fromXml(), loadCndFolioSeq(), and toXml().

◆ m_conductors_autonum_name

QString Diagram::m_conductors_autonum_name
private

Definition at line 117 of file diagram.h.

Referenced by conductorsAutonumName(), fromXml(), setConductorsAutonumName(), and toXml().

◆ m_element_texts_mover

ElementTextsMover Diagram::m_element_texts_mover
private

Definition at line 104 of file diagram.h.

Referenced by elementTextsMover().

◆ m_elements_mover

ElementsMover Diagram::m_elements_mover
private

Definition at line 103 of file diagram.h.

Referenced by elementsMover(), keyPressEvent(), and keyReleaseEvent().

◆ m_elmt_hundredfolio_max

QHash<QString, QStringList> Diagram::m_elmt_hundredfolio_max

Definition at line 95 of file diagram.h.

Referenced by fromXml(), loadElmtFolioSeq(), autonum::setSequential(), and toXml().

◆ m_elmt_tenfolio_max

QHash<QString, QStringList> Diagram::m_elmt_tenfolio_max

Definition at line 94 of file diagram.h.

Referenced by fromXml(), loadElmtFolioSeq(), autonum::setSequential(), and toXml().

◆ m_elmt_unitfolio_max

QHash<QString, QStringList> Diagram::m_elmt_unitfolio_max

Hash containing max values for folio sequential autonums in this diagram.

Definition at line 93 of file diagram.h.

Referenced by fromXml(), loadElmtFolioSeq(), autonum::setSequential(), and toXml().

◆ m_event_interface

DiagramEventInterface* Diagram::m_event_interface
private

◆ m_freeze_new_conductors_

bool Diagram::m_freeze_new_conductors_
private

Definition at line 121 of file diagram.h.

Referenced by freezeNewConductors(), fromXml(), setFreezeNewConductors(), and toXml().

◆ m_freeze_new_elements

bool Diagram::m_freeze_new_elements
private

Definition at line 120 of file diagram.h.

Referenced by freezeNewElements(), fromXml(), setFreezeNewElements(), and toXml().

◆ m_project

QETProject* Diagram::m_project
private

◆ margin

const qreal Diagram::margin = 5.0
static

◆ qgi_manager_

QGIManager* Diagram::qgi_manager_
private

Definition at line 105 of file diagram.h.

Referenced by Diagram(), qgiManager(), and ~Diagram().

◆ use_border_

bool Diagram::use_border_
private

Definition at line 113 of file diagram.h.

Referenced by drawBackground(), imageSize(), setUseBorder(), toPaintDevice(), and useBorder().

◆ xGrid

int Diagram::xGrid = 10
static

abscissa grid step size

Definition at line 76 of file diagram.h.

Referenced by drawBackground(), Conductor::generateConductorPath(), and snapToGrid().

◆ xKeyGrid

int Diagram::xKeyGrid = 10
static

Key grid x step size.

Definition at line 80 of file diagram.h.

Referenced by keyPressEvent().

◆ xKeyGridFine

int Diagram::xKeyGridFine = 1
static

Key grid fine x step size.

Definition at line 84 of file diagram.h.

Referenced by keyPressEvent().

◆ xml_document_

QDomDocument Diagram::xml_document_
private

Definition at line 108 of file diagram.h.

◆ yGrid

int Diagram::yGrid = 10
static

ordinate grid step size

Definition at line 78 of file diagram.h.

Referenced by drawBackground(), Conductor::generateConductorPath(), and snapToGrid().

◆ yKeyGrid

int Diagram::yKeyGrid = 10
static

Key grid y step size.

Definition at line 82 of file diagram.h.

Referenced by keyPressEvent().

◆ yKeyGridFine

int Diagram::yKeyGridFine = 1
static

Key grid fine y step size.

Definition at line 86 of file diagram.h.

Referenced by keyPressEvent().


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