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

#include <element.h>

Public Types

enum  kind {
  Simple = 1, NextReport = 2, PreviousReport = 4, AllReport = 6,
  Master = 8, Slave = 16, Terminale = 32
}
 The kind enum Used to know the kind of this element (master, slave, report ect...) More...
 
enum  { Type = UserType + 1000 }
 

Signals

void linkedElementChanged ()
 
void elementInfoChange (DiagramContext old_info, DiagramContext new_info)
 
void textAdded (DynamicElementTextItem *deti)
 
void textRemoved (DynamicElementTextItem *deti)
 
void textsGroupAdded (ElementTextItemGroup *group)
 
void textsGroupAboutToBeRemoved (ElementTextItemGroup *group)
 
void textAddedToGroup (DynamicElementTextItem *text, ElementTextItemGroup *group)
 
void textRemovedFromGroup (DynamicElementTextItem *text, ElementTextItemGroup *group)
 

Public Member Functions

 Element (const ElementsLocation &location, QGraphicsItem *=nullptr, int *state=nullptr, Element::kind link_type=Element::Simple)
 Element::Element. More...
 
 ~Element () override
 Element::~Element. More...
 
int type () const override
 
QList< Terminal * > terminals () const
 Element::terminals. More...
 
QList< Conductor * > conductors () const
 Element::conductors. More...
 
DiagramContext elementInformations () const
 
DiagramContext kindInformations () const
 
autonum::sequentialNumbers sequenceStruct () const
 
autonum::sequentialNumbersrSequenceStruct ()
 
bool isFreezeLabel () const
 
virtual void setHighlighted (bool)
 
void displayHelpLine (bool b=true)
 Element::displayHelpLine Display the help line of each terminal if b is true. More...
 
QSize size () const
 
QPixmap pixmap ()
 Element::pixmap. More...
 
QPoint setHotspot (QPoint)
 
QPoint hotspot () const
 
void editProperty () override
 
virtual bool fromXml (QDomElement &, QHash< int, Terminal *> &, bool=false)
 Element::fromXml Import the parameters of this element from a xml document. When call this function ensure this element is already in a scene, because the dynamic text item and element text item group (in the xml file) are created in this function and need a diagram for create their Xref, when this element is linked to another. If not the Xref can be not displayed, until the next call of update Xref of the group or text item. More...
 
virtual QDomElement toXml (QDomDocument &, QHash< Terminal *, int > &) const
 
QUuid uuid () const
 Element::uuid. More...
 
int orientation () const
 
void addDynamicTextItem (DynamicElementTextItem *deti=nullptr)
 Element::addDynamiqueTextItem Add as a dynamic text item of this element, is reparented to this If is null, a new DynamicElementTextItem is created and added to this element. More...
 
void removeDynamicTextItem (DynamicElementTextItem *deti)
 Element::removeDynamicTextItem Remove , no matter if is a child of this element or a child of a group of this element. Set he parent item of to 0, is not deleted. More...
 
QList< DynamicElementTextItem * > dynamicTextItems () const
 Element::dynamicTextItems. More...
 
bool isFree () const
 
virtual void linkToElement (Element *)
 
virtual void unlinkAllElements ()
 
virtual void unlinkElement (Element *)
 
QList< Element * > linkedElements ()
 Element::linkedElements. More...
 
virtual kind linkType () const
 
void newUuid ()
 
void paint (QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override
 Element::paint. More...
 
QRectF boundingRect () const override
 
will renamed to name1 or name2 etc....

Element::addTextGroup Create and add an element text item group to this element. If this element already have a group with the same name, then

Parameters
name: the name of the group
Returns
the created group.
ElementTextItemGroupaddTextGroup (const QString &name)
 
void addTextGroup (ElementTextItemGroup *group)
 Element::addTextGroup. More...
 
void removeTextGroup (ElementTextItemGroup *group)
 Element::removeTextGroup Remove the text group from this element, and set the parent of group to 0. group is not deleted. All texts owned by the group will be reparented to this element. More...
 
- Public Member Functions inherited from QetGraphicsItem
 QetGraphicsItem (QGraphicsItem *parent=nullptr)
 QetGraphicsItem::QetGraphicsItem Default constructor. More...
 
 ~QetGraphicsItem () override=0
 
Diagramdiagram () const
 QetGraphicsItem::diagram return the diagram of this item. More...
 
virtual void setPos (const QPointF &p)
 QetGraphicsItem::setPos set the position of the item to p. More...
 
virtual void setPos (qreal x, qreal y)
 QetGraphicsItem::setPos set the position of the item. More...
 
virtual bool isMovable () const
 
virtual void setMovable (bool movable)
 
QET::GraphicsItemState state () const
 QetGraphicsItem::state. More...
 

Static Public Member Functions

static bool valideXml (QDomElement &)
 

Protected Member Functions

void drawAxes (QPainter *, const QStyleOptionGraphicsItem *)
 
void setSize (int, int)
 Element::setSize Define the size of the element. The size must be a multiple of 10. If not, the dimensions indicated will be arrrondies to higher tens. More...
 
- Protected Member Functions inherited from QetGraphicsItem
void mousePressEvent (QGraphicsSceneMouseEvent *event) override
 QetGraphicsItem::mousePressEvent handle the mouse click. More...
 
void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override
 QetGraphicsItem::mouseDoubleClickEvent handle the mouse double click. More...
 
void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override
 QetGraphicsItem::mouseMoveEvent handle mouse movement. More...
 
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override
 QetGraphicsItem::mouseReleaseEvent handle mouse release click. More...
 

Protected Attributes

QHash< DynamicElementTextItem *, QPointF > m_converted_text_from_xml_description
 
QList< Element * > connected_elements
 
QList< QUuid > tmp_uuids_link
 
QUuid m_uuid
 
kind m_link_type = Element::Simple
 
DiagramContext m_element_informations
 
DiagramContext m_kind_informations
 
autonum::sequentialNumbers m_autoNum_seq
 
bool m_freeze_label = false
 
QString m_F_str
 
ElementsLocation m_location
 
NamesList m_names
 
QList< Terminal * > m_terminals
 
const QPicture m_picture
 
const QPicture m_low_zoom_picture
 
- Protected Attributes inherited from QetGraphicsItem
bool is_movable_
 
bool m_first_move
 
bool snap_to_grid_
 
QPointF m_mouse_to_origin_movement
 
QET::GraphicsItemState m_state = QET:: GIOK
 

Private Member Functions

 Element (const Element &)
 
void drawSelection (QPainter *, const QStyleOptionGraphicsItem *)
 
void drawHighlight (QPainter *, const QStyleOptionGraphicsItem *)
 
bool buildFromXml (const QDomElement &, int *=nullptr)
 Element::buildFromXml Build this element from an xml description. More...
 
bool parseElement (const QDomElement &dom)
 Element::parseElement Parse the element of the xml description of this element. More...
 
bool parseInput (const QDomElement &dom_element)
 Element::parseInput Parse the input (old text field) the parsed input are converted to dynamic text field, this function is only here to keep compatibility with old text. More...
 
DynamicElementTextItemparseDynamicText (const QDomElement &dom_element)
 Element::parseDynamicText Create the dynamic text field describ in . More...
 
TerminalparseTerminal (const QDomElement &dom_element)
 

Private Attributes

bool m_must_highlight = false
 
QSize dimensions
 
QPoint hotspot_coord
 
bool m_mouse_over = false
 
QString m_prefix
 
QList< DynamicElementTextItem * > m_dynamic_text_list
 
QList< ElementTextItemGroup * > m_texts_group
 

Friends

class DiagramEventAddElement
 

or nullptr if this element

Element::textGroup

Parameters
name
Returns
the text group named haven't got a group with this name
QList< QPair< Terminal *, Terminal * > > AlignedFreeTerminals () const
 Element::AlignedFreeTerminals. More...
 
virtual void setElementInformations (DiagramContext dc)
 Element::setElementInformations Set new information for this element. If new information is different of current infotmation emit . More...
 
void setUpFormula (bool code_letter=true)
 Element::setUpFormula Set up the formula used to create the label of this element. More...
 
void setPrefix (QString)
 Element::setPrefix set Element Prefix. More...
 
QString getPrefix () const
 Element::getPrefix get Element Prefix. More...
 
void freezeLabel (bool freeze)
 Element::freezeLabel Freeze this element label. More...
 
void freezeNewAddedElement ()
 Element::freezeNewAddedElement Freeze this label if needed. More...
 
QString name () const override
 Element::name. More...
 
ElementsLocation location () const
 
ElementTextItemGrouptextGroup (const QString &name) const
 
QList< ElementTextItemGroup * > textGroups () const
 Element::textGroups. More...
 
bool addTextToGroup (DynamicElementTextItem *text, ElementTextItemGroup *group)
 Element::addTextToGroup Add the text to the group ; If isn't owned by this element return false. The text must be a text of this element. More...
 
bool removeTextFromGroup (DynamicElementTextItem *text, ElementTextItemGroup *group)
 Element::removeTextFromGroup Remove the text from the group , en reparent to this element. More...
 
virtual void initLink (QETProject *)
 Element::initLink Initialise the link between this element and other elements. This method can be call once because init the link according to uuid store in a private list, after link, the list is clear, so call another time do nothing. More...
 
void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override
 Element::mouseMoveEvent. More...
 
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override
 Element::mouseReleaseEvent. More...
 
void hoverEnterEvent (QGraphicsSceneHoverEvent *) override
 
void hoverLeaveEvent (QGraphicsSceneHoverEvent *) override
 

Detailed Description

This is the base class for electrical elements.

Definition at line 40 of file element.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into an Element.

Returns
the QGraphicsItem type
Enumerator
Type 

Definition at line 69 of file element.h.

◆ kind

The kind enum Used to know the kind of this element (master, slave, report ect...)

Enumerator
Simple 
NextReport 
PreviousReport 
AllReport 
Master 
Slave 
Terminale 

Definition at line 50 of file element.h.

Constructor & Destructor Documentation

◆ Element() [1/2]

Element::Element ( const ElementsLocation location,
QGraphicsItem *  parent = nullptr,
int *  state = nullptr,
Element::kind  link_type = Element::Simple 
)

Element::Element.

Parameters
location,locationof this element
parent,parentgraphics item
state,stateof the instanciation

Definition at line 71 of file element.cpp.

References buildFromXml(), autonum::elementPrefixForLocation(), ElementsLocation::exist(), ElementsLocation::isElement(), location(), m_uuid, setPrefix(), QetGraphicsItem::state(), and ElementsLocation::xml().

◆ ~Element()

Element::~Element ( )
override

Element::~Element.

Definition at line 114 of file element.cpp.

References m_dynamic_text_list, and m_terminals.

◆ Element() [2/2]

Element::Element ( const Element )
private

Member Function Documentation

◆ addDynamicTextItem()

void Element::addDynamicTextItem ( DynamicElementTextItem deti = nullptr)

Element::addDynamiqueTextItem Add as a dynamic text item of this element, is reparented to this If is null, a new DynamicElementTextItem is created and added to this element.

Parameters
deti

Definition at line 1146 of file element.cpp.

References m_dynamic_text_list, and textAdded().

Referenced by fromXml(), parseDynamicText(), AddElementTextCommand::redo(), removeTextFromGroup(), and DeleteQGraphicsItemCommand::undo().

◆ addTextGroup() [1/2]

ElementTextItemGroup * Element::addTextGroup ( const QString &  name)

Definition at line 1209 of file element.cpp.

References m_texts_group, name(), textGroup(), and textsGroupAdded().

Referenced by fromXml().

◆ addTextGroup() [2/2]

void Element::addTextGroup ( ElementTextItemGroup group)

Element::addTextGroup.

Parameters
groupadd group to the group of this element. the group must not be owned by an element.

Definition at line 1240 of file element.cpp.

References m_texts_group, ElementTextItemGroup::parentElement(), and textsGroupAdded().

◆ addTextToGroup()

bool Element::addTextToGroup ( DynamicElementTextItem text,
ElementTextItemGroup group 
)

Element::addTextToGroup Add the text to the group ; If isn't owned by this element return false. The text must be a text of this element.

Returns
: true if the text was succesfully added to the group.

Definition at line 1310 of file element.cpp.

References ElementTextItemGroup::addToGroup(), m_dynamic_text_list, m_texts_group, textAddedToGroup(), and textRemoved().

Referenced by ElementTextItemGroup::fromXml(), fromXml(), and DeleteQGraphicsItemCommand::undo().

◆ AlignedFreeTerminals()

QList< QPair< Terminal *, Terminal * > > Element::AlignedFreeTerminals ( ) const

Element::AlignedFreeTerminals.

Returns
a list of terminal (owned by this element) aligned to other terminal (from other element) The first Terminal of QPair is a Terminal owned by this element, this terminal haven't got any conductor docked. The second Terminal of QPair is a Terminal owned by an other element, which is aligned with the first Terminal. The second Terminal can have or not docked conductors.

Definition at line 1355 of file element.cpp.

References Terminal::conductors(), and terminals().

Referenced by ElementsMover::endMovement().

◆ boundingRect()

QRectF Element::boundingRect ( ) const
override
Returns
Le rectangle delimitant le contour de l'element

Definition at line 205 of file element.cpp.

References dimensions, and hotspot_coord.

Referenced by centerToBottomDiagram(), drawHighlight(), and drawSelection().

◆ buildFromXml()

bool Element::buildFromXml ( const QDomElement &  xml_def_elmt,
int *  state = nullptr 
)
private

Element::buildFromXml Build this element from an xml description.

Parameters
xml_def_elmt
stateOptional pointer which define the status of build 0 - evreything all right 4 - xml isn't a "definition" 5 - attribute of the definition isn't present or valid 6 - the definition is empty 7 - parsing of a xml node who describe a graphical part failed. 8 - No part of the drawing could be loaded
Returns

Definition at line 350 of file element.cpp.

References QET::attributeIsAnInteger(), NamesList::fromXml(), DiagramContext::fromXml(), ElementPictureFactory::getPictures(), QET::GIBuildingFromXml, QET::GIOK, ElementPictureFactory::instance(), m_element_informations, m_kind_informations, m_location, m_low_zoom_picture, m_names, m_picture, QetGraphicsItem::m_state, name(), parseElement(), setHotspot(), setSize(), QetGraphicsItem::state(), QET::Icons::tr, and QET::version.

Referenced by Element().

◆ conductors()

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

Element::conductors.

Returns
The list of conductors docked to this element the list is sorted according to the position of the terminal where the conductor is docked from top to bottom, and left to right.

Definition at line 134 of file element.cpp.

References m_terminals.

Referenced by ConductorCreator::existingPotential(), LinkReportPotentialSelector::LinkReportPotentialSelector(), PotentialSelectorDialog::on_buttonBox_accepted(), and LinkElementCommand::redo().

◆ displayHelpLine()

void Element::displayHelpLine ( bool  b = true)

Element::displayHelpLine Display the help line of each terminal if b is true.

Parameters
b

Definition at line 172 of file element.cpp.

References Terminal::drawHelpLine(), and terminals().

◆ drawAxes()

void Element::drawAxes ( QPainter *  painter,
const QStyleOptionGraphicsItem *  options 
)
protected

Dessine un petit repere (axes x et y) relatif a l'element

Parameters
painterLe QPainter a utiliser pour dessiner les axes
optionsLes options de style a prendre en compte

Definition at line 273 of file element.cpp.

◆ drawHighlight()

void Element::drawHighlight ( QPainter *  painter,
const QStyleOptionGraphicsItem *  options 
)
private

Dessine le cadre de selection de l'element de maniere systematiquement non antialiasee.

Parameters
painterLe QPainter a utiliser pour dessiner les bornes.
optionsLes options de style a prendre en compte

Definition at line 315 of file element.cpp.

References boundingRect().

Referenced by paint().

◆ drawSelection()

void Element::drawSelection ( QPainter *  painter,
const QStyleOptionGraphicsItem *  options 
)
private

Dessine le cadre de selection de l'element de maniere systematiquement non antialiasee.

Parameters
painterLe QPainter a utiliser pour dessiner les bornes.
optionsLes options de style a prendre en compte

Definition at line 292 of file element.cpp.

References boundingRect().

Referenced by paint().

◆ dynamicTextItems()

QList< DynamicElementTextItem * > Element::dynamicTextItems ( ) const

Element::dynamicTextItems.

Returns
all dynamic text items of this element directly child of this element. Texts in text-groups belonging to this element are not returned by this function.
See also
ElementTextItemGroup::texts

Definition at line 1197 of file element.cpp.

References m_dynamic_text_list.

Referenced by ImportElementTextPattern::apply(), ElementTextItemGroup::fromXml(), SearchAndReplaceWidget::searchTerms(), and AddElementTextCommand::~AddElementTextCommand().

◆ editProperty()

void Element::editProperty ( )
overridevirtual

Reimplemented from QetGraphicsItem.

Definition at line 145 of file element.cpp.

References QetGraphicsItem::diagram(), and ElementPropertiesWidget::findEditClicked().

◆ elementInfoChange

void Element::elementInfoChange ( DiagramContext  old_info,
DiagramContext  new_info 
)
signal

◆ elementInformations()

DiagramContext Element::elementInformations ( ) const
inline

◆ freezeLabel()

void Element::freezeLabel ( bool  freeze)

Element::freezeLabel Freeze this element label.

Definition at line 1545 of file element.cpp.

References m_freeze_label.

Referenced by Diagram::freezeElements(), freezeNewAddedElement(), and Diagram::unfreezeElements().

◆ freezeNewAddedElement()

void Element::freezeNewAddedElement ( )

Element::freezeNewAddedElement Freeze this label if needed.

Definition at line 1554 of file element.cpp.

References QetGraphicsItem::diagram(), and freezeLabel().

◆ fromXml()

bool Element::fromXml ( QDomElement &  e,
QHash< int, Terminal *> &  table_id_adr,
bool  handle_inputs_rotation = false 
)
virtual

Element::fromXml Import the parameters of this element from a xml document. When call this function ensure this element is already in a scene, because the dynamic text item and element text item group (in the xml file) are created in this function and need a diagram for create their Xref, when this element is linked to another. If not the Xref can be not displayed, until the next call of update Xref of the group or text item.

Parameters
e: the dom element where the parameter is stored
table_id_adr: Reference to the mapping table between IDs of the XML file and the addresses in memory. If the import succeeds, it must be add the right couples (id, address).
handle_inputs_rotation: apply the rotation of this element to his child text
Returns

Since the commit 4791, the value used as "label" and "formula" is stored in differents keys (instead of the same key, "label" in previous version), so, if "label" contain "%" (Use variable value), and "formula" does not exist, this mean the label was made before commit 4791 (0.51 dev). So we swap the value stored in "label" to "formula" as expected. remove this code at version 0.7 or more (probably useless).

During the devel of the version 0.7, the "old text" was replaced by the dynamic element text item. When open a project made befor the 0.7, we must to reproduce the same visual when the label are not empty and visible, and comment are not empty and visible and/or location are not empty and visible. we create a text group with inside the needed texts, label and comment and/or location.

Definition at line 647 of file element.cpp.

References addDynamicTextItem(), addTextGroup(), addTextToGroup(), DiagramContext::addValue(), DiagramContext::contains(), QetGraphicsItem::diagram(), DynamicElementTextItem::ElementInfo, QET::findInDomElement(), DiagramTextItem::font, autonum::sequentialNumbers::fromXml(), DiagramContext::fromXml(), ElementTextItemGroup::fromXml(), DynamicElementTextItem::fromXml(), QET::GILoadingFromXml, QET::GIOK, DiagramContext::keyMustShow(), XRefProperties::Label, ElementXmlRetroCompatibility::loadSequential(), location(), m_autoNum_seq, m_converted_text_from_xml_description, m_dynamic_text_list, m_element_informations, m_freeze_label, m_kind_informations, m_link_type, m_prefix, QetGraphicsItem::m_state, m_uuid, Master, NextReport, PreviousReport, ElementTextItemGroup::setAlignment(), setElementInformations(), DiagramTextItem::setFont(), DynamicElementTextItem::setFrame(), ElementTextItemGroup::setHoldToBottomPage(), DynamicElementTextItem::setInfoName(), ElementTextItemGroup::setPos(), ElementTextItemGroup::setRotation(), DynamicElementTextItem::setTextFrom(), DynamicElementTextItem::setTextWidth(), ElementTextItemGroup::setVerticalAdjustment(), tmp_uuids_link, QET::Icons::tr, Terminal::valideXml(), DiagramContext::value(), ElementTextItemGroup::xmlTaggName(), and DynamicElementTextItem::xmlTaggName().

Referenced by Diagram::fromXml().

◆ getPrefix()

QString Element::getPrefix ( ) const

Element::getPrefix get Element Prefix.

Definition at line 1529 of file element.cpp.

References m_prefix.

Referenced by autonum::AssignVariables::AssignVariables().

◆ hotspot()

QPoint Element::hotspot ( ) const
Returns
Le hotspot courant de l'element

Definition at line 254 of file element.cpp.

References hotspot_coord.

Referenced by ElementsTreeView::startElementDrag().

◆ hoverEnterEvent()

void Element::hoverEnterEvent ( QGraphicsSceneHoverEvent *  e)
overrideprotected

When mouse over element change m_mouse_over to true (used in paint() function ) Also highlight linked elements

Parameters
eQGraphicsSceneHoverEvent

Definition at line 1461 of file element.cpp.

References linkedElements(), m_mouse_over, name(), and setHighlighted().

◆ hoverLeaveEvent()

void Element::hoverLeaveEvent ( QGraphicsSceneHoverEvent *  e)
overrideprotected

When mouse over element leave the position change m_mouse_over to false(used in paint() function ) Also un-highlight linked elements

Parameters
eQGraphicsSceneHoverEvent

Definition at line 1478 of file element.cpp.

References linkedElements(), m_mouse_over, and setHighlighted().

◆ initLink()

void Element::initLink ( QETProject prj)
virtual

Element::initLink Initialise the link between this element and other elements. This method can be call once because init the link according to uuid store in a private list, after link, the list is clear, so call another time do nothing.

Parameters
prj,ownershipproject of this element and other element to be linked

Reimplemented in MasterElement, SimpleElement, and TerminalElement.

Definition at line 1381 of file element.cpp.

References ElementProvider::fromUuids(), linkToElement(), and tmp_uuids_link.

Referenced by TerminalElement::initLink(), SimpleElement::initLink(), and MasterElement::initLink().

◆ isFree()

bool Element::isFree ( ) const
inline

◆ isFreezeLabel()

bool Element::isFreezeLabel ( ) const
inline

Definition at line 101 of file element.h.

References m_freeze_label.

Referenced by DynamicElementTextItem::setupFormulaConnection().

◆ kindInformations()

DiagramContext Element::kindInformations ( ) const
inline

◆ linkedElementChanged

void Element::linkedElementChanged ( )
signal

◆ linkedElements()

QList< Element * > Element::linkedElements ( )
inline

◆ linkToElement()

virtual void Element::linkToElement ( Element )
inlinevirtual

◆ linkType()

virtual kind Element::linkType ( ) const
inlinevirtual

◆ location()

ElementsLocation Element::location ( ) const

Definition at line 1569 of file element.cpp.

References m_location.

Referenced by Element(), fromXml(), and ExportDialog::generateDxf().

◆ mouseMoveEvent()

void Element::mouseMoveEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected

Element::mouseMoveEvent.

Parameters
event

Definition at line 1433 of file element.cpp.

References QetGraphicsItem::mouseMoveEvent(), and terminals().

◆ mouseReleaseEvent()

void Element::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected

Element::mouseReleaseEvent.

Parameters
event

Definition at line 1446 of file element.cpp.

References QetGraphicsItem::mouseReleaseEvent(), and terminals().

◆ name()

QString Element::name ( ) const
overridevirtual

◆ newUuid()

void Element::newUuid ( )
inline

Definition at line 139 of file element.h.

References m_uuid.

◆ orientation()

int Element::orientation ( ) const
inline

Indicate the current orientation of this element O = 0° 1 = 90° 2 = 180° 3 = 270°

Returns
the current orientation of this element

Definition at line 213 of file element.h.

References QET::correctAngle().

Referenced by toXml().

◆ paint()

void Element::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  options,
QWidget *   
)
override

Element::paint.

Parameters
painter
options
widget

Definition at line 184 of file element.cpp.

References drawHighlight(), drawSelection(), m_low_zoom_picture, m_mouse_over, m_must_highlight, and m_picture.

◆ parseDynamicText()

DynamicElementTextItem * Element::parseDynamicText ( const QDomElement &  dom_element)
private

Element::parseDynamicText Create the dynamic text field describ in .

Parameters
dom_element
Returns

Definition at line 550 of file element.cpp.

References addDynamicTextItem(), DynamicElementTextItem::fromXml(), DynamicElementTextItem::m_uuid, and DynamicElementTextItem::xmlTaggName().

Referenced by parseElement().

◆ parseElement()

bool Element::parseElement ( const QDomElement &  dom)
private

Element::parseElement Parse the element of the xml description of this element.

Parameters
dom
Returns

Definition at line 484 of file element.cpp.

References parseDynamicText(), parseInput(), and parseTerminal().

Referenced by buildFromXml().

◆ parseInput()

bool Element::parseInput ( const QDomElement &  dom_element)
private

Element::parseInput Parse the input (old text field) the parsed input are converted to dynamic text field, this function is only here to keep compatibility with old text.

Parameters
dom_element
Returns

Definition at line 500 of file element.cpp.

References QET::attributeIsAnInteger(), QET::attributeIsAReal(), DynamicElementTextItem::ElementInfo, DiagramTextItem::font, m_converted_text_from_xml_description, DiagramTextItem::setFont(), DynamicElementTextItem::setInfoName(), DynamicElementTextItem::setText(), DynamicElementTextItem::setTextFrom(), and size().

Referenced by parseElement().

◆ parseTerminal()

Terminal * Element::parseTerminal ( const QDomElement &  dom_element)
private

◆ pixmap()

QPixmap Element::pixmap ( )

Element::pixmap.

Returns
the pixmap of this element

Definition at line 262 of file element.cpp.

References ElementPictureFactory::instance(), m_location, and ElementPictureFactory::pixmap().

Referenced by ElementsTreeView::startElementDrag().

◆ removeDynamicTextItem()

void Element::removeDynamicTextItem ( DynamicElementTextItem deti)

Element::removeDynamicTextItem Remove , no matter if is a child of this element or a child of a group of this element. Set he parent item of to 0, is not deleted.

Parameters
deti

Definition at line 1168 of file element.cpp.

References m_dynamic_text_list, m_texts_group, removeTextFromGroup(), and textRemoved().

Referenced by DeleteQGraphicsItemCommand::redo(), and AddElementTextCommand::undo().

◆ removeTextFromGroup()

bool Element::removeTextFromGroup ( DynamicElementTextItem text,
ElementTextItemGroup group 
)

Element::removeTextFromGroup Remove the text from the group , en reparent to this element.

Returns
true if text was succesfully removed

Definition at line 1331 of file element.cpp.

References addDynamicTextItem(), m_texts_group, ElementTextItemGroup::removeFromGroup(), textRemovedFromGroup(), and ElementTextItemGroup::texts().

Referenced by DeleteQGraphicsItemCommand::redo(), removeDynamicTextItem(), and removeTextGroup().

◆ removeTextGroup()

void Element::removeTextGroup ( ElementTextItemGroup group)

Element::removeTextGroup Remove the text group from this element, and set the parent of group to 0. group is not deleted. All texts owned by the group will be reparented to this element.

Parameters
name

Definition at line 1257 of file element.cpp.

References m_texts_group, removeTextFromGroup(), textsGroupAboutToBeRemoved(), and DynamicElementTextItem::Type.

◆ rSequenceStruct()

autonum::sequentialNumbers& Element::rSequenceStruct ( )
inline

◆ sequenceStruct()

autonum::sequentialNumbers Element::sequenceStruct ( ) const
inline

Definition at line 95 of file element.h.

References m_autoNum_seq.

◆ setElementInformations()

void Element::setElementInformations ( DiagramContext  dc)
virtual

Element::setElementInformations Set new information for this element. If new information is different of current infotmation emit .

Parameters
dc

Definition at line 1399 of file element.cpp.

References elementInfoChange(), and m_element_informations.

Referenced by fromXml().

◆ setHighlighted()

void Element::setHighlighted ( bool  hl)
virtual

◆ setHotspot()

QPoint Element::setHotspot ( QPoint  hs)

Definit le hotspot de l'element par rapport au coin superieur gauche de son rectangle delimitant. Necessite que la taille ait deja ete definie

Parameters
hsCoordonnees du hotspot

Definition at line 238 of file element.cpp.

References dimensions, and hotspot_coord.

Referenced by buildFromXml().

◆ setPrefix()

void Element::setPrefix ( QString  prefix)

Element::setPrefix set Element Prefix.

Definition at line 1537 of file element.cpp.

References m_prefix.

Referenced by Element().

◆ setSize()

void Element::setSize ( int  wid,
int  hei 
)
protected

Element::setSize Define the size of the element. The size must be a multiple of 10. If not, the dimensions indicated will be arrrondies to higher tens.

Parameters
wid
hei

Definition at line 217 of file element.cpp.

References dimensions.

Referenced by buildFromXml().

◆ setUpFormula()

void Element::setUpFormula ( bool  code_letter = true)

◆ size()

QSize Element::size ( ) const
Returns
la taille de l'element sur le schema

Definition at line 229 of file element.cpp.

References dimensions.

Referenced by parseInput(), and ReportElement::~ReportElement().

◆ terminals()

QList< Terminal * > Element::terminals ( ) const

◆ textAdded

void Element::textAdded ( DynamicElementTextItem deti)
signal

◆ textAddedToGroup

void Element::textAddedToGroup ( DynamicElementTextItem text,
ElementTextItemGroup group 
)
signal

◆ textGroup()

ElementTextItemGroup * Element::textGroup ( const QString &  name) const

Definition at line 1285 of file element.cpp.

References m_texts_group, and name().

Referenced by addTextGroup().

◆ textGroups()

QList< ElementTextItemGroup * > Element::textGroups ( ) const

Element::textGroups.

Returns
All texts groups of this element

Definition at line 1298 of file element.cpp.

References m_texts_group.

Referenced by ImportElementTextPattern::apply(), and SearchAndReplaceWidget::searchTerms().

◆ textRemoved

void Element::textRemoved ( DynamicElementTextItem deti)
signal

◆ textRemovedFromGroup

void Element::textRemovedFromGroup ( DynamicElementTextItem text,
ElementTextItemGroup group 
)
signal

◆ textsGroupAboutToBeRemoved

void Element::textsGroupAboutToBeRemoved ( ElementTextItemGroup group)
signal

◆ textsGroupAdded

void Element::textsGroupAdded ( ElementTextItemGroup group)
signal

◆ toXml()

QDomElement Element::toXml ( QDomDocument &  document,
QHash< Terminal *, int > &  table_adr_id 
) const
virtual

Permet d'exporter l'element en XML

Parameters
documentDocument XML a utiliser
table_adr_idTable de correspondance entre les adresses des bornes et leur id dans la representation XML ; cette table completee par cette methode
Returns
L'element XML representant cet element electrique

Definition at line 1021 of file element.cpp.

References connected_elements, isFree(), DiagramContext::keys(), m_autoNum_seq, m_dynamic_text_list, m_element_informations, m_freeze_label, m_location, m_prefix, m_texts_group, orientation(), ElementsLocation::path(), terminals(), autonum::sequentialNumbers::toXml(), DiagramContext::toXml(), and uuid().

Referenced by ExportElementTextPattern::xmlConf().

◆ type()

int Element::type ( ) const
inlineoverride

Definition at line 70 of file element.h.

References Type.

◆ unlinkAllElements()

virtual void Element::unlinkAllElements ( )
inlinevirtual

◆ unlinkElement()

virtual void Element::unlinkElement ( Element )
inlinevirtual

Reimplemented in MasterElement, ReportElement, and SlaveElement.

Definition at line 135 of file element.h.

Referenced by LinkElementCommand::makeLink().

◆ uuid()

QUuid Element::uuid ( ) const
inline

Element::uuid.

Returns
the uuid of this element

Definition at line 221 of file element.h.

References m_uuid.

Referenced by ElementProvider::fromUuids(), and toXml().

◆ valideXml()

bool Element::valideXml ( QDomElement &  e)
static

Permet de savoir si un element XML (QDomElement) represente bien un element

Parameters
eLe QDomElement a valide
Returns
true si l'element XML est un Element, false sinon

Definition at line 614 of file element.cpp.

Referenced by Diagram::fromXml().

Friends And Related Function Documentation

◆ DiagramEventAddElement

friend class DiagramEventAddElement
friend

Definition at line 42 of file element.h.

Member Data Documentation

◆ connected_elements

QList<Element *> Element::connected_elements
protected

◆ dimensions

QSize Element::dimensions
private

Definition at line 190 of file element.h.

Referenced by boundingRect(), setHotspot(), setSize(), and size().

◆ hotspot_coord

QPoint Element::hotspot_coord
private

Definition at line 191 of file element.h.

Referenced by boundingRect(), hotspot(), and setHotspot().

◆ m_autoNum_seq

autonum::sequentialNumbers Element::m_autoNum_seq
protected

Definition at line 178 of file element.h.

Referenced by fromXml(), rSequenceStruct(), sequenceStruct(), setUpFormula(), and toXml().

◆ m_converted_text_from_xml_description

QHash<DynamicElementTextItem *, QPointF> Element::m_converted_text_from_xml_description
protected

Definition at line 168 of file element.h.

Referenced by DiagramEventAddElement::addElement(), fromXml(), and parseInput().

◆ m_dynamic_text_list

QList<DynamicElementTextItem *> Element::m_dynamic_text_list
private

◆ m_element_informations

DiagramContext Element::m_element_informations
protected

◆ m_F_str

QString Element::m_F_str
protected

Definition at line 180 of file element.h.

◆ m_freeze_label

bool Element::m_freeze_label = false
protected

Definition at line 179 of file element.h.

Referenced by freezeLabel(), fromXml(), isFreezeLabel(), setUpFormula(), and toXml().

◆ m_kind_informations

DiagramContext Element::m_kind_informations
protected

Definition at line 177 of file element.h.

Referenced by buildFromXml(), fromXml(), and kindInformations().

◆ m_link_type

kind Element::m_link_type = Element::Simple
protected

Definition at line 174 of file element.h.

Referenced by fromXml(), and linkType().

◆ m_location

ElementsLocation Element::m_location
protected

Definition at line 182 of file element.h.

Referenced by buildFromXml(), location(), name(), pixmap(), and toXml().

◆ m_low_zoom_picture

const QPicture Element::m_low_zoom_picture
protected

Definition at line 186 of file element.h.

Referenced by buildFromXml(), and paint().

◆ m_mouse_over

bool Element::m_mouse_over = false
private

Definition at line 192 of file element.h.

Referenced by hoverEnterEvent(), hoverLeaveEvent(), and paint().

◆ m_must_highlight

bool Element::m_must_highlight = false
private

Definition at line 189 of file element.h.

Referenced by paint(), and setHighlighted().

◆ m_names

NamesList Element::m_names
protected

Definition at line 183 of file element.h.

Referenced by buildFromXml(), and name().

◆ m_picture

const QPicture Element::m_picture
protected

Definition at line 185 of file element.h.

Referenced by buildFromXml(), and paint().

◆ m_prefix

QString Element::m_prefix
private

Definition at line 193 of file element.h.

Referenced by fromXml(), getPrefix(), setPrefix(), and toXml().

◆ m_terminals

QList<Terminal *> Element::m_terminals
protected

Definition at line 184 of file element.h.

Referenced by conductors(), parseTerminal(), terminals(), and ~Element().

◆ m_texts_group

QList<ElementTextItemGroup *> Element::m_texts_group
private

◆ m_uuid

QUuid Element::m_uuid
protected

Definition at line 173 of file element.h.

Referenced by Element(), fromXml(), newUuid(), and uuid().

◆ tmp_uuids_link

QList<QUuid> Element::tmp_uuids_link
protected

Definition at line 172 of file element.h.

Referenced by fromXml(), and initLink().


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