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
} |
|
|
| Terminal (QPointF, Qet::Orientation, Element *=nullptr) |
|
| Terminal (qreal, qreal, Qet::Orientation, Element *=nullptr) |
|
| Terminal (TerminalData *data, Element *e=nullptr) |
|
| Terminal (QPointF, Qet::Orientation, QString number, QString name, bool hiddenName, Element *=nullptr) |
|
| ~Terminal () override |
|
int | type () const override |
| type Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a Terminal More...
|
|
void | paint (QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override |
| Terminal::paint Fonction de dessin des bornes. More...
|
|
void | drawHelpLine (bool draw=true) |
| Terminal::drawHelpLine. More...
|
|
QLineF | HelpLine () const |
| Terminal::HelpLine. More...
|
|
QRectF | boundingRect () const override |
| Terminal::boundingRect. More...
|
|
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. More...
|
|
bool | addConductor (Conductor *conductor) |
| Terminal::addConductor Add a conductor to this terminal. More...
|
|
void | removeConductor (Conductor *conductor) |
| Terminal::removeConductor Remove a conductor from this terminal. More...
|
|
int | conductorsCount () const |
| Terminal::conductorsCount. More...
|
|
Diagram * | diagram () const |
| Terminal::diagram. More...
|
|
Element * | parentElement () const |
| Terminal::parentElement. More...
|
|
QUuid | uuid () const |
|
QList< Conductor * > | conductors () const |
| Terminal::conductors. More...
|
|
Qet::Orientation | orientation () const |
|
QPointF | dockConductor () const |
| Terminal::dockConductor. More...
|
|
QString | number () const |
| Terminal::number. More...
|
|
QString | name () const |
| Terminal::name. More...
|
|
void | setNumber (QString number) |
| Terminal::setNumber. More...
|
|
void | setName (QString name, bool hiddenName) |
| Terminal::setName. More...
|
|
void | updateConductor () |
| Terminal::updateConductor Update the path of conductor docked to this terminal. More...
|
|
bool | isLinkedTo (Terminal *) |
| Terminal::isLinkedTo. More...
|
|
bool | canBeLinkedTo (Terminal *) |
| Terminal::canBeLinkedTo Checking if the terminal can be linked to other_terminal or not Reasons for not linable: More...
|
|
bool | fromXml (QDomElement &) |
| Terminal::fromXml Permet de savoir si un element XML represente cette borne. Attention, l'element XML n'est pas verifie. More...
|
|
QDomElement | toXml (QDomDocument &) const |
| Terminal::toXml Methode d'export en XML. More...
|
|
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/5]
initialise une borne
- Parameters
-
pf | position du point d'amarrage pour un conducteur |
o | orientation de la borne : Qt::Horizontal ou Qt::Vertical |
e | Element auquel cette borne appartient |
◆ Terminal() [2/5]
initialise une borne
- Parameters
-
pf_x | Abscisse du point d'amarrage pour un conducteur |
pf_y | Ordonnee du point d'amarrage pour un conducteur |
o | orientation de la borne : Qt::Horizontal ou Qt::Vertical |
e | Element auquel cette borne appartient |
◆ Terminal() [3/5]
◆ Terminal() [4/5]
Terminal::Terminal |
( |
QPointF |
pf, |
|
|
Qet::Orientation |
o, |
|
|
QString |
num, |
|
|
QString |
name, |
|
|
bool |
hiddenName, |
|
|
Element * |
e = nullptr |
|
) |
| |
initialise une borne
- Parameters
-
pf | position du point d'amarrage pour un conducteur |
o | orientation de la borne : Qt::Horizontal ou Qt::Vertical |
num | number of terminal (ex 3 - 4 for NO) |
name | of terminal |
hiddenName | hide or show the name |
e | Element auquel cette borne appartient |
◆ ~Terminal()
Destructeur La destruction de la borne entraine la destruction des conducteurs associes.
◆ Terminal() [5/5]
◆ 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
◆ 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 Permet de savoir si un element XML represente cette borne. Attention, l'element XML n'est pas verifie.
- Parameters
-
terminal | Le QDomElement a analyser |
- Returns
- true si la borne "se reconnait" (memes coordonnes, meme orientation), false sinon
◆ 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]
void Terminal::init |
( |
QPointF |
pf, |
|
|
Qet::Orientation |
o, |
|
|
QString |
number, |
|
|
QString |
name, |
|
|
bool |
hiddenName |
|
) |
| |
|
private |
Terminal::init Additionaly to the init above, this method stores position and orientation into the data class.
- Parameters
-
pf | |
o | |
number | |
name | |
hiddenName | |
◆ init() [2/2]
void Terminal::init |
( |
QString |
number, |
|
|
QString |
name, |
|
|
bool |
hiddenName |
|
) |
| |
|
private |
Terminal::init Methode privee pour initialiser la borne.
- Parameters
-
number | of terminal |
name | of terminal |
hiddenName | |
◆ 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
◆ 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 |
|
inline |
◆ number()
QString Terminal::number |
( |
| ) |
const |
|
inline |
◆ 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.
- Returns
- L'orientation actuelle de la Terminal.
◆ paint()
void Terminal::paint |
( |
QPainter * |
p, |
|
|
const QStyleOptionGraphicsItem * |
options, |
|
|
QWidget * |
|
|
) |
| |
|
override |
Terminal::paint Fonction de dessin des bornes.
- Parameters
-
p | Le QPainter a utiliser |
options | Les options de dessin |
◆ parentElement()
Element * Terminal::parentElement |
( |
| ) |
const |
◆ removeConductor()
void Terminal::removeConductor |
( |
Conductor * |
conductor | ) |
|
◆ setName()
void Terminal::setName |
( |
QString |
name, |
|
|
bool |
hiddenName |
|
) |
| |
◆ setNumber()
void Terminal::setNumber |
( |
QString |
number | ) |
|
◆ 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 |
( |
| ) |
|
◆ 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 |
◆ br_
QRectF* Terminal::br_ {nullptr} |
|
private |
Pointer to a rectangle representing the terminal bounding rect; used to calculate the bounding rect once only; used a pointer because boundingRect() is supposed to be const.
◆ conductors_
List of conductors attached to the terminal.
◆ dock_elmt_
QPointF Terminal::dock_elmt_ |
|
private |
docking point for parent element
◆ forbiddenColor
QColor Terminal::forbiddenColor = QColor(Qt::red) |
|
static |
color for forbidden actions
◆ hovered_
Whether the mouse pointer is hovering the terminal.
◆ hovered_color_
QColor Terminal::hovered_color_ |
|
private |
Color used for the hover effect.
◆ 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 |
◆ name_terminal_
QString Terminal::name_terminal_ |
|
private |
◆ name_terminal_hidden
bool Terminal::name_terminal_hidden |
|
private |
◆ neutralColor
QColor Terminal::neutralColor = QColor(Qt::blue) |
|
static |
◆ number_terminal_
QString Terminal::number_terminal_ |
|
private |
◆ parent_element_
Element* Terminal::parent_element_ {nullptr} |
|
private |
Parent electrical element.
◆ previous_terminal_
Last terminal seen through an attached conductor.
◆ 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: