oopapidocs
2.0
|
Common base class for some cloneable reflectable data structures. More...
#include <dataobject.h>
Public Slots | |
virtual bool | setProperty (const QString &propName, const QVariant &qv) |
overloaded for QString | |
Signals | |
void | dataObjectChanged (const QString &name) |
Emitted to interested models that use it (in particular, the DataObjectTableModel) | |
Public Member Functions | |
virtual bool | writeTo (QObject &dest) const |
writes all our properties into a QObject | |
void | adoptChildren (QObject *wayward) |
iterates through the wayward and steals all its children, reparenting them under "this" | |
virtual QString | className () const |
We can't virtually override QObject::className(), but we override it anyway. | |
virtual QStringList | propertyNames () const |
virtual uint | numProperties () const |
virtual QString | toString () const |
virtual QVariant | property (QString name) const |
overloaded to support QString | |
virtual DataObject * | clone (bool deep=false) const |
Polymorphic clone() method - its proper behavior is to copy all properties from *this into the new copy. | |
Static Public Member Functions | |
static bool | equals (const QObject &left, const QObject &right, bool compareChildren=true) |
Common base class for some cloneable reflectable data structures.
Provides some convenience methods for accesing metadata, used by other classes such as the DataObjectTableModel.
It is by no means necessary to derive from this class for your own code - QObject might be sufficient.
DataObject dates back to the Qt3 days when the QObject class had fewer features.
Definition at line 22 of file dataobject.h.
void DataObject::adoptChildren | ( | QObject * | wayward | ) |
iterates through the wayward and steals all its children, reparenting them under "this"
wayward | - another QObject which has children we wish to add to this. The wayward loses children. |
Definition at line 45 of file dataobject.cpp.
QString DataObject::className | ( | ) | const [virtual] |
We can't virtually override QObject::className(), but we override it anyway.
In DataObject, it is virtual, so it can return something else in derived classes.
Definition at line 128 of file dataobject.cpp.
References property().
Referenced by StdinReader::readProperties().
DataObject * DataObject::clone | ( | bool | deep = false | ) | const [virtual] |
Polymorphic clone() method - its proper behavior is to copy all properties from *this into the new copy.
Should be overridden in derived classes.
deep | if true, makes clones of all the children and reconstructs the tree. |
Definition at line 174 of file dataobject.cpp.
References clone(), and writeTo().
Referenced by clone().
bool DataObject::equals | ( | const QObject & | left, |
const QObject & | right, | ||
bool | compareChildren = true |
||
) | [static] |
compareChildren | if true recursively checks children |
Definition at line 52 of file dataobject.cpp.
References propertyNames(), and toString().
uint DataObject::numProperties | ( | ) | const [virtual] |
superclass | include superclass inherited properties in the count (currently ignored) |
Definition at line 153 of file dataobject.cpp.
References propertyNames().
QStringList DataObject::propertyNames | ( | ) | const [virtual] |
Definition at line 140 of file dataobject.cpp.
Referenced by equals(), DataObjectTableModel::extractHeaders(), numProperties(), and writeTo().
bool DataObject::setProperty | ( | const QString & | propName, |
const QVariant & | qv | ||
) | [virtual, slot] |
overloaded for QString
propertyName | name of property to set |
value | value to set property |
NOTE: Qt3's QObject had these as virtual, but in Qt4, they are non-virtual. This means these methods will not be called if you use the QObject interface.
Definition at line 36 of file dataobject.cpp.
Referenced by StdinReader::readProperties().
QString DataObject::toString | ( | ) | const [virtual] |
Reimplemented in Country.
Definition at line 11 of file dataobject.cpp.
References QObjectWriter::toString().
Referenced by equals().
bool DataObject::writeTo | ( | QObject & | dest | ) | const [virtual] |
writes all our properties into a QObject
Definition at line 192 of file dataobject.cpp.
References property(), and propertyNames().
Referenced by clone().