QElectroTech
0.70
|
#include <diagramcontext.h>
Public Types | |
enum | KeyOrder { None, Alphabetical, DecreasingLength } |
Public Member Functions | |
void | add (DiagramContext other) |
DiagramContext::add Add all value of 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 , stay unchanged. More... | |
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. More... | |
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 | toSettings (QSettings &, const QString &) const |
void | fromSettings (QSettings &, const QString &) |
Static Public Member Functions | |
static QString | validKeyRegExp () |
Private Member Functions | |
bool | keyIsAcceptable (const QString &) const |
Static Private Member Functions | |
static bool | stringLongerThan (const QString &, const QString &) |
Private Attributes | |
QHash< QString, QVariant > | m_content |
Diagram context data (key/value pairs) More... | |
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 wich 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
Definition at line 53 of file diagramcontext.h.
Enumerator | |
---|---|
None | |
Alphabetical | |
DecreasingLength |
Definition at line 56 of file diagramcontext.h.
void DiagramContext::add | ( | DiagramContext | other | ) |
DiagramContext::add Add all value of 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 , stay unchanged.
other |
Definition at line 31 of file diagramcontext.cpp.
References addValue(), keys(), and value().
Referenced by SearchAndReplaceWorker::replaceDiagram().
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) |
Definition at line 83 of file diagramcontext.cpp.
References keyIsAcceptable(), m_content, m_content_show, and value().
Referenced by add(), TitleBlockPropertiesWidget::changeCurrentTitleBlockTemplate(), DiagramContextWidget::context(), ReplaceElementDialog::context(), ElementInfoWidget::currentInfo(), fromSettings(), fromXml(), Element::fromXml(), ElementPropertiesEditorWidget::on_m_buttonBox_accepted(), PasteDiagramCommand::redo(), SearchAndReplaceWorker::replaceAdvanced(), SearchAndReplaceWorker::replaceElement(), QETProject::setFilePath(), BorderTitleBlock::setNextFolioNum(), BorderTitleBlock::setPreviousFolioNum(), Element::setUpFormula(), BorderTitleBlock::updateDiagramContextForTitleBlock(), QETProject::updateDiagramsFolioData(), and QETProject::write().
void DiagramContext::clear | ( | ) |
Clear the content of this diagram context.
Definition at line 99 of file diagramcontext.cpp.
References m_content, and m_content_show.
Referenced by TitleBlockProperties::fromXml().
bool DiagramContext::contains | ( | const QString & | key | ) | const |
key | string key |
Definition at line 62 of file diagramcontext.cpp.
References m_content.
Referenced by DynamicTextItemDelegate::availableInfo(), CrossRefItem::elementPositionText(), Element::fromXml(), and SearchAndReplaceWorker::replaceAdvanced().
int DiagramContext::count | ( | ) |
Definition at line 107 of file diagramcontext.cpp.
References m_content.
Referenced by autonum::AssignVariables::assignProjectVar(), and autonum::AssignVariables::assignTitleBlockVar().
void DiagramContext::fromSettings | ( | QSettings & | settings, |
const QString & | array_name | ||
) |
Read this context properties from settings by running through the array named array_name.
Definition at line 177 of file diagramcontext.cpp.
References addValue().
Referenced by TitleBlockProperties::fromSettings().
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").
Definition at line 149 of file diagramcontext.cpp.
References addValue(), QET::findInDomElement(), and m_content_show.
Referenced by ElementScene::applyInformations(), Element::buildFromXml(), ElementsLocation::elementInformations(), TitleBlockProperties::fromXml(), Element::fromXml(), and QETProject::readProjectPropertiesXml().
|
private |
key | a key string |
Definition at line 207 of file diagramcontext.cpp.
References validKeyRegExp().
Referenced by addValue().
bool DiagramContext::keyMustShow | ( | const QString & | key | ) | const |
Definition at line 115 of file diagramcontext.cpp.
References m_content_show.
Referenced by Element::fromXml().
QList< QString > DiagramContext::keys | ( | DiagramContext::KeyOrder | order = None | ) | const |
Definition at line 41 of file diagramcontext.cpp.
References Alphabetical, m_content, None, and stringLongerThan().
Referenced by add(), autonum::AssignVariables::assignProjectVar(), autonum::AssignVariables::assignTitleBlockVar(), TitleBlockTemplate::interpreteVariables(), SearchAndReplaceWidget::searchTerms(), DiagramContextWidget::setContext(), XmlProjectElementCollectionItem::setUpData(), FileElementCollectionItem::setUpData(), TitleBlockProperties::toXml(), toXml(), Element::toXml(), and BorderTitleBlock::updateDiagramContextForTitleBlock().
bool DiagramContext::operator!= | ( | const DiagramContext & | dc | ) | const |
Definition at line 126 of file diagramcontext.cpp.
bool DiagramContext::operator== | ( | const DiagramContext & | dc | ) | const |
Definition at line 121 of file diagramcontext.cpp.
References m_content, and m_content_show.
const QVariant DiagramContext::operator[] | ( | const QString & | key | ) | const |
|
staticprivate |
Definition at line 199 of file diagramcontext.cpp.
Referenced by keys().
void DiagramContext::toSettings | ( | QSettings & | settings, |
const QString & | array_name | ||
) | const |
Export this context properties to settings by creating an array named array_name.
Definition at line 161 of file diagramcontext.cpp.
References m_content.
Referenced by TitleBlockProperties::toSettings().
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").
Definition at line 134 of file diagramcontext.cpp.
References keys(), m_content, m_content_show, and value().
Referenced by TitleBlockProperties::toXml(), ElementScene::toXml(), Element::toXml(), and QETProject::writeProjectPropertiesXml().
|
static |
Definition at line 192 of file diagramcontext.cpp.
Referenced by DiagramContextWidget::highlightNonAcceptableKeys(), and keyIsAcceptable().
QVariant DiagramContext::value | ( | const QString & | key | ) | const |
Definition at line 92 of file diagramcontext.cpp.
References m_content.
Referenced by add(), SearchAndReplaceWidget::addElement(), addValue(), DynamicElementTextItem::elementInfoChanged(), Element::fromXml(), DynamicElementTextModel::itemDataChanged(), ElementPropertiesEditorWidget::populateTree(), SearchAndReplaceWorker::replaceElement(), autonum::AssignVariables::replaceVariable(), SearchAndReplaceWidget::searchTerms(), XmlProjectElementCollectionItem::setUpData(), FileElementCollectionItem::setUpData(), DynamicElementTextItem::setupFormulaConnection(), toXml(), and DynamicElementTextItem::updateLabel().
|
private |
Diagram context data (key/value pairs)
Definition at line 86 of file diagramcontext.h.
Referenced by addValue(), clear(), contains(), count(), keys(), operator==(), operator[](), toSettings(), toXml(), and value().
|
private |
Definition at line 87 of file diagramcontext.h.
Referenced by addValue(), clear(), fromXml(), keyMustShow(), operator==(), and toXml().