QElectroTech  0.8-dev
Functions
QETXML Namespace Reference

Functions

QDomElement penToXml (QDomDocument &parent_document, const QPen &pen)
 QETXML::penToXml Write attribute of a QPen in xml element. More...
 
QPen penFromXml (const QDomElement &element)
 QETXML::penFromXml Build a QPen from a xml description. More...
 
QDomElement brushToXml (QDomDocument &parent_document, const QBrush &brush)
 QETXML::brushToXml Write attribute of a QBrush in xml element. More...
 
QBrush brushFromXml (const QDomElement &element)
 QETXML::brushFromXml Build a QBrush from a xml description. More...
 
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. More...
 
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. More...
 
QVector< QDomElement > directChild (const QDomElement &element, const QString &tag_name)
 QETXML::directChild. More...
 
QVector< QDomElement > subChild (const QDomElement &element, const QString parent_tag_name, const QString &children_tag_name)
 QETXML::subChild. More...
 
QDomElement marginsToXml (QDomDocument &parent_document, const QMargins &margins)
 QETXML::marginsToXml Save a QMargins to xml. the xml tag name is 'margins'. More...
 
QMargins marginsFromXml (const QDomElement &element)
 QETXML::marginsFromXml. More...
 
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. More...
 
void modelHeaderDataFromXml (const QDomElement &element, QAbstractItemModel *model)
 QETXML::modelHeaderDataFromXml Restore from xml modele header data. More...
 

Detailed Description

This namespace contain some function to use xml with QET.

Function Documentation

◆ 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:

◆ 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:

◆ 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:

◆ 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:

◆ 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: