QElectroTech
0.70
|
The CrossRefItem class This clas provide an item, for show the cross reference, like the contacts linked to a coil. The item setpos automaticaly when parent move. All slave displayed in cross ref will be updated when folio position change in the project. It's the responsability of the master element to informe displayed slave are moved, by calling the slot By default master element is the parent graphics item of this Xref, but if the Xref must be snap to the label of master, the label become the parent of this Xref. This behavior can be changed at anytime by calling setProperties. More...
#include <crossrefitem.h>
Public Types | |
enum | { Type = UserType + 1009 } |
enum | CONTACTS { NO = 1, NC = 2, NOC = 3, SW = 4, Power = 8, DelayOn = 16, DelayOff = 32, DelayOnOff = 64, Delay = 112 } |
Public Slots | |
void | updateProperties () |
CrossRefItem::updateProperties update the curent properties. More... | |
void | updateLabel () |
CrossRefItem::updateLabel Update the content of the item. More... | |
void | autoPos () |
CrossRefItem::autoPos Calculate and set position automaticaly. More... | |
Public Member Functions | |
CrossRefItem (Element *elmt) | |
CrossRefItem::CrossRefItem. More... | |
CrossRefItem (Element *elmt, DynamicElementTextItem *text) | |
CrossRefItem::CrossRefItem. More... | |
CrossRefItem (Element *elmt, ElementTextItemGroup *group) | |
CrossRefItem::CrossRefItem. More... | |
~CrossRefItem () override | |
CrossRefItem::~CrossRefItem Default destructor. More... | |
int | type () const override |
QRectF | boundingRect () const override |
CrossRefItem::boundingRect. More... | |
QPainterPath | shape () const override |
CrossRefItem::shape. More... | |
QString | elementPositionText (const Element *elmt, const bool &add_prefix=false) const |
CrossRefItem::elementPositionText. More... | |
Protected Member Functions | |
bool | sceneEvent (QEvent *event) override |
void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override |
CrossRefItem::paint Paint this item. More... | |
void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override |
CrossRefItem::mouseDoubleClickEvent. More... | |
void | hoverEnterEvent (QGraphicsSceneHoverEvent *event) override |
void | hoverMoveEvent (QGraphicsSceneHoverEvent *event) override |
void | hoverLeaveEvent (QGraphicsSceneHoverEvent *event) override |
Private Member Functions | |
void | init () |
CrossRefItem::init init this Xref. More... | |
void | setUpConnection () |
CrossRefItem::setUpConnection Set up several connection to keep up to date the Xref. More... | |
void | linkedChanged () |
void | buildHeaderContact () |
CrossRefItem::buildHeaderContact Draw the QPicture of m_hdr_no_ctc and m_hdr_nc_ctc. More... | |
void | setUpCrossBoundingRect (QPainter &painter) |
CrossRefItem::setUpCrossBoundingRect Get the numbers of slaves elements linked to this parent element, for calculate the size of the cross bounding rect. The cross ref item is drawing according to the size of the cross bounding rect. More... | |
void | drawAsCross (QPainter &painter) |
CrossRefItem::drawAsCross Draw this crossref with a cross. More... | |
void | drawAsContacts (QPainter &painter) |
CrossRefItem::drawAsContacts Draw this crossref with symbolic contacts. More... | |
QRectF | drawContact (QPainter &painter, int flags, Element *elmt) |
CrossRefItem::drawContact Draw one contact, the type of contact to draw is define in . More... | |
void | fillCrossRef (QPainter &painter) |
CrossRefItem::fillCrossRef Fill the content of the cross ref. More... | |
void | AddExtraInfo (QPainter &painter, const QString &) |
CrossRefItem::AddExtraInfo Add the comment info of the parent item if needed. More... | |
QList< Element * > | NOElements () const |
CrossRefItem::NOElements. More... | |
QList< Element * > | NCElements () const |
CrossRefItem::NCElements. More... | |
Private Attributes | |
Element * | m_element |
QRectF | m_bounding_rect |
QPicture | m_drawing |
QPicture | m_hdr_no_ctc |
QPicture | m_hdr_nc_ctc |
QPainterPath | m_shape_path |
XRefProperties | m_properties |
int | m_drawed_contacts |
QMap< Element *, QRectF > | m_hovered_contacts_map |
Element * | m_hovered_contact = nullptr |
DynamicElementTextItem * | m_text = nullptr |
ElementTextItemGroup * | m_group = nullptr |
QList< QMetaObject::Connection > | m_slave_connection |
QList< QMetaObject::Connection > | m_update_connection |
The CrossRefItem class This clas provide an item, for show the cross reference, like the contacts linked to a coil. The item setpos automaticaly when parent move. All slave displayed in cross ref will be updated when folio position change in the project. It's the responsability of the master element to informe displayed slave are moved, by calling the slot By default master element is the parent graphics item of this Xref, but if the Xref must be snap to the label of master, the label become the parent of this Xref. This behavior can be changed at anytime by calling setProperties.
Definition at line 40 of file crossrefitem.h.
anonymous enum |
Enumerator | |
---|---|
Type |
Definition at line 55 of file crossrefitem.h.
Enumerator | |
---|---|
NO | |
NC | |
NOC | |
SW | |
Power | |
DelayOn | |
DelayOff | |
DelayOnOff | |
Delay |
Definition at line 58 of file crossrefitem.h.
|
explicit |
elmt | : element to display the cross ref |
Definition at line 37 of file crossrefitem.cpp.
References init().
|
explicit |
elmt | : element to display the cross ref |
text | : If the Xref must be displayed under a text, the text. |
Definition at line 47 of file crossrefitem.cpp.
References init().
|
explicit |
elmt | : element to display the cross ref |
group | : If the Xref must be displayed under a group, the group. |
Definition at line 58 of file crossrefitem.cpp.
References init().
|
override |
CrossRefItem::~CrossRefItem Default destructor.
Definition at line 68 of file crossrefitem.cpp.
|
private |
CrossRefItem::AddExtraInfo Add the comment info of the parent item if needed.
painter | painter to use for draw the text |
type | type of Info do be draw e.g. comment, location. |
Definition at line 821 of file crossrefitem.cpp.
References boundingRect(), QetGraphicsItem::diagram(), QETApp::diagramTextsFont(), autonum::AssignVariables::formulaToLabel(), m_bounding_rect, m_element, m_shape_path, Element::rSequenceStruct(), and type().
|
slot |
CrossRefItem::autoPos Calculate and set position automaticaly.
Definition at line 227 of file crossrefitem.cpp.
References XRefProperties::Bottom, centerToBottomDiagram(), centerToParentBottom(), m_element, m_properties, XRefProperties::offset(), and XRefProperties::snapTo().
Referenced by DynamicElementTextItem::setPlainText(), setUpConnection(), ElementTextItemGroup::updateAlignment(), updateLabel(), and ElementTextItemGroup::updateXref().
|
override |
Definition at line 129 of file crossrefitem.cpp.
References m_bounding_rect.
Referenced by MasterElement::aboutDeleteXref(), AddExtraInfo(), drawAsCross(), and MasterElement::XrefBoundingRect().
|
private |
CrossRefItem::buildHeaderContact Draw the QPicture of m_hdr_no_ctc and m_hdr_nc_ctc.
Definition at line 393 of file crossrefitem.cpp.
References m_hdr_nc_ctc, and m_hdr_no_ctc.
Referenced by drawAsCross().
|
private |
CrossRefItem::drawAsContacts Draw this crossref with symbolic contacts.
painter | painter to use |
Definition at line 528 of file crossrefitem.cpp.
References QET::Icons::br, DelayOff, DelayOn, DelayOnOff, drawContact(), Element::kindInformations(), Element::linkedElements(), m_bounding_rect, m_drawed_contacts, m_element, m_hovered_contacts_map, m_shape_path, NC, NO, Power, SW, and type().
Referenced by updateLabel().
|
private |
CrossRefItem::drawAsCross Draw this crossref with a cross.
painter,painter | to use |
Definition at line 498 of file crossrefitem.cpp.
References boundingRect(), QET::Icons::br, buildHeaderContact(), fillCrossRef(), header, m_bounding_rect, m_hdr_nc_ctc, m_hdr_no_ctc, m_hovered_contacts_map, and setUpCrossBoundingRect().
Referenced by updateLabel().
|
private |
CrossRefItem::drawContact Draw one contact, the type of contact to draw is define in .
painter,painter | to use |
flags,define | how to draw the contact (see enul CONTACTS) |
elmt,the | element to display text (the position of the contact) |
take exemple of this code for display the terminal text
Definition at line 576 of file crossrefitem.cpp.
References Delay, DelayOff, DelayOn, DelayOnOff, elementPositionText(), m_drawed_contacts, m_hovered_contact, m_hovered_contacts_map, NC, NO, NOC, Power, and SW.
Referenced by drawAsContacts().
QString CrossRefItem::elementPositionText | ( | const Element * | elmt, |
const bool & | add_prefix = false |
||
) | const |
CrossRefItem::elementPositionText.
elmt |
Definition at line 147 of file crossrefitem.cpp.
References DiagramContext::contains(), QETProject::defaultXRefProperties(), QetGraphicsItem::diagram(), autonum::AssignVariables::formulaToLabel(), Element::kindInformations(), m_element, m_properties, XRefProperties::masterLabel(), XRefProperties::prefix(), and Diagram::project().
Referenced by drawContact(), fillCrossRef(), and setUpCrossBoundingRect().
|
private |
CrossRefItem::fillCrossRef Fill the content of the cross ref.
painter | painter to use. |
Definition at line 760 of file crossrefitem.cpp.
References elementPositionText(), header, Element::isFree(), m_bounding_rect, m_element, m_hovered_contact, m_hovered_contacts_map, NCElements(), and NOElements().
Referenced by drawAsCross().
|
overrideprotected |
Definition at line 303 of file crossrefitem.cpp.
References m_hovered_contact.
Referenced by sceneEvent().
|
overrideprotected |
Definition at line 363 of file crossrefitem.cpp.
References m_hovered_contact, and updateLabel().
Referenced by sceneEvent().
|
overrideprotected |
Definition at line 309 of file crossrefitem.cpp.
References m_hovered_contact, m_hovered_contacts_map, and updateLabel().
Referenced by sceneEvent().
|
private |
CrossRefItem::init init this Xref.
Definition at line 74 of file crossrefitem.cpp.
References QETProject::defaultXRefProperties(), QetGraphicsItem::diagram(), Element::kindInformations(), linkedChanged(), m_element, m_properties, Diagram::project(), setUpConnection(), updateLabel(), updateProperties(), and QETProject::XRefPropertiesChanged().
Referenced by CrossRefItem().
|
private |
Definition at line 370 of file crossrefitem.cpp.
References Element::linkedElements(), m_element, m_slave_connection, and updateLabel().
Referenced by init(), and setUpConnection().
|
overrideprotected |
CrossRefItem::mouseDoubleClickEvent.
event |
Definition at line 281 of file crossrefitem.cpp.
References QetGraphicsItem::diagram(), m_hovered_contact, and Diagram::showMe().
Referenced by sceneEvent().
|
private |
Definition at line 887 of file crossrefitem.cpp.
References XRefProperties::Cross, XRefProperties::displayHas(), Element::kindInformations(), Element::linkedElements(), m_element, m_properties, and XRefProperties::showPowerContact().
Referenced by fillCrossRef(), and setUpCrossBoundingRect().
|
private |
Definition at line 857 of file crossrefitem.cpp.
References XRefProperties::Cross, XRefProperties::displayHas(), Element::kindInformations(), Element::linkedElements(), m_element, m_properties, and XRefProperties::showPowerContact().
Referenced by fillCrossRef(), and setUpCrossBoundingRect().
|
overrideprotected |
CrossRefItem::paint Paint this item.
painter | |
option | |
widget |
Definition at line 271 of file crossrefitem.cpp.
References m_drawing.
|
overrideprotected |
Definition at line 235 of file crossrefitem.cpp.
References hoverEnterEvent(), hoverLeaveEvent(), hoverMoveEvent(), m_group, and mouseDoubleClickEvent().
|
private |
CrossRefItem::setUpConnection Set up several connection to keep up to date the Xref.
Definition at line 97 of file crossrefitem.cpp.
References autoPos(), XRefProperties::Bottom, QetGraphicsItem::diagram(), QETProject::diagramRemoved(), XRefProperties::Label, linkedChanged(), Element::linkedElementChanged(), m_element, m_group, m_properties, m_text, m_update_connection, Diagram::project(), QETProject::projectDiagramsOrderChanged(), XRefProperties::snapTo(), and updateLabel().
Referenced by init(), and updateProperties().
|
private |
CrossRefItem::setUpCrossBoundingRect Get the numbers of slaves elements linked to this parent element, for calculate the size of the cross bounding rect. The cross ref item is drawing according to the size of the cross bounding rect.
Definition at line 441 of file crossrefitem.cpp.
References cross_min_heigth, elementPositionText(), header, Element::isFree(), m_bounding_rect, m_element, m_shape_path, NCElements(), and NOElements().
Referenced by drawAsCross().
|
override |
Definition at line 137 of file crossrefitem.cpp.
References m_shape_path.
|
inlineoverride |
Definition at line 56 of file crossrefitem.h.
References Type.
Referenced by AddExtraInfo(), and drawAsContacts().
|
slot |
CrossRefItem::updateLabel Update the content of the item.
Definition at line 189 of file crossrefitem.cpp.
References autoPos(), XRefProperties::Contacts, XRefProperties::Cross, QETApp::diagramTextsFont(), XRefProperties::displayHas(), drawAsContacts(), drawAsCross(), Element::linkedElements(), m_bounding_rect, m_drawing, m_element, m_properties, and m_shape_path.
Referenced by hoverLeaveEvent(), hoverMoveEvent(), init(), linkedChanged(), setUpConnection(), and updateProperties().
|
slot |
CrossRefItem::updateProperties update the curent properties.
Definition at line 167 of file crossrefitem.cpp.
References XRefProperties::Bottom, QETProject::defaultXRefProperties(), QetGraphicsItem::diagram(), Element::kindInformations(), XRefProperties::Label, m_element, m_group, m_properties, m_text, Diagram::project(), setUpConnection(), XRefProperties::snapTo(), and updateLabel().
Referenced by init().
|
private |
Definition at line 102 of file crossrefitem.h.
Referenced by AddExtraInfo(), boundingRect(), drawAsContacts(), drawAsCross(), fillCrossRef(), setUpCrossBoundingRect(), and updateLabel().
|
private |
Definition at line 106 of file crossrefitem.h.
Referenced by drawAsContacts(), and drawContact().
|
private |
Definition at line 103 of file crossrefitem.h.
Referenced by paint(), and updateLabel().
|
private |
Definition at line 101 of file crossrefitem.h.
Referenced by AddExtraInfo(), autoPos(), drawAsContacts(), elementPositionText(), fillCrossRef(), init(), linkedChanged(), NCElements(), NOElements(), setUpConnection(), setUpCrossBoundingRect(), updateLabel(), and updateProperties().
|
private |
Definition at line 110 of file crossrefitem.h.
Referenced by sceneEvent(), setUpConnection(), and updateProperties().
|
private |
Definition at line 103 of file crossrefitem.h.
Referenced by buildHeaderContact(), and drawAsCross().
|
private |
Definition at line 103 of file crossrefitem.h.
Referenced by buildHeaderContact(), and drawAsCross().
|
private |
Definition at line 108 of file crossrefitem.h.
Referenced by drawContact(), fillCrossRef(), hoverEnterEvent(), hoverLeaveEvent(), hoverMoveEvent(), and mouseDoubleClickEvent().
|
private |
Definition at line 107 of file crossrefitem.h.
Referenced by drawAsContacts(), drawAsCross(), drawContact(), fillCrossRef(), and hoverMoveEvent().
|
private |
Definition at line 105 of file crossrefitem.h.
Referenced by autoPos(), elementPositionText(), init(), NCElements(), NOElements(), setUpConnection(), updateLabel(), and updateProperties().
|
private |
Definition at line 104 of file crossrefitem.h.
Referenced by AddExtraInfo(), drawAsContacts(), setUpCrossBoundingRect(), shape(), and updateLabel().
|
private |
Definition at line 111 of file crossrefitem.h.
Referenced by linkedChanged().
|
private |
Definition at line 109 of file crossrefitem.h.
Referenced by setUpConnection(), and updateProperties().
|
private |
Definition at line 112 of file crossrefitem.h.
Referenced by setUpConnection().