QElectroTech  0.70
Namespaces | Enumerations | Functions | Variables
QET Namespace Reference

Namespaces

 Icons
 
 QetMessageBox
 

Enumerations

enum  GraphicsItemState { GIOK, GIBuildingFromXml, GILoadingFromXml }
 
enum  DepthOption { BringForward, Raise, Lower, SendBackward }
 List the various kind of changes for the zValue. More...
 
enum  OrientedMovement {
  ToNorth, ToNorthEast, ToEast, ToSouthEast,
  ToSouth, ToSouthWest, ToWest, ToNorthWest
}
 Oriented movements. More...
 
enum  OperationAreas {
  ChangeInnerPoints = -4, RotateArea = -3, MoveArea = -2, NoOperation = -1,
  ResizeFromTopLeftCorner = 0, ResizeFromTopCenterCorner = 1, ResizeFromTopRightCorner = 2, ResizeFromMiddleLeftCorner = 3,
  ResizeFromMiddleRightCorner = 4, ResizeFromBottomLeftCorner = 5, ResizeFromBottomCenterCorner = 6, ResizeFromBottomRightCorner = 7
}
 List areas related to some common operations. More...
 
enum  ScalingMethod { FreeScaling, SnapScalingPointToGrid, RoundScaleRatios }
 Supported types of interactive scaling, typically for a single element primitive. More...
 
enum  ConductorSegmentType { Horizontal = 1, Vertical = 2, Both = 3 }
 Known kinds of conductor segments. More...
 
enum  ItemType {
  Element = 1, ElementsCategory = 2, ElementsCollection = 4, ElementsContainer = 6,
  ElementsCollectionItem = 7, TitleBlockTemplate = 8, TitleBlockTemplatesCollection = 16, TitleBlockTemplatesCollectionItem = 24,
  Diagram = 32, Project = 64, All = 127
}
 
enum  Filtering { BeginFilter, RegularFilter, EndFilter }
 
enum  Action {
  Retry, Ignore, Erase, Abort,
  Managed, Rename
}
 
enum  DiagramArea { BorderArea, ElementsArea }
 
enum  TitleBlockColumnLength { Absolute, RelativeToTotalLength, RelativeToRemainingLength }
 enum used to specify the type of a length More...
 
enum  QetCollection { Common, Custom, Embedded }
 Enum used to specify the origin of a collection of thing (title block, element etc...) More...
 

Functions

QString license ()
 
QString qetCollectionToString (const QetCollection &c)
 QET::qetCollectionToString. More...
 
QetCollection qetCollectionFromString (const QString &str)
 QET::qetCollectionFromString. More...
 
bool lineContainsPoint (const QLineF &, const QPointF &)
 
bool orthogonalProjection (const QPointF &, const QLineF &, QPointF *=nullptr)
 
bool attributeIsAnInteger (const QDomElement &, const QString &, int *=nullptr)
 
bool attributeIsAReal (const QDomElement &, const QString &, qreal *=nullptr)
 
QString ElementsAndConductorsSentence (int, int, int=0, int=0, int=0, int=0)
 
QList< QDomElement > findInDomElement (const QDomElement &, const QString &)
 
QList< QDomElement > findInDomElement (const QDomElement &, const QString &, const QString &)
 
QList< QChar > forbiddenCharacters ()
 
QString stringToFileName (const QString &)
 
QString escapeSpaces (const QString &)
 
QString unescapeSpaces (const QString &)
 
QString joinWithSpaces (const QStringList &)
 
QStringList splitWithSpaces (const QString &)
 
QString diagramAreaToString (const QET::DiagramArea &)
 
QET::DiagramArea diagramAreaFromString (const QString &)
 
qreal round (qreal, qreal)
 
qreal correctAngle (const qreal &)
 
bool compareCanonicalFilePaths (const QString &, const QString &)
 
bool writeXmlFile (QDomDocument &xml_doc, const QString &filepath, QString *error_message=nullptr)
 
bool writeToFile (QDomDocument &xml_doc, QFile *file, QString *error_message=nullptr)
 
bool eachStrIsEqual (const QStringList &qsl)
 QET::eachStrIsEqual. More...
 
QActionGroup * depthActionGroup (QObject *parent=nullptr)
 QET::depthActionGroup. More...
 

Variables

const QString version = "0.70"
 QElectroTech version (as string, used to mark projects and elements XML documents) More...
 
const QString displayedVersion = "0.70"
 QElectroTech displayed version. More...
 

Detailed Description

This file provides useful functions and enums that may be used from anywhere else within the QElectroTech application.

This namespace is meant to delare icons used within the QElectroTech application.

Enumeration Type Documentation

◆ Action

This enums lists the various ways to handle a standard problem when copying or moving element items (collections, categories, elements).

See also
MoveElementsHandler
Enumerator
Retry 

The operation must be tried again.

Ignore 

Skip the current item.

Erase 

Erase the target content.

Abort 

abort the whole operation, ignoring the curent item

Managed 

the current item was handled by the Strategy object: do not treat it and continue

Rename 

the target has to be renamed

Definition at line 125 of file qet.h.

◆ ConductorSegmentType

Known kinds of conductor segments.

Enumerator
Horizontal 

Horizontal segment.

Vertical 

Vertical segment.

Both 

Invalid segment.

Definition at line 86 of file qet.h.

◆ DepthOption

List the various kind of changes for the zValue.

Enumerator
BringForward 

Bring item to the foreground so they have the highest zValue.

Raise 

Raise item one layer above their current one; zValues are incremented.

Lower 

Send item one layer below their current one; zValues are decremented.

SendBackward 

Send item to the background so they have the lowest zValue.

Definition at line 43 of file qet.h.

◆ DiagramArea

This enum represents diagram areas that may be exported/printed.

Enumerator
BorderArea 

Export the diagram along with its border and title block.

ElementsArea 

Export the content of the diagram only.

Definition at line 137 of file qet.h.

◆ Filtering

This enum represents the various steps when applying a filter.

Enumerator
BeginFilter 
RegularFilter 
EndFilter 

Definition at line 114 of file qet.h.

◆ GraphicsItemState

Enumerator
GIOK 

General state.

GIBuildingFromXml 

Item is currently building from a xml description (element)

GILoadingFromXml 

Item is loading her properties from a xml description.

Definition at line 36 of file qet.h.

◆ ItemType

This enums lists the various kind of items users can manage within the application.

Enumerator
Element 
ElementsCategory 
ElementsCollection 
ElementsContainer 
ElementsCollectionItem 
TitleBlockTemplate 
TitleBlockTemplatesCollection 
TitleBlockTemplatesCollectionItem 
Diagram 
Project 
All 

Definition at line 97 of file qet.h.

◆ OperationAreas

List areas related to some common operations.

Enumerator
ChangeInnerPoints 
RotateArea 
MoveArea 
NoOperation 
ResizeFromTopLeftCorner 
ResizeFromTopCenterCorner 
ResizeFromTopRightCorner 
ResizeFromMiddleLeftCorner 
ResizeFromMiddleRightCorner 
ResizeFromBottomLeftCorner 
ResizeFromBottomCenterCorner 
ResizeFromBottomRightCorner 

Definition at line 63 of file qet.h.

◆ OrientedMovement

Oriented movements.

Enumerator
ToNorth 
ToNorthEast 
ToEast 
ToSouthEast 
ToSouth 
ToSouthWest 
ToWest 
ToNorthWest 

Definition at line 51 of file qet.h.

◆ QetCollection

Enum used to specify the origin of a collection of thing (title block, element etc...)

Enumerator
Common 

From common collection.

Custom 

From user collection.

Embedded 

From an embedded collection (a project for exemple)

Definition at line 150 of file qet.h.

◆ ScalingMethod

Supported types of interactive scaling, typically for a single element primitive.

Enumerator
FreeScaling 

do not interfer with the default scaling process

SnapScalingPointToGrid 

snap the point used to define the new bounding rectangle to the grid

RoundScaleRatios 

adjust the scaling movement so that the induced scaling ratios are rounded

Definition at line 79 of file qet.h.

◆ TitleBlockColumnLength

enum used to specify the type of a length

Enumerator
Absolute 

the length is absolute and should be applied as is

RelativeToTotalLength 

the length is just a fraction of the total available length

RelativeToRemainingLength 

the length is just a fraction of the length that is still available when other types of lengths have been removed

Definition at line 143 of file qet.h.

Function Documentation

◆ attributeIsAnInteger()

bool QET::attributeIsAnInteger ( const QDomElement &  e,
const QString &  nom_attribut,
int *  entier = nullptr 
)

Permet de savoir si l'attribut nom_attribut d'un element XML e est bien un entier. Si oui, sa valeur est copiee dans entier.

Parameters
eElement XML
nom_attributNom de l'attribut a analyser
entierPointeur facultatif vers un entier
Returns
true si l'attribut est bien un entier, false sinon

Definition at line 200 of file qet.cpp.

Referenced by ElementPictureFactory::build(), Element::buildFromXml(), TitleBlockTemplate::checkCell(), TitleBlockCell::loadContentFromXml(), Element::parseInput(), TitleBlockTemplateView::pastedCells(), and QETProject::readDiagramsXml().

◆ attributeIsAReal()

bool QET::attributeIsAReal ( const QDomElement &  e,
const QString &  nom_attribut,
qreal *  reel = nullptr 
)

Permet de savoir si l'attribut nom_attribut d'un element XML e est bien un reel. Si oui, sa valeur est copiee dans reel.

Parameters
eElement XML
nom_attributNom de l'attribut a analyser
reelPointeur facultatif vers un double
Returns
true si l'attribut est bien un reel, false sinon

Definition at line 219 of file qet.cpp.

Referenced by PartTerminal::fromXml(), PartPolygon::fromXml(), ElementPictureFactory::parseArc(), ElementPictureFactory::parseCircle(), ElementPictureFactory::parseEllipse(), Element::parseInput(), ElementPictureFactory::parseLine(), ElementPictureFactory::parsePolygon(), ElementPictureFactory::parseRect(), and Element::parseTerminal().

◆ compareCanonicalFilePaths()

bool QET::compareCanonicalFilePaths ( const QString &  first,
const QString &  second 
)
Parameters
firstUn premier chemin vers un fichier
secondUn second chemin vers un fichier
Returns
true si les deux chemins existent existent et sont identiques lorsqu'ils sont exprimes sous forme canonique

Definition at line 519 of file qet.cpp.

Referenced by QETTitleBlockTemplateEditor::isEditing(), and QETElementEditor::isEditing().

◆ correctAngle()

qreal QET::correctAngle ( const qreal &  angle)

◆ depthActionGroup()

QActionGroup * QET::depthActionGroup ( QObject *  parent = nullptr)

QET::depthActionGroup.

Parameters
parent
Returns
an action group which contain 4 actions (forward, raise, lower, backward) already made with icon, shortcut and data (see QET::DepthOption)

Definition at line 636 of file qet.cpp.

References QET::Icons::BringForward, BringForward, Lower, QET::Icons::Lower, Raise, QET::Icons::Raise, SendBackward, QET::Icons::SendBackward, and QET::Icons::tr.

Referenced by QETElementEditor::setupActions(), and QETDiagramEditor::setUpActions().

◆ diagramAreaFromString()

QET::DiagramArea QET::diagramAreaFromString ( const QString &  string)
Parameters
stringune chaine representant un type de zone de schema
Returns
le type de zone de schema correspondant ; si la chaine est invalide, QET::ElementsArea est retourne.

Definition at line 488 of file qet.cpp.

References BorderArea, and ElementsArea.

Referenced by ExportProperties::fromSettings().

◆ diagramAreaToString()

QString QET::diagramAreaToString ( const QET::DiagramArea diagram_area)
Parameters
diagram_areaun type de zone de schema
Returns
une chaine representant le type de zone de schema

Definition at line 478 of file qet.cpp.

References ElementsArea.

Referenced by ExportProperties::toSettings().

◆ eachStrIsEqual()

bool QET::eachStrIsEqual ( const QStringList &  qsl)

QET::eachStrIsEqual.

Parameters
qsllist of string to compare
Returns
true if every string is identical, else false; The list must not be empty If the list can be empty, call isEmpty() before calling this function

Definition at line 584 of file qet.cpp.

Referenced by ConductorAutoNumerotation::numeratePotential(), and LinkElementCommand::redo().

◆ ElementsAndConductorsSentence()

QString QET::ElementsAndConductorsSentence ( int  elements_count,
int  conductors_count,
int  texts_count = 0,
int  images_count = 0,
int  shapes_count = 0,
int  element_text_count = 0 
)

Permet de composer rapidement la proposition "x elements et y conducteurs" ou encore "x elements, y conducteurs et z champs de texte".

Parameters
elements_countnombre d'elements
conductors_countnombre de conducteurs
texts_countnombre de champs de texte
images_countnombre d'images
Returns
la proposition decrivant le nombre d'elements, de conducteurs et de textes

Definition at line 240 of file qet.cpp.

References QET::Icons::tr.

Referenced by MoveConductorsTextsCommand::regenerateTextLabel(), ResetConductorCommand::ResetConductorCommand(), and DiagramContent::sentence().

◆ escapeSpaces()

QString QET::escapeSpaces ( const QString &  string)
Parameters
stringune chaine de caracteres
Returns
la meme chaine de caracteres, mais avec les espaces et backslashes echappes

Definition at line 398 of file qet.cpp.

Referenced by joinWithSpaces().

◆ findInDomElement() [1/2]

QList< QDomElement > QET::findInDomElement ( const QDomElement &  e,
const QString &  tag_name 
)

◆ findInDomElement() [2/2]

QList< QDomElement > QET::findInDomElement ( const QDomElement &  e,
const QString &  parent,
const QString &  children 
)

Etant donne un element XML e, renvoie la liste de tous les elements children imbriques dans les elements parent, eux-memes enfants de l'elememt e

Parameters
eElement XML a explorer
parenttag XML intermediaire
childrentag XML a rechercher
Returns
La liste des elements XML children

Definition at line 319 of file qet.cpp.

◆ forbiddenCharacters()

QList< QChar > QET::forbiddenCharacters ( )
Returns
la liste des caracteres interdits dans les noms de fichiers sous Windows

Definition at line 366 of file qet.cpp.

Referenced by stringToFileName().

◆ joinWithSpaces()

QString QET::joinWithSpaces ( const QStringList &  string_list)

Assemble une liste de chaines en une seule. Un espace separe chaque chaine. Les espaces et backslashes des chaines sont echappes.

Parameters
string_listune liste de chaine
Returns
l'assemblage des chaines

Definition at line 417 of file qet.cpp.

References escapeSpaces().

Referenced by main().

◆ license()

QString QET::license ( )
Returns
le texte de la licence de QElectroTech (GNU/GPL)

Definition at line 338 of file qet.cpp.

References QET::Icons::tr.

Referenced by AboutQET::licenseTab(), and QETApp::printLicense().

◆ lineContainsPoint()

bool QET::lineContainsPoint ( const QLineF &  line,
const QPointF &  point 
)
Parameters
lineUn segment de droite
pointUn point
Returns
true si le point appartient au segment de droite, false sinon

Definition at line 149 of file qet.cpp.

Referenced by Terminal::alignedWithTerminal(), and orthogonalProjection().

◆ orthogonalProjection()

bool QET::orthogonalProjection ( const QPointF &  point,
const QLineF &  line,
QPointF *  intersection = nullptr 
)
Parameters
pointUn point donne
lineUn segment de droite donnee
intersectionsi ce pointeur est different de 0, le QPointF ainsi designe contiendra les coordonnees du projete orthogonal, meme si celui-ci n'appartient pas au segment de droite
Returns
true si le projete orthogonal du point sur la droite appartient au segment de droite.

Definition at line 165 of file qet.cpp.

References QET::Icons::it, and lineContainsPoint().

Referenced by Conductor::movePointIntoPolygon().

◆ qetCollectionFromString()

QET::QetCollection QET::qetCollectionFromString ( const QString &  str)

QET::qetCollectionFromString.

Parameters
strstring to convert
Returns
The corresponding QetCollection value from a string. If the string don't match anything, we return the failsafe value QetCollection::Common

Definition at line 618 of file qet.cpp.

References Common, Custom, and Embedded.

Referenced by TitleBlockProperties::fromSettings(), and TitleBlockProperties::fromXml().

◆ qetCollectionToString()

QString QET::qetCollectionToString ( const QetCollection c)

QET::qetCollectionToString.

Parameters
cQetCollection value to convert
Returns
The QetCollection enum value converted to a QString

Definition at line 597 of file qet.cpp.

References Common, Custom, and Embedded.

Referenced by TitleBlockProperties::toSettings(), and TitleBlockProperties::toXml().

◆ round()

qreal QET::round ( qreal  x,
qreal  epsilon 
)

Round x to the nearest multiple of the invert of epsilon. For instance, epsilon = 10 will round to 1/10 = 0.1

Definition at line 497 of file qet.cpp.

Referenced by ElementPrimitiveDecorator::deltaForRoundScaling().

◆ splitWithSpaces()

QStringList QET::splitWithSpaces ( const QString &  string)
Parameters
stringUne chaine de caracteres contenant des sous-chaines a extraire separees par des espaces non echappes. Les espaces des sous-chaines sont echappes.
Returns
La liste des sous-chaines, sans echappement.

Definition at line 434 of file qet.cpp.

References unescapeSpaces().

Referenced by QETApp::receiveMessage().

◆ stringToFileName()

QString QET::stringToFileName ( const QString &  name)

Cette fonction transforme une chaine de caracteres (typiquement : un nom de schema, de projet, d'element) en un nom de fichier potable. Par nom de fichier potable, on entend un nom : ne comprenant pas de caracteres interdits sous Windows ne comprenant pas d'espace

Parameters
nameChaine de caractere a transformer en nom de fichier potable

Definition at line 379 of file qet.cpp.

References forbiddenCharacters().

Referenced by ExportDialog::ExportDiagramLine::ExportDiagramLine(), and ProjectView::printProject().

◆ unescapeSpaces()

QString QET::unescapeSpaces ( const QString &  string)
Parameters
stringune chaine de caracteres
Returns
la meme chaine de caracteres, mais avec les espaces et backslashes non echappes

Definition at line 407 of file qet.cpp.

Referenced by splitWithSpaces().

◆ writeToFile()

bool QET::writeToFile ( QDomDocument &  xml_doc,
QFile *  file,
QString *  error_message = nullptr 
)

Definition at line 663 of file qet.cpp.

References QET::Icons::tr.

Referenced by QETProject::writeBackup().

◆ writeXmlFile()

bool QET::writeXmlFile ( QDomDocument &  xml_doc,
const QString &  filepath,
QString *  error_message = nullptr 
)

Export an XML document to an UTF-8 text file indented with 4 spaces, with LF end of lines and no BOM.

Parameters
xml_docAn XML document to be exported
filepathPath to the file to be written
error_messageIf non-zero, will contain an error message explaining what happened when this function returns false.
Returns
false if an error occurred, true otherwise

Definition at line 544 of file qet.cpp.

References QET::Icons::tr.

Referenced by ECHSXmlToFile::copyDirectory(), ECHSXmlToFile::copyElement(), ElementCollectionHandler::createDir(), ExportElementTextPattern::ExportElementTextPattern(), TitleBlockTemplate::saveToXmlFile(), ElementCollectionHandler::setNames(), TitleBlockTemplatesFilesCollection::setTemplateXmlDescription(), QETElementEditor::toFile(), and QETProject::write().

Variable Documentation

◆ displayedVersion

const QString QET::displayedVersion = "0.70"

QElectroTech displayed version.

Definition at line 32 of file qet.h.

Referenced by DiagramPrintDialog::exec(), BorderTitleBlock::importTitleBlock(), QETApp::printVersion(), and AboutQET::titleTab().

◆ version

const QString QET::version = "0.70"

QElectroTech version (as string, used to mark projects and elements XML documents)

Definition at line 30 of file qet.h.

Referenced by ElementPictureFactory::build(), Element::buildFromXml(), QETProject::readProjectXml(), ElementScene::toXml(), QETProject::toXml(), and Diagram::toXml().