#include <abstractelementattribute.h>
Inheritance diagram for AbstractElementAttribute:

Public Member Functions | |
| AbstractElementAttribute (AbstractElement *parent) | |
| virtual int | type () const=0 |
| virtual const QString & | title () const=0 |
| virtual int | category () const |
| QString | toString () const |
| bool | setData (const QString &data) |
| QVariant | toVariant () const |
| bool | setData (const QVariant &data) |
| virtual QDomElement | domElement (QDomDocument &doc) const |
| virtual void | initFromDomElement (const QDomElement &e, InitModeFlags modeFlags) |
Protected Member Functions | |
| virtual QString | worker_toString () const=0 |
| virtual bool | worker_setData (const QString &data)=0 |
| virtual QVariant | worker_toVariant () const=0 |
| virtual bool | worker_setData (const QVariant &data)=0 |
Protected Attributes | |
| QReadWriteLock | m_lock |
As this subclasses QObject, it can be used in a QPointer and be asked to QObject::deleteLater(). It also has access to the QObject::tr() method.
Having a AbstractElement object as the parent means that all of the AbstractElementAttributes objects owned by a given AbstractElement object will be destroyed automatically with the AbstractElement object.
| AbstractElementAttribute::AbstractElementAttribute | ( | AbstractElement * | parent | ) |
| virtual int AbstractElementAttribute::type | ( | ) | const [pure virtual] |
| virtual const QString& AbstractElementAttribute::title | ( | ) | const [pure virtual] |
| virtual int AbstractElementAttribute::category | ( | ) | const [inline, virtual] |
Note: This is not pure-virtual, as some systems won't need it - e.g. Digest .
| QString AbstractElementAttribute::toString | ( | ) | const |
Returns the attribute's state as a QString.
This method is required by ElementDoc::domElement(), which itself is used for save & load. Hence, the QString returned should be compact while also easy enough for setData() to parse. Speed is not a huge concern in the implementation of this method.
Note: This method is required even alongside toVariant(). This is because although toVariant().toString() will work for some (primitive) data types, it will not work for others, such as QRect, QList<QVariant> and user defined data types.
Note: This function is thread-safe.
| bool AbstractElementAttribute::setData | ( | const QString & | data | ) |
Sets the attribute's state using the data contained in the given QString.
This method is required by ElementDoc::initFromDomElement(), which itself is used for save & load. Speed is not a huge concern in the implementation of this method. Instead it must simply parse data that has been generated using toString().
Returns false if an error occurred; else true.
Note: This function is thread-safe.
| QVariant AbstractElementAttribute::toVariant | ( | ) | const |
Returns the attribute's state as a QVariant.
This is used for getting the attribute's state and will most likey be called often. Hence, the implementation of this method must be optimised for speed.
Note: This function is thread-safe.
| bool AbstractElementAttribute::setData | ( | const QVariant & | data | ) |
Sets the attribute's state using the data contained in the given QVariant.
This is used for setting the attribute's state and will most likey be called often. Hence, the implementation of this method must be optimised for speed.
Returns false if an error occurred; else true.
Note: This function is thread-safe.
| QDomElement AbstractElementAttribute::domElement | ( | QDomDocument & | doc | ) | const [virtual] |
Creates an XML QDomElement that represents the AbstractElementAttribute.
Use initFromDOMElement() to restore the AbstractElementAttribute state from the resulting QDomElement.
Uses toString() to get the state.
Note: This function is thread-safe (as it only calls toString()).
See also initFromDomElement().
Reimplemented from DomAccessibleState.
| void AbstractElementAttribute::initFromDomElement | ( | const QDomElement & | e, | |
| InitModeFlags | modeFlags | |||
| ) | [virtual] |
Restore the AbstractElementAttribute state from a QDomElement created by domElement().
Note: Returns immediately if e.tagName() != key().
Uses setData(const QString&) to set the state.
Note: This function is thread-safe (as it only calls setData(const QString&)).
See also domElement() and DomAccessibleState::initFromDomElement().
Reimplemented from DomAccessibleState.
| virtual QString AbstractElementAttribute::worker_toString | ( | ) | const [protected, pure virtual] |
Called and made thread-safe by toString().
Implemented in AbstractElementByteArray, AbstractElementDouble, AbstractElementInteger, AbstractElementString, DiagramElementCiderInfo, DiagramElementComment, DiagramElementInk, DiagramElementLabel, DiagramElementOrigin, DiagramElementPolygon, DiagramElementPos, DiagramElementRect, DiagramElementShape, and DiagramElementSize.
| virtual bool AbstractElementAttribute::worker_setData | ( | const QString & | data | ) | [protected, pure virtual] |
Called and made thread-safe by setData(const QString&).
Implemented in AbstractElementByteArray, AbstractElementDouble, AbstractElementInteger, AbstractElementString, DiagramElementCiderInfo, DiagramElementComment, DiagramElementInk, DiagramElementLabel, DiagramElementOrigin, DiagramElementPolygon, DiagramElementPos, DiagramElementRect, DiagramElementShape, and DiagramElementSize.
| virtual QVariant AbstractElementAttribute::worker_toVariant | ( | ) | const [protected, pure virtual] |
Called and made thread-safe by toVariant().
Implemented in AbstractElementByteArray, AbstractElementDouble, AbstractElementInteger, AbstractElementString, DiagramElementCiderInfo, DiagramElementComment, DiagramElementInk, DiagramElementLabel, DiagramElementOrigin, DiagramElementPolygon, DiagramElementPos, DiagramElementRect, DiagramElementShape, and DiagramElementSize.
| virtual bool AbstractElementAttribute::worker_setData | ( | const QVariant & | data | ) | [protected, pure virtual] |
Called and made thread-safe by setData(const QVariant&).
Implemented in AbstractElementByteArray, AbstractElementDouble, AbstractElementInteger, AbstractElementString, DiagramElementCiderInfo, DiagramElementComment, DiagramElementInk, DiagramElementLabel, DiagramElementOrigin, DiagramElementPolygon, DiagramElementPos, DiagramElementRect, DiagramElementShape, and DiagramElementSize.
QReadWriteLock AbstractElementAttribute::m_lock [mutable, protected] |
1.5.2