The Terminal class This class represents a terminal of an electrical element, i.e. a possible plug point for conductors. This class handles all mouse events for connecting conductors.
More...
#include <terminal.h>
Inherits QGraphicsObject.
|
| enum | { Type = UserType + 1002
} |
|
| QPointF | dock_elmt_ |
| | docking point for parent element
|
|
| static const qreal | terminalSize = 4.0 |
| static const qreal | Z = 1000 |
| static QColor | neutralColor = QColor(Qt::blue) |
| | default color
|
| static QColor | allowedColor = QColor(Qt::darkGreen) |
| | color for legal actions
|
| static QColor | warningColor = QColor("#ff8000") |
| | color for allowed but fuzzy or not recommended actions
|
| static QColor | forbiddenColor = QColor(Qt::red) |
| | color for forbidden actions
|
The Terminal class This class represents a terminal of an electrical element, i.e. a possible plug point for conductors. This class handles all mouse events for connecting conductors.
◆ anonymous enum
◆ Terminal() [1/2]
◆ ~Terminal()
◆ Terminal() [2/2]
◆ addConductor()
| bool Terminal::addConductor |
( |
Conductor * | conductor | ) |
|
Terminal::addConductor Add a conductor to this terminal.
- Parameters
-
| conductor | : the conductor to add. |
- Returns
- true if the conductor was successfully added
◆ alignedWithTerminal()
| Terminal * Terminal::alignedWithTerminal |
( |
| ) |
const |
Terminal::alignedWithTerminal If this terminal is aligned with an other terminal and is orientation is opposed return the other terminal else return nullptr.
- Returns
◆ baseName()
| QString Terminal::baseName |
( |
| ) |
const |
Terminal::baseName Return the original terminal name (T1, T2...) without master label override. Used for sorting when linking.
◆ boundingRect()
| QRectF Terminal::boundingRect |
( |
| ) |
const |
|
override |
◆ canBeLinkedTo()
| bool Terminal::canBeLinkedTo |
( |
Terminal * | other_terminal | ) |
|
Terminal::canBeLinkedTo Checking if the terminal can be linked to other_terminal or not Reasons for not linable:
other_terminal is this terminal
- this terminal is already connected to
other_terminal - Parameters
-
- Returns
- true if this terminal can be linked to other_terminal, otherwise false
◆ conductors()
| QList< Conductor * > Terminal::conductors |
( |
| ) |
const |
◆ conductorsCount()
| int Terminal::conductorsCount |
( |
| ) |
const |
|
inline |
◆ conductorWasAdded
| void Terminal::conductorWasAdded |
( |
Conductor * | conductor | ) |
|
|
signal |
◆ conductorWasRemoved
| void Terminal::conductorWasRemoved |
( |
Conductor * | conductor | ) |
|
|
signal |
◆ diagram()
| Diagram * Terminal::diagram |
( |
| ) |
const |
◆ dockConductor()
| QPointF Terminal::dockConductor |
( |
| ) |
const |
◆ drawHelpLine()
| void Terminal::drawHelpLine |
( |
bool | draw = true | ) |
|
◆ fromXml()
| bool Terminal::fromXml |
( |
QDomElement & | terminal | ) |
|
Terminal::fromXml Enables you to find out whether an XML element represents this terminal. Warning, the XML element is not checked Permet de savoir si un element XML represente cette borne. Attention, l'element XML n'est pas verifie.
- Parameters
-
| terminal | Le QDomElement a analyser / QDomElement to check |
- Returns
- true si la borne "se reconnait" (memes coordonnes, meme orientation), false sinon true, if the terminal ‘recognises’ itself (same coordinates, same orientation), false otherwise
◆ HelpLine()
| QLineF Terminal::HelpLine |
( |
| ) |
const |
Terminal::HelpLine.
- Returns
- a line with coordinate P1 the dock point of conductor and P2 the border of diagram, according to the orientation of terminal The line is in scene coordinate;
◆ hoverEnterEvent()
| void Terminal::hoverEnterEvent |
( |
QGraphicsSceneHoverEvent * | | ) |
|
|
overrideprotected |
◆ hoverLeaveEvent()
| void Terminal::hoverLeaveEvent |
( |
QGraphicsSceneHoverEvent * | | ) |
|
|
overrideprotected |
◆ hoverMoveEvent()
| void Terminal::hoverMoveEvent |
( |
QGraphicsSceneHoverEvent * | | ) |
|
|
overrideprotected |
◆ init() [1/2]
Terminal::init Methode privee pour initialiser la borne. Private method to initialize the terminal.
- Parameters
-
| number | of terminal |
| name | of terminal |
| hiddenName | |
◆ init() [2/2]
◆ isLinkedTo()
| bool Terminal::isLinkedTo |
( |
Terminal * | other_terminal | ) |
|
Terminal::isLinkedTo.
- Parameters
-
| other_terminal | Autre borne |
- Returns
- true si cette borne est reliee a other_terminal, false sion
◆ masterLabelIndex()
| int Terminal::masterLabelIndex |
( |
| ) |
const |
|
inline |
◆ mouseMoveEvent()
| void Terminal::mouseMoveEvent |
( |
QGraphicsSceneMouseEvent * | e | ) |
|
|
overrideprotected |
◆ mousePressEvent()
| void Terminal::mousePressEvent |
( |
QGraphicsSceneMouseEvent * | e | ) |
|
|
overrideprotected |
Terminal::mousePressEvent Gere le fait qu'on enfonce un bouton de la souris sur la Borne.
- Parameters
-
| e | L'evenement souris correspondant |
◆ mouseReleaseEvent()
| void Terminal::mouseReleaseEvent |
( |
QGraphicsSceneMouseEvent * | e | ) |
|
|
overrideprotected |
◆ name()
| QString Terminal::name |
( |
| ) |
const |
◆ orientation()
Permet de connaitre l'orientation de la borne. Si le parent de la borne est bien un Element, cette fonction renvoie l'orientation par rapport a la scene de la borne, en tenant compte du fait que l'element ait pu etre pivote. Sinon elle renvoie son sens normal. Used to find out the orientation of the terminal. If the terminal's parent is in fact an Element, this function returns the orientation of the terminal with respect to the scene, taking into account the angle of rotation. scene, taking into account the fact that the element may have been rotated. Otherwise it returns its normal direction.
- Returns
- L'orientation actuelle de la Terminal.
◆ paint()
| void Terminal::paint |
( |
QPainter * | painter, |
|
|
const QStyleOptionGraphicsItem * | options, |
|
|
QWidget * | ) |
|
override |
Terminal::paint Fonction de dessin des bornes.
- Parameters
-
| painter | Le QPainter a utiliser |
| options | Les options de dessin |
◆ parentElement()
| Element * Terminal::parentElement |
( |
| ) |
const |
◆ removeConductor()
| void Terminal::removeConductor |
( |
Conductor * | conductor | ) |
|
◆ setMasterLabelIndex()
| void Terminal::setMasterLabelIndex |
( |
int | index | ) |
|
◆ setUseMasterLabel()
| void Terminal::setUseMasterLabel |
( |
bool | use | ) |
|
Terminal::setUseMasterLabel Set whether this terminal uses a label from the master's contact group.
- Parameters
-
| use | true to use master label |
◆ stableUuid()
| QUuid Terminal::stableUuid |
( |
| ) |
const |
Terminal::stableUuid An identity for this terminal that exists on every element, not only on those saved by a uuid-aware element editor.
uuid() comes from the catalog .elmt definition and is empty for every element authored before that field existed – which is most of the installed base. Anything keyed on uuid() alone therefore cannot see those elements at all.
When there is no uuid, derive one from the terminal's local position and orientation inside its element. That is not an arbitrary choice: it is the same thing the project format itself uses to match a conductor back to a terminal ("each connection is made by using the local position of the
terminal and a dynamic id" – TerminalData::m_uuid). m_pos is the position read from the definition and is not touched by moving the element on the folio, so the result is stable across loads, saves and folio moves, and it is unique within an element except where a definition genuinely declares two terminals at the same point – three cases in the whole example corpus, and harmless, because two terminals sharing a position and orientation are indistinguishable in every observable respect: they merge to one terminal row and every conductor on either of them still resolves to the right element and name.
Derived values are UUID v5 in a fixed namespace, so they are reproducible without being written to the file, and cannot collide with the v4 uuids the element editor generates.
- Returns
- the terminal's own uuid when it has one, otherwise a derived one
◆ terminalType()
◆ toXml()
| QDomElement Terminal::toXml |
( |
QDomDocument & | doc | ) |
const |
Terminal::toXml Methode d'export en XML.
- Parameters
-
| doc | Le Document XML a utiliser pour creer l'element XML |
- Returns
- un QDomElement representant cette borne
◆ type()
| int Terminal::type |
( |
| ) |
const |
|
inlineoverride |
type Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a Terminal
- Returns
- the QGraphicsItem type
◆ updateConductor()
| void Terminal::updateConductor |
( |
| ) |
|
◆ useMasterLabel()
| bool Terminal::useMasterLabel |
( |
| ) |
const |
|
inline |
◆ uuid()
| QUuid Terminal::uuid |
( |
| ) |
const |
◆ valideXml()
| bool Terminal::valideXml |
( |
QDomElement & | terminal | ) |
|
|
static |
Terminal::valideXml Permet de savoir si un element XML represente une borne.
- Parameters
-
| terminal | Le QDomElement a analyser |
- Returns
- true si le QDomElement passe en parametre est une borne, false sinon
◆ allowedColor
| QColor Terminal::allowedColor = QColor(Qt::darkGreen) |
|
static |
◆ dock_elmt_
| QPointF Terminal::dock_elmt_ |
docking point for parent element
◆ forbiddenColor
| QColor Terminal::forbiddenColor = QColor(Qt::red) |
|
static |
color for forbidden actions
◆ m_br
◆ m_conductors_list
| QList<Conductor *> Terminal::m_conductors_list |
|
private |
List of conductors attached to the terminal.
◆ m_draw_help_line
| bool Terminal::m_draw_help_line {false} |
|
private |
◆ m_help_line
| QGraphicsLineItem* Terminal::m_help_line {nullptr} |
|
private |
◆ m_help_line_a
| QGraphicsLineItem* Terminal::m_help_line_a {nullptr} |
|
private |
◆ m_hovered
| bool Terminal::m_hovered = false |
|
private |
Whether the mouse pointer is hovering the terminal.
◆ m_hovered_color
Color used for the hover effect.
◆ m_previous_terminal
| Terminal* Terminal::m_previous_terminal = nullptr |
|
private |
Last terminal seen through an attached conductor.
◆ neutralColor
| QColor Terminal::neutralColor = QColor(Qt::blue) |
|
static |
◆ parent_element_
| Element* Terminal::parent_element_ {nullptr} |
|
private |
Parent electrical element.
◆ terminalSize
| const qreal Terminal::terminalSize = 4.0 |
|
static |
◆ warningColor
| QColor Terminal::warningColor = QColor("#ff8000") |
|
static |
color for allowed but fuzzy or not recommended actions
| const qreal Terminal::Z = 1000 |
|
static |
The documentation for this class was generated from the following files: