mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 08:10:52 +01:00
try to use TerminalData in Terminal and PartTerminal, sou the code must not be written double
This commit is contained in:
committed by
Laurent Trinques
parent
8c6b4120f5
commit
ec52032532
@@ -19,6 +19,8 @@
|
||||
#define PART_TERMINAL_H
|
||||
|
||||
#include "customelementgraphicpart.h"
|
||||
#include "QUuid"
|
||||
#include "terminaldata.h"
|
||||
|
||||
|
||||
|
||||
@@ -31,6 +33,7 @@ class PartTerminal : public CustomElementGraphicPart
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(Qet::Orientation orientation READ orientation WRITE setOrientation)
|
||||
Q_PROPERTY(QString name READ name WRITE setName)
|
||||
|
||||
|
||||
public:
|
||||
@@ -42,12 +45,7 @@ class PartTerminal : public CustomElementGraphicPart
|
||||
|
||||
signals:
|
||||
void orientationChanged();
|
||||
|
||||
// attributes
|
||||
private:
|
||||
Qet::Orientation m_orientation;
|
||||
QPointF second_point;
|
||||
|
||||
void nameChanged();
|
||||
|
||||
// methods
|
||||
public:
|
||||
@@ -57,7 +55,7 @@ class PartTerminal : public CustomElementGraphicPart
|
||||
* @return the QGraphicsItem type
|
||||
*/
|
||||
int type() const override { return Type; }
|
||||
QString name() const override { return(QObject::tr("borne", "element part name")); }
|
||||
QString name() const override { return d->m_name; }
|
||||
QString xmlName() const override { return(QString("terminal")); }
|
||||
void fromXml(const QDomElement &) override;
|
||||
const QDomElement toXml(QDomDocument &) const override;
|
||||
@@ -71,11 +69,14 @@ class PartTerminal : public CustomElementGraphicPart
|
||||
void startUserTransformation(const QRectF &) override;
|
||||
void handleUserTransformation(const QRectF &, const QRectF &) override;
|
||||
|
||||
Qet::Orientation orientation() const {return m_orientation;}
|
||||
Qet::Orientation orientation() const {return d->m_orientation;}
|
||||
void setOrientation(Qet::Orientation ori);
|
||||
|
||||
void setName(QString& name);
|
||||
|
||||
private:
|
||||
void updateSecondPoint();
|
||||
TerminalData* d; // pointer to the terminal data
|
||||
|
||||
private:
|
||||
QPointF saved_position_;
|
||||
|
||||
Reference in New Issue
Block a user