oopapidocs  2.0
DataObject Class Reference

Common base class for some cloneable reflectable data structures. More...

#include <dataobject.h>

Inheritance diagram for DataObject:

List of all members.

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 DataObjectclone (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)

Detailed Description

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.


Member Function Documentation

void DataObject::adoptChildren ( QObject *  wayward)

iterates through the wayward and steals all its children, reparenting them under "this"

Parameters:
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.

Returns:
the name of this object's class

Definition at line 128 of file dataobject.cpp.

References property().

Referenced by StdinReader::readProperties().

Here is the call graph for this function:

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.

Returns:
a newly allocated copy of *this

Should be overridden in derived classes.

Parameters:
deepif 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().

Here is the call graph for this function:

bool DataObject::equals ( const QObject &  left,
const QObject &  right,
bool  compareChildren = true 
) [static]
Parameters:
compareChildrenif true recursively checks children
Returns:
true if other has the same property values as this.

Definition at line 52 of file dataobject.cpp.

References propertyNames(), and toString().

Here is the call graph for this function:

uint DataObject::numProperties ( ) const [virtual]
Returns:
number of properties.
Parameters:
superclassinclude superclass inherited properties in the count (currently ignored)

Definition at line 153 of file dataobject.cpp.

References propertyNames().

Here is the call graph for this function:

QStringList DataObject::propertyNames ( ) const [virtual]
Returns:
a list of propertyNames, so that the user of DataObject does not need to use a QMetaObject just to get a list of property names.

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

Parameters:
propertyNamename of property to set
valuevalue to set property
Returns:
true if value satisfies the regexp constraint for this 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]
Returns:
human and machine readable representation of this object (XML format)

Reimplemented in Country.

Definition at line 11 of file dataobject.cpp.

References QObjectWriter::toString().

Referenced by equals().

Here is the call graph for this function:

bool DataObject::writeTo ( QObject &  dest) const [virtual]

writes all our properties into a QObject

Returns:
true if successful in setting all properties.

Definition at line 192 of file dataobject.cpp.

References property(), and propertyNames().

Referenced by clone().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Enumerations