QElectroTech
0.70
|
The MasterElement class This class is a custom element, with extended behavior to be a master element. Master element can be linked with slave element and display a cross ref item for know with what other element he is linked. More...
#include <masterelement.h>
Public Member Functions | |
MasterElement (const ElementsLocation &, QGraphicsItem *=nullptr, int *=nullptr) | |
MasterElement::MasterElement Default constructor. More... | |
~MasterElement () override | |
MasterElement::~MasterElement default destructor. More... | |
void | linkToElement (Element *elmt) override |
MasterElement::linkToElement Link this master to another element For this class element must be a slave. More... | |
void | unlinkAllElements () override |
MasterElement::unlinkAllElements Unlink all of the element in the QList connected_elements. More... | |
void | unlinkElement (Element *elmt) override |
MasterElement::unlinkElement Unlink the given elmt in parametre. More... | |
void | initLink (QETProject *project) override |
MasterElement::initLink. More... | |
QRectF | XrefBoundingRect () const |
MasterElement::XrefBoundingRect. More... | |
![]() | |
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::sequentialNumbers & | rSequenceStruct () |
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 |
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 |
ElementTextItemGroup * | addTextGroup (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... | |
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 |
ElementTextItemGroup * | textGroup (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... | |
![]() | |
QetGraphicsItem (QGraphicsItem *parent=nullptr) | |
QetGraphicsItem::QetGraphicsItem Default constructor. More... | |
~QetGraphicsItem () override=0 | |
Diagram * | diagram () 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... | |
Protected Member Functions | |
QVariant | itemChange (GraphicsItemChange change, const QVariant &value) override |
![]() | |
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 |
![]() | |
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... | |
Private Member Functions | |
void | xrefPropertiesChanged () |
void | aboutDeleteXref () |
MasterElement::aboutDeleteXref Check if Xref item must be displayed, if not, delete it. If Xref item is deleted or already not used (nullptr) return true; Else return false if Xref item is used NOTICE : Xref can display nothing but not be deleted so far. For exemple, if Xref is display has cross, only power contact are linked and option show power contact is disable, the cross isn't draw. More... | |
Private Attributes | |
CrossRefItem * | m_Xref_item = nullptr |
bool | m_first_scene_change = true |
The MasterElement class This class is a custom element, with extended behavior to be a master element. Master element can be linked with slave element and display a cross ref item for know with what other element he is linked.
Definition at line 31 of file masterelement.h.
|
explicit |
MasterElement::MasterElement Default constructor.
location | location of xml definition |
qgi | parent QGraphicItem |
s | parent diagram |
state | int used to know if the creation of element have error |
Definition at line 32 of file masterelement.cpp.
|
override |
MasterElement::~MasterElement default destructor.
Definition at line 40 of file masterelement.cpp.
References unlinkAllElements().
|
private |
MasterElement::aboutDeleteXref Check if Xref item must be displayed, if not, delete it. If Xref item is deleted or already not used (nullptr) return true; Else return false if Xref item is used NOTICE : Xref can display nothing but not be deleted so far. For exemple, if Xref is display has cross, only power contact are linked and option show power contact is disable, the cross isn't draw.
Definition at line 162 of file masterelement.cpp.
References XRefProperties::Bottom, CrossRefItem::boundingRect(), QETProject::defaultXRefProperties(), QetGraphicsItem::diagram(), Element::kindInformations(), m_Xref_item, Diagram::project(), and XRefProperties::snapTo().
Referenced by linkToElement(), unlinkElement(), and xrefPropertiesChanged().
|
overridevirtual |
project | Call init Link from custom element and after call update label for setup it. |
Reimplemented from Element.
Definition at line 108 of file masterelement.cpp.
References Element::initLink().
|
overrideprotected |
Definition at line 126 of file masterelement.cpp.
References QetGraphicsItem::diagram(), m_first_scene_change, xrefPropertiesChanged(), and QETProject::XRefPropertiesChanged().
|
overridevirtual |
MasterElement::linkToElement Link this master to another element For this class element must be a slave.
elmt |
Reimplemented from Element.
Definition at line 50 of file masterelement.cpp.
References aboutDeleteXref(), XRefProperties::Bottom, Element::connected_elements, QETProject::defaultXRefProperties(), QetGraphicsItem::diagram(), Element::kindInformations(), Element::linkedElementChanged(), Element::linkToElement(), Element::linkType(), m_Xref_item, Diagram::project(), Element::Slave, and XRefProperties::snapTo().
|
overridevirtual |
MasterElement::unlinkAllElements Unlink all of the element in the QList connected_elements.
Reimplemented from Element.
Definition at line 72 of file masterelement.cpp.
References Element::connected_elements, Element::isFree(), Element::linkedElementChanged(), and unlinkElement().
Referenced by ~MasterElement().
|
overridevirtual |
MasterElement::unlinkElement Unlink the given elmt in parametre.
elmt | element to unlink from this |
Reimplemented from Element.
Definition at line 88 of file masterelement.cpp.
References aboutDeleteXref(), Element::connected_elements, Element::linkedElementChanged(), and Element::setHighlighted().
Referenced by unlinkAllElements().
QRectF MasterElement::XrefBoundingRect | ( | ) | const |
MasterElement::XrefBoundingRect.
Definition at line 118 of file masterelement.cpp.
References CrossRefItem::boundingRect(), and m_Xref_item.
Referenced by ElementTextItemGroup::autoPos().
|
private |
Definition at line 136 of file masterelement.cpp.
References aboutDeleteXref(), XRefProperties::Bottom, QETProject::defaultXRefProperties(), QetGraphicsItem::diagram(), Element::kindInformations(), m_Xref_item, Diagram::project(), and XRefProperties::snapTo().
Referenced by itemChange().
|
private |
Definition at line 54 of file masterelement.h.
Referenced by itemChange().
|
private |
Definition at line 53 of file masterelement.h.
Referenced by aboutDeleteXref(), linkToElement(), XrefBoundingRect(), and xrefPropertiesChanged().