From 02b7ead041ab996ad9e2c3b83da399c4fdcd9ec9 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 24 Feb 2021 18:48:59 +0100 Subject: [PATCH] fix compile issues --- sources/borderproperties.h | 2 +- sources/conductorproperties.h | 2 +- .../editor/graphicspart/customelementpart.h | 2 +- sources/editor/graphicspart/partterminal.cpp | 4 +-- sources/editor/graphicspart/partterminal.h | 2 +- sources/properties/elementdata.cpp | 4 +-- sources/properties/elementdata.h | 6 ++--- sources/properties/propertiesinterface.h | 5 +--- sources/properties/terminaldata.cpp | 4 +-- sources/properties/terminaldata.h | 6 ++--- sources/qetgraphicsitem/conductor.h | 4 +-- sources/qetgraphicsitem/terminal.cpp | 20 +++++++++------ sources/qetgraphicsitem/terminal.h | 25 +++++++++++-------- sources/titleblockproperties.h | 2 +- 14 files changed, 48 insertions(+), 40 deletions(-) diff --git a/sources/borderproperties.h b/sources/borderproperties.h index f2c9aed5e..fec32bd07 100644 --- a/sources/borderproperties.h +++ b/sources/borderproperties.h @@ -20,7 +20,7 @@ #include #include -#include "propertiesinterface.h" +#include "properties/propertiesinterface.h" /** @brief The BorderProperties class diff --git a/sources/conductorproperties.h b/sources/conductorproperties.h index 6c859ff79..77ec6a891 100644 --- a/sources/conductorproperties.h +++ b/sources/conductorproperties.h @@ -22,7 +22,7 @@ #include #include -#include "propertiesinterface.h" +#include "properties/propertiesinterface.h" class QPainter; diff --git a/sources/editor/graphicspart/customelementpart.h b/sources/editor/graphicspart/customelementpart.h index fc4de022c..c1a7d3ce3 100644 --- a/sources/editor/graphicspart/customelementpart.h +++ b/sources/editor/graphicspart/customelementpart.h @@ -19,7 +19,7 @@ #define CUSTOM_ELEMENT_PART_H #include "../../qet.h" -#include "propertiesinterface.h" +#include "../../properties/propertiesinterface.h" class CustomElement; class ElementPrimitiveDecorator; diff --git a/sources/editor/graphicspart/partterminal.cpp b/sources/editor/graphicspart/partterminal.cpp index 915694488..5fced7821 100644 --- a/sources/editor/graphicspart/partterminal.cpp +++ b/sources/editor/graphicspart/partterminal.cpp @@ -250,7 +250,7 @@ QRectF PartTerminal::sceneGeometricRect() const */ void PartTerminal::startUserTransformation(const QRectF &initial_selection_rect) { Q_UNUSED(initial_selection_rect) - saved_position_ = scenePos(); + m_saved_position = scenePos(); } /** @@ -258,6 +258,6 @@ void PartTerminal::startUserTransformation(const QRectF &initial_selection_rect) */ void PartTerminal::handleUserTransformation(const QRectF &initial_selection_rect, const QRectF &new_selection_rect) { QPointF mapped_point = mapPoints( - initial_selection_rect, new_selection_rect, QList() << saved_position_).first(); + initial_selection_rect, new_selection_rect, QList() << m_saved_position).first(); setPos(mapped_point); } diff --git a/sources/editor/graphicspart/partterminal.h b/sources/editor/graphicspart/partterminal.h index 40c5fd153..3b6847057 100644 --- a/sources/editor/graphicspart/partterminal.h +++ b/sources/editor/graphicspart/partterminal.h @@ -90,6 +90,6 @@ class PartTerminal : public CustomElementGraphicPart TerminalData* d{nullptr}; // pointer to the terminal data private: - QPointF saved_position_; + QPointF m_saved_position; }; #endif diff --git a/sources/properties/elementdata.cpp b/sources/properties/elementdata.cpp index 9cab02db4..1a500dd90 100644 --- a/sources/properties/elementdata.cpp +++ b/sources/properties/elementdata.cpp @@ -19,12 +19,12 @@ #include "../qetxml.h" #include -void ElementData::toSettings(QSettings &settings, const QString prefix) const { +void ElementData::toSettings(QSettings &settings, const QString& prefix) const { Q_UNUSED(settings) Q_UNUSED(prefix) } -void ElementData::fromSettings(const QSettings &settings, const QString prefix) { +void ElementData::fromSettings(QSettings &settings, const QString& prefix) { Q_UNUSED(settings) Q_UNUSED(prefix) } diff --git a/sources/properties/elementdata.h b/sources/properties/elementdata.h index e7e3d740d..9353efce7 100644 --- a/sources/properties/elementdata.h +++ b/sources/properties/elementdata.h @@ -18,7 +18,7 @@ #ifndef ELEMENTDATA_H #define ELEMENTDATA_H -#include "propertiesinterface.h" +#include "../properties/propertiesinterface.h" #include "../diagramcontext.h" #include "../NameList/nameslist.h" @@ -85,8 +85,8 @@ class ElementData : public PropertiesInterface ElementData() {} ~ElementData() override {} - void toSettings(QSettings &settings, const QString prefix = QString()) const override; - void fromSettings(const QSettings &settings, const QString prefix = QString()) override; + void toSettings(QSettings &settings, const QString& prefix = QString()) const override; + void fromSettings(QSettings &settings, const QString& prefix = QString()) override; QDomElement toXml(QDomDocument &xml_element) const override; bool fromXml(const QDomElement &xml_element) override; QDomElement kindInfoToXml(QDomDocument &document); diff --git a/sources/properties/propertiesinterface.h b/sources/properties/propertiesinterface.h index b458f02ba..d1e03683c 100644 --- a/sources/properties/propertiesinterface.h +++ b/sources/properties/propertiesinterface.h @@ -23,7 +23,7 @@ #include #include #include -#include "qet.h" +#include "sources/qet.h" #include /** @@ -91,9 +91,6 @@ class PropertiesInterface // = 4 }; - /*! - * Try not using the default Value feature. It is better to initialize the class members in the class definition! - */ static PropertyFlags propertyInteger(const QDomElement &e, const QString& attribute_name, int *entier = nullptr); static PropertyFlags propertyDouble(const QDomElement &e, const QString& attribute_name, double *reel = nullptr); static PropertyFlags propertyString(const QDomElement& e, const QString& attribute_name, QString* string = nullptr); diff --git a/sources/properties/terminaldata.cpp b/sources/properties/terminaldata.cpp index 2368a9cd9..741bffe12 100644 --- a/sources/properties/terminaldata.cpp +++ b/sources/properties/terminaldata.cpp @@ -103,7 +103,7 @@ QDomElement TerminalData::toXml(QDomDocument &xml_document) const xml_element.appendChild(createXmlProperty(xml_document, "y", m_pos.y())); xml_element.appendChild(createXmlProperty(xml_document, "name", m_name)); xml_element.appendChild(createXmlProperty(xml_document, "orientation", orientationToString(m_orientation))); - xml_element.appendChild(createXmlProperty(xml_document, "type", typeToString(m_type)); + xml_element.appendChild(createXmlProperty(xml_document, "type", typeToString(m_type))); return(xml_element); } @@ -153,7 +153,7 @@ bool TerminalData::fromXml (const QDomElement &xml_element) // RETURNS True // lit l'orientation de la borne m_orientation = orientationFromString(o); - QStrint type; + QString type; if (propertyString(xml_element, "type", &type)) return false; m_type = typeFromString(type); diff --git a/sources/properties/terminaldata.h b/sources/properties/terminaldata.h index 37b083c3d..b08607be8 100644 --- a/sources/properties/terminaldata.h +++ b/sources/properties/terminaldata.h @@ -19,7 +19,7 @@ #define TERMINALDATA_H #include "../qet.h" -#include "propertiesinterface.h" +#include "../properties/propertiesinterface.h" #include #include @@ -73,11 +73,11 @@ class TerminalData : public PropertiesInterface */ Qet::Orientation m_orientation{Qet::Orientation::North}; /** - @brief second_point + @brief m_second_point Position of the second point of the terminal in scene coordinates */ - QPointF second_point{0,0}; + QPointF m_second_point{0,0}; /** @brief m_uuid Uuid of the terminal. diff --git a/sources/qetgraphicsitem/conductor.h b/sources/qetgraphicsitem/conductor.h index 9c25a5b58..ae66be5d3 100644 --- a/sources/qetgraphicsitem/conductor.h +++ b/sources/qetgraphicsitem/conductor.h @@ -20,8 +20,8 @@ #include "../autoNum/assignvariables.h" #include "../conductorproperties.h" -#include "conductorproperties.h" -#include "propertiesinterface.h" +#include "../conductorproperties.h" +#include "../properties/propertiesinterface.h" #include class ConductorProfile; diff --git a/sources/qetgraphicsitem/terminal.cpp b/sources/qetgraphicsitem/terminal.cpp index 07fb8a5eb..0e1f76de7 100644 --- a/sources/qetgraphicsitem/terminal.cpp +++ b/sources/qetgraphicsitem/terminal.cpp @@ -41,7 +41,7 @@ const qreal Terminal::Z = 1000; @param name of terminal @param hiddenName */ -void Terminal::init() +void Terminal::init(QString number, QString name, bool hiddenName) { //Calcul the docking point of the element //m_pos of d is the docking point of conductor @@ -62,7 +62,13 @@ void Terminal::init() origin += QPointF(-3.0, -3.0); qreal w = qAbs(dcx - dex) + 7; qreal h = qAbs(dcy - dey) + 7; - m_br = QRectF(origin, QSizeF(w, h)); + m_br = QRectF(origin, QSizeF(w, h)); + + // Number of terminal + number_terminal_ = std::move(number); + // Name of terminal + d->m_name = std::move(name); + name_terminal_hidden = hiddenName; setAcceptHoverEvents(true); setAcceptedMouseButtons(Qt::LeftButton); @@ -84,7 +90,7 @@ void Terminal::init( Qet::Orientation o, QString number, QString name, - bool hiddenName) + bool hiddenName) { // definition du pount d'amarrage pour un conducteur d->m_pos = pf; @@ -93,7 +99,7 @@ void Terminal::init( if (o < Qet::North || o > Qet::West) d->m_orientation = Qet::South; else d->m_orientation = o; - init(number, name, hiddenName); + init(number, name, hiddenName); } /** @@ -154,7 +160,7 @@ Terminal::Terminal(TerminalData* data, Element* e) : parent_element_(e) { d->setParent(this); - init(); + init("_", "_", false); } /** @@ -162,7 +168,7 @@ Terminal::Terminal(TerminalData* data, Element* e) : * Destruction of the terminal, and also docked conductor */ Terminal::~Terminal() { - qDeleteAll(m_conductors_list); + qDeleteAll(m_conductors_list); } /** @@ -563,7 +569,7 @@ void Terminal::mouseMoveEvent(QGraphicsSceneMouseEvent *e) //setCursor(Qt::CrossCursor); // d'un mouvement a l'autre, il faut retirer l'effet hover de la borne precedente - if (m_previous_terminal) { + if (m_previous_terminal) { if (m_previous_terminal == this) m_hovered = true; else m_previous_terminal -> m_hovered = false; m_previous_terminal -> m_hovered_color = m_previous_terminal -> neutralColor; diff --git a/sources/qetgraphicsitem/terminal.h b/sources/qetgraphicsitem/terminal.h index 78a8e2c8c..feb466333 100644 --- a/sources/qetgraphicsitem/terminal.h +++ b/sources/qetgraphicsitem/terminal.h @@ -21,8 +21,8 @@ #include #include -#include "qet.h" -#include "propertiesinterface.h" +#include "../qet.h" +#include "../properties/propertiesinterface.h" class Conductor; class Diagram; @@ -84,6 +84,11 @@ class Terminal : public QGraphicsObject, public PropertiesInterface int ID() const; QPointF dockPos(); QPointF originPos(); + QString number() const; + void setNumber(QString number); + void setName(QString name, bool hiddenName); + QString name() const; + QList conductors() const; Qet::Orientation orientation() const; @@ -142,19 +147,19 @@ class Terminal : public QGraphicsObject, public PropertiesInterface QPointF dock_elmt_; private: /// List of conductors attached to the terminal - QList conductors_; + QList m_conductors_list; /** 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_{nullptr}; + QRectF m_br; /// Last terminal seen through an attached conductor - Terminal *previous_terminal_{nullptr}; + Terminal *m_previous_terminal{nullptr}; /// Whether the mouse pointer is hovering the terminal - bool hovered_{false}; + bool m_hovered{false}; /// Color used for the hover effect - QColor hovered_color_{Terminal::neutralColor}; + QColor m_hovered_color{Terminal::neutralColor}; /// Number of Terminal QString number_terminal_; bool name_terminal_hidden{true}; @@ -163,8 +168,8 @@ class Terminal : public QGraphicsObject, public PropertiesInterface int m_id{-1}; private: - void init(); - void init(QPointF pf, Qet::Orientation o); + void init(QString number, QString name, bool hiddenName); + void init(QPointF pf, Qet::Orientation o,QString number, QString name, bool hiddenName); }; /** @@ -173,7 +178,7 @@ class Terminal : public QGraphicsObject, public PropertiesInterface */ inline int Terminal::conductorsCount() const { - return(m_conductors_list.size()); + return(m_conductors_list.size()); } /** diff --git a/sources/titleblockproperties.h b/sources/titleblockproperties.h index 1599f3a9a..2fff586cc 100644 --- a/sources/titleblockproperties.h +++ b/sources/titleblockproperties.h @@ -21,7 +21,7 @@ #include "diagramcontext.h" #include "qet.h" -#include "propertiesinterface.h" +#include "properties/propertiesinterface.h" /** This class provides a container for the properties of a particular title