QElectroTech
0.8-dev
|
#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... | |
QList< QPair< Terminal *, Terminal * > > | AlignedFreeTerminals () const |
Element::AlignedFreeTerminals. More... | |
DiagramContext | elementInformations () const |
virtual void | setElementInformations (DiagramContext dc) |
Element::setElementInformations Set new information for this element. If new information is different of current infotmation emit elementInfoChange. More... | |
DiagramContext | kindInformations () const |
autonum::sequentialNumbers | sequenceStruct () const |
autonum::sequentialNumbers & | rSequenceStruct () |
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... | |
bool | isFreezeLabel () const |
void | freezeNewAddedElement () |
Element::freezeNewAddedElement Freeze this label if needed. More... | |
QString | actualLabel () |
Element::actualLabel Always return the current label to be displayed. This function is usefull when label is based on formula, because label can change at any time. More... | |
QString | name () const override |
Element::name. More... | |
ElementsLocation | location () 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 |
Element::toXml Allows to export the element in XML. More... | |
QUuid | uuid () const |
Element::uuid. More... | |
int | orientation () const |
void | addDynamicTextItem (DynamicElementTextItem *deti=nullptr) |
Element::addDynamiqueTextItem Add deti as a dynamic text item of this element, deti is reparented to this If deti is null, a new DynamicElementTextItem is created and added to this element. More... | |
void | removeDynamicTextItem (DynamicElementTextItem *deti) |
Element::removeDynamicTextItem Remove deti, no matter if is a child of this element or a child of a group of this element. Set he parent item of deti to 0, deti is not deleted. More... | |
QList< DynamicElementTextItem * > | dynamicTextItems () const |
Element::dynamicTextItems. More... | |
ElementTextItemGroup * | addTextGroup (const QString &name) |
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 name will renamed to name1 or name2 etc.... More... | |
void | addTextGroup (ElementTextItemGroup *group) |
Element::addTextGroup. More... | |
void | removeTextGroup (ElementTextItemGroup *group) |
Element::removeTextGroup Remove the text group 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... | |
ElementTextItemGroup * | textGroup (const QString &name) const |
Element::textGroup. More... | |
QList< ElementTextItemGroup * > | textGroups () const |
Element::textGroups. More... | |
bool | addTextToGroup (DynamicElementTextItem *text, ElementTextItemGroup *group) |
Element::addTextToGroup Add the text text to the group group; If group 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 text from the group group, en reparent text to this element. More... | |
bool | isFree () const |
virtual void | linkToElement (Element *) |
virtual void | unlinkAllElements () |
virtual void | unlinkElement (Element *) |
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... | |
QList< Element * > | linkedElements () |
Element::linkedElements. More... | |
virtual kind | linkType () const |
QString | linkTypeToString () const |
void | newUuid () |
void | paint (QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override |
Element::paint. More... | |
QRectF | boundingRect () const override |
Public Member Functions inherited from QetGraphicsItem | |
QetGraphicsItem (QGraphicsItem *parent=nullptr) | |
QetGraphicsItem::QetGraphicsItem Default constructor. More... | |
~QetGraphicsItem () override=0 | |
Diagram * | diagram () const |
virtual void | setPos (const QPointF &p) |
virtual void | setPos (qreal x, qreal y) |
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... | |
void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) override |
Element::mouseMoveEvent. More... | |
void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override |
Element::mouseReleaseEvent. More... | |
void | hoverEnterEvent (QGraphicsSceneHoverEvent *) override |
void | hoverLeaveEvent (QGraphicsSceneHoverEvent *) override |
Protected Member Functions inherited from QetGraphicsItem | |
void | mousePressEvent (QGraphicsSceneMouseEvent *event) override |
void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override |
void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) override |
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... | |
DynamicElementTextItem * | parseDynamicText (const QDomElement &dom_element) |
Element::parseDynamicText Create the dynamic text field describ in dom_element. More... | |
Terminal * | parseTerminal (const QDomElement &dom_element) |
Element::parseTerminal Parse partTerminal from xml structure. More... | |
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 |
This is the base class for electrical elements.
anonymous enum |
Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into an Element.
Enumerator | |
---|---|
Type |
enum Element::kind |
Element::Element | ( | const ElementsLocation & | location, |
QGraphicsItem * | parent = nullptr , |
||
int * | state = nullptr , |
||
Element::kind | link_type = Element::Simple |
||
) |
location | : location of this element |
parent | : parent graphics item |
state | : state of the instanciation |
link_type |
|
override |
|
private |
QString Element::actualLabel | ( | ) |
Element::actualLabel Always return the current label to be displayed. This function is usefull when label is based on formula, because label can change at any time.
void Element::addDynamicTextItem | ( | DynamicElementTextItem * | deti = nullptr | ) |
Element::addDynamiqueTextItem Add deti as a dynamic text item of this element, deti is reparented to this If deti is null, a new DynamicElementTextItem is created and added to this element.
deti |
ElementTextItemGroup * Element::addTextGroup | ( | const QString & | name | ) |
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 name will renamed to name1 or name2 etc....
name | : the name of the group |
void Element::addTextGroup | ( | ElementTextItemGroup * | group | ) |
group | add group to the group of this element. the group must not be owned by an element. |
bool Element::addTextToGroup | ( | DynamicElementTextItem * | text, |
ElementTextItemGroup * | group | ||
) |
Element::addTextToGroup Add the text text to the group group; If group isn't owned by this element return false. The text must be a text of this element.
Element::AlignedFreeTerminals.
|
override |
|
private |
Element::buildFromXml Build this element from an xml description.
xml_def_elmt | |
state | Optional 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 |
QList< Conductor * > Element::conductors | ( | ) | const |
void Element::displayHelpLine | ( | bool | b = true | ) |
Element::displayHelpLine Display the help line of each terminal if b is true.
b |
|
protected |
Dessine un petit repere (axes x et y) relatif a l'element
painter | Le QPainter a utiliser pour dessiner les axes |
options | Les options de style a prendre en compte |
|
private |
Dessine le cadre de selection de l'element de maniere systematiquement non antialiasee.
painter | Le QPainter a utiliser pour dessiner les bornes. |
options | Les options de style a prendre en compte |
|
private |
Dessine le cadre de selection de l'element de maniere systematiquement non antialiasee.
painter | Le QPainter a utiliser pour dessiner les bornes. |
options | Les options de style a prendre en compte |
QList< DynamicElementTextItem * > Element::dynamicTextItems | ( | ) | const |
|
overridevirtual |
|
signal |
|
inline |
void Element::freezeLabel | ( | bool | freeze | ) |
void Element::freezeNewAddedElement | ( | ) |
Element::freezeNewAddedElement Freeze this label if needed.
|
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.
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 |
QString Element::getPrefix | ( | ) | const |
QPoint Element::hotspot | ( | ) | const |
|
overrideprotected |
When mouse over element change m_mouse_over to true (used in paint() function ) Also highlight linked elements
e | QGraphicsSceneHoverEvent |
|
overrideprotected |
When mouse over element leave the position change m_mouse_over to false(used in paint() function ) Also un-highlight linked elements
e | QGraphicsSceneHoverEvent |
|
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.
prj | : ownership project of this element and other element to be linked |
Reimplemented in MasterElement, SimpleElement, and TerminalElement.
|
inline |
|
inline |
|
inline |
|
signal |
|
inline |
|
inlinevirtual |
Reimplemented in MasterElement, SlaveElement, and ReportElement.
|
inlinevirtual |
QString Element::linkTypeToString | ( | ) | const |
ElementsLocation Element::location | ( | ) | const |
|
overrideprotected |
|
overrideprotected |
|
overridevirtual |
Reimplemented from QetGraphicsItem.
|
inline |
|
inline |
Indicate the current orientation of this element O = 0° 1 = 90° 2 = 180° 3 = 270°
|
override |
|
private |
Element::parseDynamicText Create the dynamic text field describ in dom_element.
dom_element |
|
private |
Element::parseElement Parse the element of the xml description of this element.
dom |
|
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.
dom_element |
|
private |
Element::parseTerminal Parse partTerminal from xml structure.
dom_element |
QPixmap Element::pixmap | ( | ) |
void Element::removeDynamicTextItem | ( | DynamicElementTextItem * | deti | ) |
Element::removeDynamicTextItem Remove deti, no matter if is a child of this element or a child of a group of this element. Set he parent item of deti to 0, deti is not deleted.
deti |
bool Element::removeTextFromGroup | ( | DynamicElementTextItem * | text, |
ElementTextItemGroup * | group | ||
) |
Element::removeTextFromGroup Remove the text text from the group group, en reparent text to this element.
void Element::removeTextGroup | ( | ElementTextItemGroup * | group | ) |
Element::removeTextGroup Remove the text group 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.
group |
|
inline |
|
inline |
|
virtual |
Element::setElementInformations Set new information for this element. If new information is different of current infotmation emit elementInfoChange.
dc |
|
virtual |
hl | true pour mettre l'element en evidence, false sinon |
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
hs | Coordonnees du hotspot |
void Element::setPrefix | ( | QString | prefix | ) |
|
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.
wid | |
hei |
void Element::setUpFormula | ( | bool | code_letter = true | ) |
Element::setUpFormula Set up the formula used to create the label of this element.
code_letter | : Q_UNUSED(code_letter) if true set tagged text to code letter (ex K for coil) with condition : formula is empty, text tagged "label" is emptty or "_"; |
QSize Element::size | ( | ) | const |
QList< Terminal * > Element::terminals | ( | ) | const |
|
signal |
|
signal |
ElementTextItemGroup * Element::textGroup | ( | const QString & | name | ) | const |
name |
QList< ElementTextItemGroup * > Element::textGroups | ( | ) | const |
|
signal |
|
signal |
|
signal |
|
signal |
|
virtual |
Element::toXml Allows to export the element in XML.
document | : XML document to use |
table_adr_id | : Correspondence table between the addresses of the terminals and their id in the XML representation; this table completed by this method |
|
inlineoverride |
|
inlinevirtual |
Reimplemented in MasterElement, ReportElement, and SlaveElement.
|
inlinevirtual |
Reimplemented in MasterElement, ReportElement, and SlaveElement.
|
inline |
|
static |
Permet de savoir si un element XML (QDomElement) represente bien un element
e | Le QDomElement a valide |
|
friend |
|
protected |
|
private |
|
private |
|
protected |
|
protected |
|
private |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
private |
|
private |
|
protected |
|
protected |
|
private |
|
protected |
|
private |
|
protected |
|
protected |