QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
Public Types | Public Slots | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
CrossRefItem Class Reference

The CrossRefItem class This clas provide an item, for show the cross reference, like the contacts linked to a coil. The item setpos automatically when parent move. All slave displayed in cross ref will be updated when folio position change in the project. It's the responsibility of the master element to inform displayed slave are moved, by calling the slot updateLabel 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>

Inherits QGraphicsObject.

Collaboration diagram for CrossRefItem:
Collaboration graph

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 , Other = 128
}
 The CONTACTS enum. More...
 

Public Slots

void updateProperties ()
 CrossRefItem::updateProperties update the current properties.
 
void updateLabel ()
 CrossRefItem::updateLabel Update the content of the item.
 
void autoPos ()
 CrossRefItem::autoPos Calculate and set position automatically.
 

Public Member Functions

 CrossRefItem (Element *elmt)
 CrossRefItem::CrossRefItem.
 
 CrossRefItem (Element *elmt, DynamicElementTextItem *text)
 CrossRefItem::CrossRefItem.
 
 CrossRefItem (Element *elmt, ElementTextItemGroup *group)
 CrossRefItem::CrossRefItem.
 
 ~CrossRefItem () override
 CrossRefItem::~CrossRefItem Default destructor.
 
int type () const override
 
QRectF boundingRect () const override
 CrossRefItem::boundingRect.
 
QPainterPath shape () const override
 CrossRefItem::shape.
 
QString elementPositionText (const Element *elmt, const bool &add_prefix=false) const
 CrossRefItem::elementPositionText.
 

Protected Member Functions

bool sceneEvent (QEvent *event) override
 CrossRefItem::sceneEvent.
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
 CrossRefItem::paint Paint this item.
 
void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override
 CrossRefItem::mouseDoubleClickEvent.
 
void hoverEnterEvent (QGraphicsSceneHoverEvent *event) override
 CrossRefItem::hoverEnterEvent.
 
void hoverMoveEvent (QGraphicsSceneHoverEvent *event) override
 CrossRefItem::hoverMoveEvent.
 
void hoverLeaveEvent (QGraphicsSceneHoverEvent *event) override
 CrossRefItem::hoverLeaveEvent.
 

Private Member Functions

void init ()
 CrossRefItem::init init this Xref.
 
void setUpConnection ()
 CrossRefItem::setUpConnection Set up several connection to keep up to date the Xref.
 
void linkedChanged ()
 CrossRefItem::linkedChanged.
 
void buildHeaderContact ()
 CrossRefItem::buildHeaderContact Draw the QPicture of m_hdr_no_ctc and m_hdr_nc_ctc.
 
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.
 
void drawAsCross (QPainter &painter)
 CrossRefItem::drawAsCross Draw this crossref with a cross.
 
void drawAsContacts (QPainter &painter)
 CrossRefItem::drawAsContacts Draw this crossref with symbolic contacts.
 
QRectF drawContact (QPainter &painter, int flags, Element *elmt)
 CrossRefItem::drawContact Draw one contact, the type of contact to draw is define in flags.
 
void fillCrossRef (QPainter &painter)
 CrossRefItem::fillCrossRef Fill the content of the cross ref.
 
void AddExtraInfo (QPainter &painter, const QString &)
 CrossRefItem::AddExtraInfo Add the comment info of the parent item if needed.
 
QList< Element * > NOElements () const
 CrossRefItem::NOElements.
 
QList< Element * > NCElements () const
 CrossRefItem::NCElements.
 

Private Attributes

Elementm_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
 
QMultiMap< Element *, QRectF > m_hovered_contacts_map
 
Elementm_hovered_contact = nullptr
 
DynamicElementTextItemm_text = nullptr
 
ElementTextItemGroupm_group = nullptr
 
QList< QMetaObject::Connection > m_slave_connection
 
QList< QMetaObject::Connection > m_update_connection
 

Detailed Description

The CrossRefItem class This clas provide an item, for show the cross reference, like the contacts linked to a coil. The item setpos automatically when parent move. All slave displayed in cross ref will be updated when folio position change in the project. It's the responsibility of the master element to inform displayed slave are moved, by calling the slot updateLabel 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.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

◆ CONTACTS

The CONTACTS enum.

Enumerator
NO 
NC 
NOC 
SW 
Power 
DelayOn 
DelayOff 
DelayOnOff 
Delay 
Other 

Constructor & Destructor Documentation

◆ CrossRefItem() [1/3]

CrossRefItem::CrossRefItem ( Element elmt)
explicit

CrossRefItem::CrossRefItem.

Parameters
elmt: element to display the cross ref
Here is the call graph for this function:

◆ CrossRefItem() [2/3]

CrossRefItem::CrossRefItem ( Element elmt,
DynamicElementTextItem text 
)
explicit

CrossRefItem::CrossRefItem.

Parameters
elmt: element to display the cross ref
text: If the Xref must be displayed under a text, the text.
Here is the call graph for this function:

◆ CrossRefItem() [3/3]

CrossRefItem::CrossRefItem ( Element elmt,
ElementTextItemGroup group 
)
explicit

CrossRefItem::CrossRefItem.

Parameters
elmt: element to display the cross ref
group: If the Xref must be displayed under a group, the group.
Here is the call graph for this function:

◆ ~CrossRefItem()

CrossRefItem::~CrossRefItem ( )
override

CrossRefItem::~CrossRefItem Default destructor.

Member Function Documentation

◆ AddExtraInfo()

void CrossRefItem::AddExtraInfo ( QPainter &  painter,
const QString &  type 
)
private

CrossRefItem::AddExtraInfo Add the comment info of the parent item if needed.

Parameters
painterpainter to use for draw the text
typetype of Info do be draw e.g. comment, location.
Here is the call graph for this function:

◆ autoPos

void CrossRefItem::autoPos ( )
slot

CrossRefItem::autoPos Calculate and set position automatically.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ boundingRect()

QRectF CrossRefItem::boundingRect ( ) const
override

CrossRefItem::boundingRect.

Returns
the bounding rect of this item
Here is the caller graph for this function:

◆ buildHeaderContact()

void CrossRefItem::buildHeaderContact ( )
private

CrossRefItem::buildHeaderContact Draw the QPicture of m_hdr_no_ctc and m_hdr_nc_ctc.

Here is the caller graph for this function:

◆ drawAsContacts()

void CrossRefItem::drawAsContacts ( QPainter &  painter)
private

CrossRefItem::drawAsContacts Draw this crossref with symbolic contacts.

Parameters
painterpainter to use
Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawAsCross()

void CrossRefItem::drawAsCross ( QPainter &  painter)
private

CrossRefItem::drawAsCross Draw this crossref with a cross.

Parameters
painterpainter to use
Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawContact()

QRectF CrossRefItem::drawContact ( QPainter &  painter,
int  flags,
Element elmt 
)
private

CrossRefItem::drawContact Draw one contact, the type of contact to draw is define in flags.

Parameters
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)
Returns
The bounding rect of the draw (contact + text)

take example of this code for display the terminal text

Here is the call graph for this function:
Here is the caller graph for this function:

◆ elementPositionText()

QString CrossRefItem::elementPositionText ( const Element elmt,
const bool &  add_prefix = false 
) const

CrossRefItem::elementPositionText.

Parameters
elmt
add_prefix
Returns
the string corresponding to the position of elmt in the diagram. if add_prefix is true, prefix (for power and delay contact) is added to the position text.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fillCrossRef()

void CrossRefItem::fillCrossRef ( QPainter &  painter)
private

CrossRefItem::fillCrossRef Fill the content of the cross ref.

Parameters
painterpainter to use.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hoverEnterEvent()

void CrossRefItem::hoverEnterEvent ( QGraphicsSceneHoverEvent *  event)
overrideprotected

CrossRefItem::hoverEnterEvent.

