QElectroTech 0.100.0-dev
|
#include <diagramcontext.h>
Public Types | |
enum | KeyOrder { None , Alphabetical , DecreasingLength } |
Public Member Functions | |
void | add (DiagramContext other) |
DiagramContext::add Add all value of other to this. If a key already exist, the value is replaced. If a key doesn't exist, she will be added. All other keys of this context, which are not present in other, stay unchanged. | |
void | remove (const QString &key) |
DiagramContext::remove. | |
QList< QString > | keys (KeyOrder=None) const |
bool | contains (const QString &) const |
const QVariant | operator[] (const QString &) const |
bool | addValue (const QString &, const QVariant &, bool show=true) |
QVariant | value (const QString &key) const |
void | clear () |
int | count () |
bool | keyMustShow (const QString &) const |
DiagramContext::keyMustShow. | |
bool | operator== (const DiagramContext &) const |
bool | operator!= (const DiagramContext &) const |
void | toXml (QDomElement &, const QString &="property") const |
void | fromXml (const QDomElement &, const QString &="property") |
void | fromXml (const pugi::xml_node &dom_element, const QString &tag_name="property") |
DiagramContext::fromXml Read this context properties from the dom_element, looking for tags named tag_name. | |
void | toSettings (QSettings &, const QString &) const |
void | fromSettings (QSettings &, const QString &) |
Static Public Member Functions | |
static bool | isKeyAcceptable (const QString &) |
Static Private Member Functions | |
static bool | stringLongerThan (const QString &, const QString &) |
static QString | validKeyRegExp () |
Private Attributes | |
QHash< QString, QVariant > | m_content |
Diagram context data (key/value pairs) | |
QHash< QString, bool > | m_content_show |
This class represents a diagram context, i.e. the data (a list of key/value pairs) of a diagram at a given time. It is notably used by titleblock templates to fetch the informations they need to do their rendering, or element for retrieve information about itself Key for element : label -> label or identification of element formula -> formula used to create the label (formula is make with variable) designation -> exhaustive comment used to explain what the element does. description -> exhaustive description used to explain what the element does. plant -> the plant assigned to the element comment -> a little comment which can be displayed in the folio manufacturer -> the manufacturer of the element manufacturer_reference -> the manufacturer reference of the element quantity -> quantity of the element unity -> unity of the element auxiliary1 -> auxiliary 1 of element auxiliary2 -> auxiliary 2 of element machine_manufacturer_reference -> reference of the machine manufacturer supplier -> the supplier of the element function -> the function of element location -> the location assigned to the element frozenLabel -> label locked at a given time
void DiagramContext::add | ( | DiagramContext | other | ) |
DiagramContext::add Add all value of other to this. If a key already exist, the value is replaced. If a key doesn't exist, she will be added. All other keys of this context, which are not present in other, stay unchanged.
other |
bool DiagramContext::addValue | ( | const QString & | key, |
const QVariant & | value, | ||
bool | show = true |
||
) |
key | key to insert in the context - the key may only contain lowercase letters and dashes. If embedded key is set, key must be find it else value is not added. |
value | value to insert in the context |
show | if value is used to be show on the diagram or somewhere else, we can specify if he is show(true) or not(false) |
void DiagramContext::clear | ( | ) |
Clear the content of this diagram context.
bool DiagramContext::contains | ( | const QString & | key | ) | const |
key | string key |
int DiagramContext::count | ( | ) |
void DiagramContext::fromSettings | ( | QSettings & | settings, |
const QString & | array_name | ||
) |
Read this context properties from settings by running through the array named array_name.
void DiagramContext::fromXml | ( | const pugi::xml_node & | dom_element, |
const QString & | tag_name = "property" |
||
) |
DiagramContext::fromXml Read this context properties from the dom_element, looking for tags named tag_name.
dom_element | : dom element to parse |
tag_name | : tag name to find, by default "property" |
void DiagramContext::fromXml | ( | const QDomElement & | e, |
const QString & | tag_name = "property" |
||
) |
Read this context properties from the e XML element, looking for tags named tag_name (defaults to "property").
|
static |
key | a key string |
bool DiagramContext::keyMustShow | ( | const QString & | key | ) | const |
QList< QString > DiagramContext::keys | ( | DiagramContext::KeyOrder | order = None | ) | const |
bool DiagramContext::operator!= | ( | const DiagramContext & | dc | ) | const |
bool DiagramContext::operator== | ( | const DiagramContext & | dc | ) | const |
const QVariant DiagramContext::operator[] | ( | const QString & | key | ) | const |
key |
void DiagramContext::remove | ( | const QString & | key | ) |
|
staticprivate |
void DiagramContext::toSettings | ( | QSettings & | settings, |
const QString & | array_name | ||
) | const |
Export this context properties to settings by creating an array named array_name.
void DiagramContext::toXml | ( | QDomElement & | e, |
const QString & | tag_name = "property" |
||
) | const |
Export this context properties under the e XML element, using tags named tag_name (defaults to "property").
|
staticprivate |
QVariant DiagramContext::value | ( | const QString & | key | ) | const |
|
private |
Diagram context data (key/value pairs)
|
private |