diff --git a/sources/qetgraphicsitem/terminal.cpp b/sources/qetgraphicsitem/terminal.cpp index 7786ae1d2..df6728ac2 100644 --- a/sources/qetgraphicsitem/terminal.cpp +++ b/sources/qetgraphicsitem/terminal.cpp @@ -42,6 +42,7 @@ const qreal Terminal::Z = 1000; */ void Terminal::init(QString number, QString name, bool hiddenName) { + hovered_color_ = Terminal::neutralColor; m_uuid = QUuid::createUuid(); // calcul de la position du point d'amarrage a l'element @@ -102,11 +103,7 @@ void Terminal::init(QPointF pf, Qet::Orientation o, QString number, QString name Terminal::Terminal(QPointF pf, Qet::Orientation o, Element *e) : QGraphicsObject(e), d(new TerminalData(this)), - m_draw_help_line(false), - m_help_line (nullptr), - m_help_line_a (nullptr), - parent_element_ (e), - hovered_color_ (Terminal::neutralColor) + parent_element_ (e) { init(pf, o, "_", "_", false); } @@ -121,12 +118,8 @@ Terminal::Terminal(QPointF pf, Qet::Orientation o, Element *e) : */ Terminal::Terminal(qreal pf_x, qreal pf_y, Qet::Orientation o, Element *e) : QGraphicsObject(e), - m_draw_help_line (false), - m_help_line (nullptr), - m_help_line_a (nullptr), d(new TerminalData(this)), - parent_element_ (e), - hovered_color_ (Terminal::neutralColor) + parent_element_ (e) { init(QPointF(pf_x, pf_y), o, "_", "_", false); } @@ -143,24 +136,16 @@ Terminal::Terminal(qreal pf_x, qreal pf_y, Qet::Orientation o, Element *e) : */ Terminal::Terminal(QPointF pf, Qet::Orientation o, QString num, QString name, bool hiddenName, Element *e) : QGraphicsObject (e), - m_draw_help_line (false), - m_help_line (nullptr), - m_help_line_a (nullptr), d(new TerminalData(this)), - parent_element_ (e), - hovered_color_ (Terminal::neutralColor) + parent_element_ (e) { init(pf, o, std::move(num), std::move(name), hiddenName); } Terminal::Terminal(TerminalData* data, Element* e) : QGraphicsObject(e), - m_draw_help_line (false), - m_help_line (nullptr), - m_help_line_a (nullptr), d(data), - parent_element_(e), - hovered_color_ (Terminal::neutralColor) + parent_element_(e) { // TODO: what is when multiple parents exist. So the other relation is lost. d->setParent(this); diff --git a/sources/qetgraphicsitem/terminal.h b/sources/qetgraphicsitem/terminal.h index a1a62cd49..b343159b9 100644 --- a/sources/qetgraphicsitem/terminal.h +++ b/sources/qetgraphicsitem/terminal.h @@ -110,15 +110,15 @@ class Terminal : public QGraphicsObject static QColor forbiddenColor; private: - bool m_draw_help_line; - QGraphicsLineItem *m_help_line; - QGraphicsLineItem *m_help_line_a; + bool m_draw_help_line{false}; + QGraphicsLineItem *m_help_line{nullptr}; + QGraphicsLineItem *m_help_line_a{nullptr}; TerminalData* d; /// Parent electrical element - Element *parent_element_; + Element *parent_element_{nullptr}; /// docking point for parent element QPointF dock_elmt_; /// List of conductors attached to the terminal @@ -126,7 +126,7 @@ class Terminal : public QGraphicsObject /// 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. - QRectF *br_; + QRectF *br_{nullptr}; /// Last terminal seen through an attached conductor Terminal *previous_terminal_; /// Whether the mouse pointer is hovering the terminal