![]() |
QElectroTech 0.100.0-dev
|
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" |
This namespace contain some function to use xml with QET.
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
.
e | Xml element which contains the property |
attribute_name | |
type | Type of the property |
attr |
bool QETXML::boolFromString | ( | const QString & | value, |
bool | default_value, | ||
bool * | conv_ok | ||
) |
boolFromString return value
converted to bool
value | : value to convert |
default_value | : default value |
conv_ok | : true if value is successfully converted |
QString QETXML::boolToString | ( | bool | value | ) |
boolToString
value |
value
converted to string QBrush QETXML::brushFromXml | ( | const QDomElement & | element | ) |
QETXML::brushFromXml Build a QBrush from a xml description.
element | : the QDomElement that describe the pen |
QDomElement QETXML::brushToXml | ( | QDomDocument & | parent_document, |
const QBrush & | brush | ||
) |
QETXML::brushToXml Write attribute of a QBrush in xml element.
parent_document | : parent document for create the QDomElement |
brush | : the brush to store |
QDomElement QETXML::createXmlProperty | ( | const QString & | name, |
const bool | value | ||
) |
QDomElement QETXML::createXmlProperty | ( | const QString & | name, |
const char * | value | ||
) |
QDomElement QETXML::createXmlProperty | ( | const QString & | name, |
const double | value | ||
) |
QDomElement QETXML::createXmlProperty | ( | const QString & | name, |
const int | value | ||
) |
propertyInteger Reads an integer from the XML element.
e | DomElement which contains the property attribute |
attribute_name | Name of the attribute |
entier | Return value if success |
entier
is not valid and the return value is False QDomElement QETXML::createXmlProperty | ( | const QString & | name, |
const QColor | value | ||
) |
QDomElement QETXML::createXmlProperty | ( | const QString & | name, |
const QString | value | ||
) |
Use this functions to add properties to the xml document.
QDomElement QETXML::createXmlProperty | ( | const QString & | name, |
const QUuid | value | ||
) |
PropertyFlags QETXML::debugReadXml | ( | PropertyFlags | flag, |
const QDomElement & | e, | ||
const QString & | attribute_name, | ||
const QString & | attr, | ||
const QString & | type | ||
) |
QVector< QDomElement > QETXML::directChild | ( | const QDomElement & | element, |
const QString & | tag_name | ||
) |
element | |
tag_name |
QDomElement QETXML::fileSystemDirToXmlCollectionDir | ( | QDomDocument & | document, |
const QDir & | dir, | ||
const QString & | rename = QString() |
||
) |
QDomElement QETXML::fileSystemElementToXmlCollectionElement | ( | QDomDocument & | document, |
QFile & | file, | ||
const QString & | rename = QString() |
||
) |
QVector< QDomElement > QETXML::findInDomElement | ( | const QDomElement & | dom_elmt, |
const QString & | tag_name | ||
) |
dom_elmt | |
tag_name |
QMargins QETXML::marginsFromXml | ( | const QDomElement & | element | ) |
element |
QDomElement QETXML::marginsToXml | ( | QDomDocument & | parent_document, |
const QMargins & | margins | ||
) |
QETXML::marginsToXml Save a QMargins to xml. the xml tag name is 'margins'.
parent_document | |
margins |
void QETXML::modelHeaderDataFromXml | ( | const QDomElement & | element, |
QAbstractItemModel * | model | ||
) |
QETXML::modelHeaderDataFromXml Restore from xml modele header data.
element | |
model |
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.
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 |
QPen QETXML::penFromXml | ( | const QDomElement & | element | ) |
QETXML::penFromXml Build a QPen from a xml description.
element | : The QDomElement that describe the pen |
QDomElement QETXML::penToXml | ( | QDomDocument & | parent_document, |
const QPen & | pen | ||
) |
QETXML::penToXml Write attribute of a QPen in xml element.
parent_document | : parent document for create the QDomElement |
pen | : the pen to store |
QDomElement QETXML::property | ( | const QDomElement & | e, |
const QString & | name | ||
) |
PropertyFlags QETXML::propertyBool | ( | const QDomElement & | e, |
const QString & | attribute_name, | ||
bool * | boolean | ||
) |
PropertyFlags QETXML::propertyBool | ( | const QString & | value, |
bool * | boolean | ||
) |
PropertyFlags QETXML::propertyColor | ( | const QDomElement & | e, |
const QString & | attribute_name, | ||
QColor * | color | ||
) |
PropertyFlags QETXML::propertyColor | ( | const QString & | value, |
QColor * | color | ||
) |
PropertyFlags QETXML::propertyDouble | ( | const QDomElement & | e, |
const QString & | attribute_name, | ||
double * | reel | ||
) |
PropertyFlags QETXML::propertyDouble | ( | const QString & | value, |
double * | reel | ||
) |
PropertyFlags QETXML::propertyInteger | ( | const QDomElement & | e, |
const QString & | attribute_name, | ||
int * | entier | ||
) |
PropertiesInterface::propertyInteger Reads an integer from the XML element.
e | DomElement which contains the property attribute |
attribute_name | Name of the attribute |
entier | Return value if success |
entier
is not valid and the return value is False PropertyFlags QETXML::propertyInteger | ( | const QString & | value, |
int * | entier | ||
) |
PropertyFlags QETXML::propertyString | ( | const QDomElement & | e, |
const QString & | attribute_name, | ||
QString * | string | ||
) |
PropertyFlags QETXML::propertyUuid | ( | const QDomElement & | e, |
const QString & | attribute_name, | ||
QUuid * | uuid | ||
) |
PropertyFlags QETXML::propertyUuid | ( | const QString & | value, |
QUuid * | uuid | ||
) |
bool QETXML::qGraphicsItemPosFromXml | ( | QGraphicsItem * | item, |
const QDomElement & | xml_elmt | ||
) |
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.
item | |
document |
QVector< QDomElement > QETXML::subChild | ( | const QDomElement & | element, |
const QString | parent_tag_name, | ||
const QString & | children_tag_name | ||
) |
element | |
parent_tag_name | |
children_tag_name |
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.
document | |
tag_name | |
value |
bool QETXML::validXmlProperty | ( | const QDomElement & | e | ) |
PropertiesInterface::validXmlProperty Check if the Xml element contains the needed fields.
e | Xml Property |
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.
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. |
const QString QETXML::boolS = "bool" |
const QString QETXML::colorS = "color" |
const QString QETXML::doubleS = "double" |
const QString QETXML::integerS = "int" |
const QString QETXML::stringS = "string" |
const QString QETXML::uuidS = "uuid" |