QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
qet.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2026 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 _QET_H
19#define _QET_H
20
21#include <QDomElement>
22#include <QFile>
23#include <QObject>
24
25class QActionGroup;
30namespace QET {
31 QString license(); // only QETs license
32 std::tuple<QString, QString> licenses(const QString &); // all licenses
33
34 //Describe the current state of a graphic item
40
48
60
76
83
90
91
109
118
132
140
147
155
156 QString qetCollectionToString (const QetCollection &c);
157 QetCollection qetCollectionFromString (const QString &str);
158
159 bool lineContainsPoint(const QLineF &, const QPointF &);
160 bool orthogonalProjection(const QPointF &, const QLineF &, QPointF * = nullptr);
161 bool attributeIsAnInteger(const QDomElement &, const QString& , int * = nullptr);
162 bool attributeIsAReal(const QDomElement &, const QString& , qreal * = nullptr);
163 QString ElementsAndConductorsSentence(int elements=0,
164 int conductors=0,
165 int indi_texts=0,
166 int images=0,
167 int shapes=0,
168 int element_text=0,
169 int tables_count=0,
170 int terminal_strip_count=0);
171 QList<QDomElement> findInDomElement(const QDomElement &, const QString &);
172 QList<QDomElement> findInDomElement(const QDomElement &, const QString &, const QString &);
173 QList<QChar> forbiddenCharacters();
174 QString stringToFileName(const QString &);
175 QString escapeSpaces(const QString &);
176 QString unescapeSpaces(const QString &);
177 QString joinWithSpaces(const QStringList &);
178 QStringList splitWithSpaces(const QString &);
179 QString diagramAreaToString(const QET::DiagramArea &);
181 qreal round(qreal, qreal);
182 qreal correctAngle(const qreal &, const bool &positive = false);
183 bool compareCanonicalFilePaths(const QString &, const QString &);
184 bool writeXmlFile(QDomDocument &xml_doc, const QString &filepath, QString * error_message= nullptr);
185 bool writeToFile (QDomDocument &xml_doc, QFile *file, QString *error_message = nullptr);
186 bool eachStrIsEqual (const QStringList &qsl);
187 QActionGroup *depthActionGroup(QObject *parent = nullptr);
188}
189
191
192class Qet : public QObject
193{
194 Q_OBJECT
195
196 public:
205 Q_ENUM (EndType)
206
207 static QString endTypeToString(const Qet::EndType &);
208 static Qet::EndType endTypeFromString(const QString &);
209
215 Q_ENUM (Orientation)
216
217 static Qet::Orientation nextOrientation(Qet::Orientation);
218 static Qet::Orientation previousOrientation(Qet::Orientation);
219
220 static Qet::Orientation orientationFromString (const QString &);
221 static QString orientationToString (Qet::Orientation);
222
223 static bool surLeMemeAxe (Qet::Orientation, Qet::Orientation);
224 static bool isOpposed (Qet::Orientation a, Qet::Orientation b);
225 static bool isHorizontal (Qet::Orientation);
226 static bool isVertical (Qet::Orientation);
227};
228
229#endif
Definition qet.h:193
Orientation
Orientation (used for electrical elements and their terminals).
Definition qet.h:211
@ West
Definition qet.h:214
@ North
Definition qet.h:211
@ South
Definition qet.h:213
@ East
Definition qet.h:212
EndType
This enum lists the various available endings for line primitives when drawing an electrical element.
Definition qet.h:198
@ None
Regular line.
Definition qet.h:199
@ Simple
Base-less triangle.
Definition qet.h:200
@ Diamond
Diamond.
Definition qet.h:203
@ Triangle
Triangle.
Definition qet.h:201
@ Circle
Circle.
Definition qet.h:202
Q_DECLARE_METATYPE(NamesList)
Definition qet.h:30
QList< QDomElement > findInDomElement(const QDomElement &, const QString &)
Definition qet.cpp:354
Action
Definition qet.h:124
@ Ignore
Skip the current item.
Definition qet.h:126
@ Abort
abort the whole operation, ignoring the current item
Definition qet.h:128
@ Retry
The operation must be tried again.
Definition qet.h:125
@ Managed
the current item was handled by the Strategy object: do not treat it and continue
Definition qet.h:129
@ Erase
Erase the target content.
Definition qet.h:127
@ Rename
the target has to be renamed
Definition qet.h:130
qreal round(qreal, qreal)
Definition qet.cpp:611
bool lineContainsPoint(const QLineF &, const QPointF &)
Definition qet.cpp:159
TitleBlockColumnLength
enum used to specify the type of a length
Definition qet.h:142
@ RelativeToRemainingLength
the length is just a fraction of the length that is still available when other types of lengths have ...
Definition qet.h:145
@ RelativeToTotalLength
the length is just a fraction of the total available length
Definition qet.h:144
@ Absolute
the length is absolute and should be applied as is
Definition qet.h:143
QString license()
Definition qet.cpp:405
bool compareCanonicalFilePaths(const QString &, const QString &)
Definition qet.cpp:637
DepthOption
List the various kind of changes for the zValue.
Definition qet.h:42
@ Raise
Raise item one layer above their current one; zValues are incremented.
Definition qet.h:44
@ BringForward
Bring item to the foreground so they have the highest zValue.
Definition qet.h:43
@ Lower
Send item one layer below their current one; zValues are decremented.
Definition qet.h:45
@ SendBackward
Send item to the background so they have the lowest zValue.
Definition qet.h:46
QString diagramAreaToString(const QET::DiagramArea &)
Definition qet.cpp:592
QET::DiagramArea diagramAreaFromString(const QString &)
Definition qet.cpp:602
QString joinWithSpaces(const QStringList &)
Definition qet.cpp:529
bool eachStrIsEqual(const QStringList &qsl)
QET::eachStrIsEqual.
Definition qet.cpp:711
bool writeToFile(QDomDocument &xml_doc, QFile *file, QString *error_message=nullptr)
Definition qet.cpp:794
ConductorSegmentType
Known kinds of conductor segments.
Definition qet.h:85
@ Vertical
Vertical segment.
Definition qet.h:87
@ Both
Invalid segment.
Definition qet.h:88
@ Horizontal
Horizontal segment.
Definition qet.h:86
QString qetCollectionToString(const QetCollection &c)
QET::qetCollectionToString.
Definition qet.cpp:724
OperationAreas
List areas related to some common operations.
Definition qet.h:62
@ NoOperation
Definition qet.h:66
@ ResizeFromTopRightCorner
Definition qet.h:69
@ ResizeFromTopCenterCorner
Definition qet.h:68
@ ResizeFromBottomLeftCorner
Definition qet.h:72
@ MoveArea
Definition qet.h:65
@ ChangeInnerPoints
Definition qet.h:63
@ ResizeFromBottomCenterCorner
Definition qet.h:73
@ ResizeFromTopLeftCorner
Definition qet.h:67
@ ResizeFromMiddleLeftCorner
Definition qet.h:70
@ ResizeFromBottomRightCorner
Definition qet.h:74
@ RotateArea
Definition qet.h:64
@ ResizeFromMiddleRightCorner
Definition qet.h:71
qreal correctAngle(const qreal &, const bool &positive=false)
Definition qet.cpp:622
OrientedMovement
Oriented movements.
Definition qet.h:50
@ ToNorthWest
Definition qet.h:58
@ ToNorth
Definition qet.h:51
@ ToNorthEast
Definition qet.h:52
@ ToSouth
Definition qet.h:55
@ ToEast
Definition qet.h:53
@ ToSouthEast
Definition qet.h:54
@ ToWest
Definition qet.h:57
@ ToSouthWest
Definition qet.h:56
QStringList splitWithSpaces(const QString &)
Definition qet.cpp:546
QString escapeSpaces(const QString &)
Definition qet.cpp:510
bool attributeIsAReal(const QDomElement &, const QString &, qreal *=nullptr)
Definition qet.cpp:234
std::tuple< QString, QString > licenses(const QString &)
Retrieves the text of a license for a specific component.
Definition qet.cpp:441
bool orthogonalProjection(const QPointF &, const QLineF &, QPointF *=nullptr)
Definition qet.cpp:175
Filtering
Definition qet.h:113
@ EndFilter
Definition qet.h:116
@ RegularFilter
Definition qet.h:115
@ BeginFilter
Definition qet.h:114
bool writeXmlFile(QDomDocument &xml_doc, const QString &filepath, QString *error_message=nullptr)
Definition qet.cpp:662
DiagramArea
Definition qet.h:136
@ BorderArea
Export the diagram along with its border and title block.
Definition qet.h:137
@ ElementsArea
Export the content of the diagram only.
Definition qet.h:138
ScalingMethod
Supported types of interactive scaling, typically for a single element primitive.
Definition qet.h:78
@ FreeScaling
do not interfere with the default scaling process
Definition qet.h:79
@ SnapScalingPointToGrid
snap the point used to define the new bounding rectangle to the grid
Definition qet.h:80
@ RoundScaleRatios
adjust the scaling movement so that the induced scaling ratios are rounded
Definition qet.h:81
QString ElementsAndConductorsSentence(int elements=0, int conductors=0, int indi_texts=0, int images=0, int shapes=0, int element_text=0, int tables_count=0, int terminal_strip_count=0)
QET::ElementsAndConductorsSentence Permet de composer rapidement la proposition "x elements et y cond...
Definition qet.cpp:261
QString unescapeSpaces(const QString &)
Definition qet.cpp:519
QString stringToFileName(const QString &)
Definition qet.cpp:487
ItemType
Definition qet.h:96
@ All
Definition qet.h:107
@ Project
Definition qet.h:106
@ TitleBlockTemplatesCollection
Definition qet.h:103
@ TitleBlockTemplatesCollectionItem
Definition qet.h:104
@ ElementsCategory
Definition qet.h:98
@ Element
Definition qet.h:97
@ ElementsCollectionItem
Definition qet.h:101
@ ElementsCollection
Definition qet.h:99
@ TitleBlockTemplate
Definition qet.h:102
@ Diagram
Definition qet.h:105
@ ElementsContainer
Definition qet.h:100
QetCollection
Enum used to specify the origin of a collection of thing (title block, element etc....
Definition qet.h:149
@ Common
From common collection.
Definition qet.h:150
@ Company
From company collection.
Definition qet.h:151
@ Custom
From user collection.
Definition qet.h:152
@ Embedded
From an embedded collection (a project for example).
Definition qet.h:153
GraphicsItemState
Definition qet.h:35
@ GIBuildingFromXml
Item is currently building from a xml description (element).
Definition qet.h:37
@ GILoadingFromXml
Item is loading her properties from a xml description.
Definition qet.h:38
@ GIOK
General state.
Definition qet.h:36
QList< QChar > forbiddenCharacters()
Definition qet.cpp:472
bool attributeIsAnInteger(const QDomElement &, const QString &, int *=nullptr)
Definition qet.cpp:213
QActionGroup * depthActionGroup(QObject *parent=nullptr)
QET::depthActionGroup.
Definition qet.cpp:767
QetCollection qetCollectionFromString(const QString &str)
QET::qetCollectionFromString.
Definition qet.cpp:747