QElectroTech  0.70
conductorproperties.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef CONDUCTOR_PROPERTIES_H
19 #define CONDUCTOR_PROPERTIES_H
20 
21 #include "qet.h"
22 #include <QColor>
23 
24 class QPainter;
25 
30  public:
32  virtual ~SingleLineProperties();
33 
34  void setPhasesCount(int);
35  unsigned short int phasesCount();
36  bool isPen() const;
37  void draw(QPainter *, QET::ConductorSegmentType, const QRectF &);
38  void toXml(QDomElement &) const;
39  void fromXml(QDomElement &);
40  void toSettings(QSettings &, const QString & = QString()) const;
41  void fromSettings(QSettings &, const QString & = QString());
42 
44  bool hasGround;
46  bool hasNeutral;
48  bool is_pen;
49 
50  int operator==(const SingleLineProperties &) const;
51  int operator!=(const SingleLineProperties &) const;
52 
53  private:
54  unsigned short int phases;
55  void drawGround (QPainter *, QET::ConductorSegmentType, QPointF, qreal);
56  void drawNeutral(QPainter *, QET::ConductorSegmentType, QPointF, qreal);
57  void drawPen(QPainter *, QET::ConductorSegmentType, QPointF, qreal);
58 };
59 
65 {
66  public:
68  virtual ~ConductorProperties();
69 
76 
77 
78  //Attributes
80 
81  QColor color,
82  m_color_2;
83 
84  QString text,
85  m_function,
87  m_formula;
88 
89  int text_size,
91 
92  double cond_size,
95 
98  m_bicolor = false;
99 
100  Qt::Alignment m_horizontal_alignment = Qt::AlignBottom,
101  m_vertical_alignment = Qt::AlignRight;
102 
103  Qt::PenStyle style;
104 
106 
107  // methods
108  void toXml(QDomElement &) const;
109  void fromXml(QDomElement &);
110  void toSettings(QSettings &, const QString & = QString()) const;
111  void fromSettings(QSettings &, const QString & = QString());
112  static QString typeToString(ConductorType);
113  void applyForEqualAttributes(QList<ConductorProperties> list);
114 
116 
117  // operators
118  bool operator==(const ConductorProperties &) const;
119  bool operator!=(const ConductorProperties &) const;
120 
121  private:
122  void readStyle(const QString &);
123  QString writeStyle() const;
124 };
125 
127 
128 #endif
bool hasGround
Whether the singleline conductor should display the ground symbol.
static ConductorProperties defaultProperties()
ConductorProperties::defaultProperties.
Qt::Alignment m_vertical_alignment
unsigned short int phasesCount()
static QString typeToString(ConductorType)
int operator!=(const SingleLineProperties &) const
void readStyle(const QString &)
SingleLineProperties singleLineProperties
void toXml(QDomElement &) const
ConductorProperties::toXml Export conductor propertie, in the XML element &#39;e&#39;.
Qt::Alignment m_horizontal_alignment
void fromXml(QDomElement &)
ConductorProperties::fromXml Import conductor propertie, from the attribute of the xml element &#39;e&#39;...
virtual ~SingleLineProperties()
Destructeur.
ConductorSegmentType
Known kinds of conductor segments.
Definition: qet.h:86
bool hasNeutral
Whether the singleline conductor should display the neutral symbol.
void fromSettings(QSettings &, const QString &=QString())
void drawGround(QPainter *, QET::ConductorSegmentType, QPointF, qreal)
bool operator!=(const ConductorProperties &) const
void drawNeutral(QPainter *, QET::ConductorSegmentType, QPointF, qreal)
void toSettings(QSettings &, const QString &=QString()) const
ConductorType
The ConductorType enum Represents the kind of a particular conductor: Single: singleline symbols...
unsigned short int phases
bool operator==(const ConductorProperties &) const
ConductorProperties::operator ==.
void fromXml(QDomElement &)
int operator==(const SingleLineProperties &) const
void drawPen(QPainter *, QET::ConductorSegmentType, QPointF, qreal)
void toSettings(QSettings &, const QString &=QString()) const
void fromSettings(QSettings &, const QString &=QString())
bool is_pen
Protective Earth Neutral: visually merge neutral and ground.
Q_DECLARE_METATYPE(NamesList)
void applyForEqualAttributes(QList< ConductorProperties > list)
ConductorProperties::applyForEqualAttributes Test each attribute of properties in the list separatly...
void draw(QPainter *, QET::ConductorSegmentType, const QRectF &)
void toXml(QDomElement &) const