Parameters
event
Here is the caller graph for this function:

◆ hoverLeaveEvent()

void CrossRefItem::hoverLeaveEvent ( QGraphicsSceneHoverEvent *  event)
overrideprotected

CrossRefItem::hoverLeaveEvent.

Parameters
event
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hoverMoveEvent()

void CrossRefItem::hoverMoveEvent ( QGraphicsSceneHoverEvent *  event)
overrideprotected

CrossRefItem::hoverMoveEvent.

Parameters
event
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

void CrossRefItem::init ( )
private

CrossRefItem::init init this Xref.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ linkedChanged()

void CrossRefItem::linkedChanged ( )
private

CrossRefItem::linkedChanged.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mouseDoubleClickEvent()

void CrossRefItem::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected

CrossRefItem::mouseDoubleClickEvent.

Parameters
event
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NCElements()

QList< Element * > CrossRefItem::NCElements ( ) const
private

CrossRefItem::NCElements.

Returns
The linked elements of m_element which are close or switch contact If linked element is a power contact, xref property is set to not show power contact and this cross item must be drawn as a cross, the element is not appended in the list.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NOElements()

QList< Element * > CrossRefItem::NOElements ( ) const
private

CrossRefItem::NOElements.

Returns
The linked elements of m_element which are open or switch contact. If linked element is a power contact, xref property is set to not show power contact and this cross item must be drawn as a cross, the element is not appended in the list.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ paint()

void CrossRefItem::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget 
)
overrideprotected

CrossRefItem::paint Paint this item.

Parameters
painter
option
widget

◆ sceneEvent()

bool CrossRefItem::sceneEvent ( QEvent *  event)
overrideprotected

CrossRefItem::sceneEvent.

Parameters
event
Returns
Here is the call graph for this function:

◆ setUpConnection()

void CrossRefItem::setUpConnection ( )
private

CrossRefItem::setUpConnection Set up several connection to keep up to date the Xref.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setUpCrossBoundingRect()

void CrossRefItem::setUpCrossBoundingRect ( QPainter &  painter)
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.

Parameters
painter
Here is the call graph for this function:
Here is the caller graph for this function:

◆ shape()

QPainterPath CrossRefItem::shape ( ) const
override

CrossRefItem::shape.

Returns
the shape of this item

◆ type()

int CrossRefItem::type ( ) const
inlineoverride
Here is the caller graph for this function:

◆ updateLabel

void CrossRefItem::updateLabel ( )
slot

CrossRefItem::updateLabel Update the content of the item.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateProperties

void CrossRefItem::updateProperties ( )
slot

CrossRefItem::updateProperties update the current properties.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_bounding_rect

QRectF CrossRefItem::m_bounding_rect
private

◆ m_drawed_contacts

int CrossRefItem::m_drawed_contacts
private

◆ m_drawing

QPicture CrossRefItem::m_drawing
private

◆ m_element

Element* CrossRefItem::m_element
private

◆ m_group

ElementTextItemGroup* CrossRefItem::m_group = nullptr
private

◆ m_hdr_nc_ctc

QPicture CrossRefItem::m_hdr_nc_ctc
private

◆ m_hdr_no_ctc

QPicture CrossRefItem::m_hdr_no_ctc
private

◆ m_hovered_contact

Element* CrossRefItem::m_hovered_contact = nullptr
private

◆ m_hovered_contacts_map

QMultiMap<Element *, QRectF> CrossRefItem::m_hovered_contacts_map
private

◆ m_properties

XRefProperties CrossRefItem::m_properties
private

◆ m_shape_path

QPainterPath CrossRefItem::m_shape_path
private

◆ m_slave_connection

QList<QMetaObject::Connection> CrossRefItem::m_slave_connection
private

◆ m_text

DynamicElementTextItem* CrossRefItem::m_text = nullptr
private

◆ m_update_connection

QList<QMetaObject::Connection> CrossRefItem::m_update_connection
private

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