QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
Enumerations | Functions | Variables
QETXML Namespace Reference

Enumerations

enum  PropertyFlags { Success = 0 , NotFound = 1 , NoValidConversion = 2 }
 

Functions

QString boolToString (bool value)
 boolToString
 
bool boolFromString (const QString &value, bool default_value, bool *conv_ok)
 boolFromString return value converted to bool
 
PropertyFlags debugReadXml (PropertyFlags flag, const QDomElement &e, const QString &attribute_name, const QString &attr, const QString &type)
 
QDomElement createXmlProperty (const QString &name, const QString value)
 Use this functions to add properties to the xml document.
 
QDomElement createXmlProperty (const QString &name, const char *value)
 
QDomElement createXmlProperty (const QString &name, const int value)
 propertyInteger Reads an integer from the XML element.
 
QDomElement createXmlProperty (const QString &name, const double value)
 
QDomElement createXmlProperty (const QString &name, const bool value)
 
QDomElement createXmlProperty (const QString &name, const QUuid value)
 
QDomElement createXmlProperty (const QString &name, const QColor value)
 
PropertyFlags propertyInteger (const QDomElement &e, const QString &attribute_name, int *entier)
 PropertiesInterface::propertyInteger Reads an integer from the XML element.
 
PropertyFlags propertyInteger (const QString &value, int *entier)
 
PropertyFlags propertyDouble (const QDomElement &e, const QString &attribute_name, double *reel)
 
PropertyFlags propertyDouble (const QString &value, double *reel)
 
PropertyFlags propertyBool (const QDomElement &e, const QString &attribute_name, bool *boolean)
 
PropertyFlags propertyBool (const QString &value, bool *boolean)
 
PropertyFlags propertyColor (const QDomElement &e, const QString &attribute_name, QColor *color)
 
PropertyFlags propertyColor (const QString &value, QColor *color)
 
PropertyFlags propertyUuid (const QDomElement &e, const QString &attribute_name, QUuid *uuid)
 
PropertyFlags propertyUuid (const QString &value, QUuid *uuid)
 
PropertyFlags propertyString (const QDomElement &e, const QString &attribute_name, QString *string)
 
QDomElement property (const QDomElement &e, const QString &name)
 
bool attribute (const QDomElement &e, const QString &attribute_name, const QString &type, QString *attr)
 PropertiesInterface::attribute Returns the property with the name attribute_name and type type.
 
bool validXmlProperty (const QDomElement &e)
 PropertiesInterface::validXmlProperty Check if the Xml element contains the needed fields.
 
QDomElement qGraphicsItemPosToXml (QGraphicsItem *item, QDomDocument &document)
 qGraphicsItemPosToXml Save the pos of a QGraphicsItem into an xml element. The tag name of the xml element is pos and there is 3 attributes: x, y, z.
 
bool qGraphicsItemPosFromXml (QGraphicsItem *item, const QDomElement &xml_elmt)
 
QDomElement penToXml (QDomDocument &parent_document, const QPen &pen)
 QETXML::penToXml Write attribute of a QPen in xml element.
 
QPen penFromXml (const QDomElement &element)
 QETXML::penFromXml Build a QPen from a xml description.
 
QDomElement brushToXml (QDomDocument &parent_document, const QBrush &brush)
 QETXML::brushToXml Write attribute of a QBrush in xml element.
 
QBrush brushFromXml (const QDomElement &element)
 QETXML::brushFromXml Build a QBrush from a xml description.
 
QDomElement fileSystemDirToXmlCollectionDir (QDomDocument &document, const QDir &dir, const QString &rename=QString())
 
QDomElement fileSystemElementToXmlCollectionElement (QDomDocument &document, QFile &file, const QString &rename=QString())
 
bool writeXmlFile (const QDomDocument &xml_document, const QString &file_path, QString *error_message=nullptr)
 QETXML::writeXmlFile Export an XML document to an UTF-8 text file indented with 4 spaces, with LF end of lines and no BOM.
 
QDomElement textToDomElement (QDomDocument &document, const QString &tag_name, const QString &value)
 QETXML::textToDomElement Return a QDomElement, created from document, with tag name tag_name and text value.
 
QVector< QDomElement > directChild (const QDomElement &element, const QString &tag_name)
 QETXML::directChild.
 
QVector< QDomElement > subChild (const QDomElement &element, const QString parent_tag_name, const QString &children_tag_name)
 QETXML::subChild.
 
QDomElement marginsToXml (QDomDocument &parent_document, const QMargins &margins)
 QETXML::marginsToXml Save a QMargins to xml. the xml tag name is 'margins'.
 
QMargins marginsFromXml (const QDomElement &element)
 QETXML::marginsFromXml.
 
QDomElement modelHeaderDataToXml (QDomDocument &parent_document, const QAbstractItemModel *model, QHash< int, QList< int > > horizontal_section_role, QHash< int, QList< int > > vertical_section_role)
 QETXML::modelHeaderDataToXml Save to xml element all header data specified by horizontal_section_role and vertical_section_role.
 
void modelHeaderDataFromXml (const QDomElement &element, QAbstractItemModel *model)
 QETXML::modelHeaderDataFromXml Restore from xml modele header data.
 
QVector< QDomElement > findInDomElement (const QDomElement &dom_elmt, const QString &tag_name)
 QETXML::findInDomElement.
 

Variables

const QString integerS = "int"
 
const QString doubleS = "double"
 
const QString boolS = "bool"
 
const QString stringS = "string"
 
const QString uuidS = "uuid"
 
const QString colorS = "color"
 

Detailed Description

This namespace contain some function to use xml with QET.

Enumeration Type Documentation

◆ PropertyFlags

Enumerator
Success 
NotFound 
NoValidConversion 

Function Documentation

◆ attribute()

bool QETXML::attribute ( const QDomElement &  e,
const QString &  attribute_name,
const QString &  type,
QString *  attr 
)

PropertiesInterface::attribute Returns the property with the name attribute_name and type type.

Parameters
eXml element which contains the property
attribute_name
typeType of the property
attr
Returns
Here is the call graph for this function:
Here is the caller graph for this function:

◆ boolFromString()

bool QETXML::boolFromString ( const QString &  value,
bool  default_value,
bool *  conv_ok 
)

boolFromString return value converted to bool

Parameters
value: value to convert
default_value: default value
conv_ok: true if value is successfully converted
Returns
Here is the caller graph for this function:

◆ boolToString()

QString QETXML::boolToString ( bool  value)

boolToString

Parameters
value
Returns
value converted to string
Here is the caller graph for this function:

◆ brushFromXml()

QBrush QETXML::brushFromXml ( const QDomElement &  element)

QETXML::brushFromXml Build a QBrush from a xml description.

Parameters
element: the QDomElement that describe the pen
Returns
the created brush. If element is null or tagName isn't "brush" return a default constructed QBrush
Here is the caller graph for this function:

◆ brushToXml()

QDomElement QETXML::brushToXml ( QDomDocument &  parent_document,
const QBrush &  brush 
)

QETXML::brushToXml Write attribute of a QBrush in xml element.

Parameters
parent_document: parent document for create the QDomElement
brush: the brush to store
Returns
A QDomElement with the attribute stored. The tagName of QDomeElement is "brush".
Here is the caller graph for this function:

◆ createXmlProperty() [1/7]

QDomElement QETXML::createXmlProperty ( const QString &  name,
const bool  value 
)

◆ createXmlProperty() [2/7]

QDomElement QETXML::createXmlProperty ( const QString &  name,
const char *  value 
)

◆ createXmlProperty() [3/7]

QDomElement QETXML::createXmlProperty ( const QString &  name,
const double  value 
)

◆ createXmlProperty() [4/7]

QDomElement QETXML::createXmlProperty ( const QString &  name,
const int  value 
)

propertyInteger Reads an integer from the XML element.

Parameters
eDomElement which contains the property attribute
attribute_nameName of the attribute
entierReturn value if success
Returns
True if reading an integer was successful, else False. If the attribute was not found, entier is not valid and the return value is False

◆ createXmlProperty() [5/7]

QDomElement QETXML::createXmlProperty ( const QString &  name,
const QColor  value 
)

◆ createXmlProperty() [6/7]

QDomElement QETXML::createXmlProperty ( const QString &  name,
const QString  value 
)

Use this functions to add properties to the xml document.

Here is the caller graph for this function:

◆ createXmlProperty() [7/7]

QDomElement QETXML::createXmlProperty ( const QString &  name,
const QUuid  value 
)

◆ debugReadXml()

PropertyFlags QETXML::debugReadXml ( PropertyFlags  flag,
const QDomElement &  e,
const QString &  attribute_name,
const QString &  attr,
const QString &  type 
)
Here is the caller graph for this function:

◆ directChild()

QVector< QDomElement > QETXML::directChild ( const QDomElement &  element,
const QString &  tag_name 
)

QETXML::directChild.

Parameters
element
tag_name
Returns
All direct child of element with the tag name tag_name
Here is the caller graph for this function:

◆ fileSystemDirToXmlCollectionDir()

QDomElement QETXML::fileSystemDirToXmlCollectionDir ( QDomDocument &  document,
const QDir &  dir,
const QString &  rename = QString() 
)
Here is the caller graph for this function:

◆ fileSystemElementToXmlCollectionElement()

QDomElement QETXML::fileSystemElementToXmlCollectionElement ( QDomDocument &  document,
QFile &  file,
const QString &  rename = QString() 
)
Here is the caller graph for this function:

◆ findInDomElement()

QVector< QDomElement > QETXML::findInDomElement ( const QDomElement &  dom_elmt,
const QString &  tag_name 
)

QETXML::findInDomElement.

Parameters
dom_elmt
tag_name
Returns
all direct child of dom_elmt with tag name tag_name
Here is the caller graph for this function:

◆ marginsFromXml()

QMargins QETXML::marginsFromXml ( const QDomElement &  element)

QETXML::marginsFromXml.

Parameters
element
Returns
a QMargins from an xml description. The tag name must ne 'margins'
Here is the caller graph for this function:

◆ marginsToXml()

QDomElement QETXML::marginsToXml ( QDomDocument &  parent_document,
const QMargins &  margins 
)

QETXML::marginsToXml Save a QMargins to xml. the xml tag name is 'margins'.

Parameters
parent_document
margins
Returns
Here is the caller graph for this function:

◆ modelHeaderDataFromXml()

void QETXML::modelHeaderDataFromXml ( const QDomElement &  element,
QAbstractItemModel *  model 
)

QETXML::modelHeaderDataFromXml Restore from xml modele header data.

Parameters
element
model
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modelHeaderDataToXml()

QDomElement QETXML::modelHeaderDataToXml ( QDomDocument &  parent_document,
const QAbstractItemModel *  model,
QHash< int, QList< int > >  horizontal_section_role,
QHash< int, QList< int > >  vertical_section_role 
)

QETXML::modelHeaderDataToXml Save to xml element all header data specified by horizontal_section_role and vertical_section_role.

Parameters
parent_document
model
horizontal_section_role: key as header section and value as list of roles to save in xml
vertical_section_role:key as header section and value as list of roles to save in xml
Returns
Here is the caller graph for this function:

◆ penFromXml()

QPen QETXML::penFromXml ( const QDomElement &  element)

QETXML::penFromXml Build a QPen from a xml description.

Parameters
element: The QDomElement that describe the pen
Returns
the created pen. If element is null or tagName isn't "pen" return a default constructed QPen
Here is the caller graph for this function:

◆ penToXml()

QDomElement QETXML::penToXml ( QDomDocument &  parent_document,
const QPen &  pen 
)

QETXML::penToXml Write attribute of a QPen in xml element.

Parameters
parent_document: parent document for create the QDomElement
pen: the pen to store
Returns
: A QDomElement with the attribute stored. The tagName of QDomeElement is "pen".
Here is the caller graph for this function:

◆ property()

QDomElement QETXML::property ( const QDomElement &  e,
const QString &  name 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ propertyBool() [1/2]

PropertyFlags QETXML::propertyBool ( const QDomElement &  e,
const QString &  attribute_name,
bool *  boolean 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ propertyBool() [2/2]

PropertyFlags QETXML::propertyBool ( const QString &  value,
bool *  boolean 
)

◆ propertyColor() [1/2]

PropertyFlags QETXML::propertyColor ( const QDomElement &  e,
const QString &  attribute_name,
QColor *  color 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ propertyColor() [2/2]

PropertyFlags QETXML::propertyColor ( const QString &  value,
QColor *  color 
)

◆ propertyDouble() [1/2]

PropertyFlags QETXML::propertyDouble ( const QDomElement &  e,
const QString &  attribute_name,
double *  reel 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ propertyDouble() [2/2]

PropertyFlags QETXML::propertyDouble ( const QString &  value,
double *  reel 
)

◆ propertyInteger() [1/2]

PropertyFlags QETXML::propertyInteger ( const QDomElement &  e,
const QString &  attribute_name,
int *  entier 
)

PropertiesInterface::propertyInteger Reads an integer from the XML element.

Parameters
eDomElement which contains the property attribute
attribute_nameName of the attribute
entierReturn value if success
Returns
True if reading an integer was successful, else False. If the attribute was not found, entier is not valid and the return value is False
Here is the call graph for this function:
Here is the caller graph for this function:

◆ propertyInteger() [2/2]

PropertyFlags QETXML::propertyInteger ( const QString &  value,
int *  entier 
)

◆ propertyString()

PropertyFlags QETXML::propertyString ( const QDomElement &  e,
const QString &  attribute_name,
QString *  string 
)
Here is the call graph for this function:

◆ propertyUuid() [1/2]

PropertyFlags QETXML::propertyUuid ( const QDomElement &  e,
const QString &  attribute_name,
QUuid *  uuid 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ propertyUuid() [2/2]

PropertyFlags QETXML::propertyUuid ( const QString &  value,
QUuid *  uuid 
)

◆ qGraphicsItemPosFromXml()

bool QETXML::qGraphicsItemPosFromXml ( QGraphicsItem *  item,
const QDomElement &  xml_elmt 
)
Here is the caller graph for this function:

◆ qGraphicsItemPosToXml()

QDomElement QETXML::qGraphicsItemPosToXml ( QGraphicsItem *  item,
QDomDocument &  document 
)

qGraphicsItemPosToXml Save the pos of a QGraphicsItem into an xml element. The tag name of the xml element is pos and there is 3 attributes: x, y, z.

Parameters
item
document
Returns
Here is the caller graph for this function:

◆ subChild()

QVector< QDomElement > QETXML::subChild ( const QDomElement &  element,
const QString  parent_tag_name,
const QString &  children_tag_name 
)

QETXML::subChild.

Parameters
element
parent_tag_name
children_tag_name
Returns
When given an xml dom element element, returns a vector of all children dom_elements tagged children_tag_name nested in the parent dom elements tagged parent_tag_name, themselves children of the dom element element.
Here is the caller graph for this function:

◆ textToDomElement()

QDomElement QETXML::textToDomElement ( QDomDocument &  document,
const QString &  tag_name,
const QString &  value 
)

QETXML::textToDomElement Return a QDomElement, created from document, with tag name tag_name and text value.

Parameters
document
tag_name
value
Returns
a QDomElement, created from document
Here is the caller graph for this function:

◆ validXmlProperty()

bool QETXML::validXmlProperty ( const QDomElement &  e)

PropertiesInterface::validXmlProperty Check if the Xml element contains the needed fields.

Parameters
eXml Property
Returns
True if name, type, value attribute are available, else false
Here is the caller graph for this function:

◆ writeXmlFile()

bool QETXML::writeXmlFile ( const QDomDocument &  xml_document,
const QString &  file_path,
QString *  error_message = nullptr 
)

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

Parameters
xml_document: An XML document to be exported
file_path: Path to the file to be written
error_message: If non-zero, will contain an error message explaining what happened when this function returns false.
Returns
false if an error occurred, true otherwise
Here is the caller graph for this function:

Variable Documentation

◆ boolS

const QString QETXML::boolS = "bool"

◆ colorS

const QString QETXML::colorS = "color"

◆ doubleS

const QString QETXML::doubleS = "double"

◆ integerS

const QString QETXML::integerS = "int"

◆ stringS

const QString QETXML::stringS = "string"

◆ uuidS

const QString QETXML::uuidS = "uuid"