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
◆ 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]
Terminal::init Methode privee pour initialiser la borne.
- 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
◆ 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.
- 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 | ) |
|
◆ 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 |
◆ 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: