oopapidocs
2.0
|
00001 #ifndef DATAOBJECT_H 00002 #define DATAOBJECT_H 00003 00004 #include "dobjs_export.h" 00005 //start 00006 #include <QObject> 00007 #include <QVariant> 00008 #include <QMetaProperty> 00009 00020 //end 00021 00022 class DOBJS_EXPORT DataObject : public QObject { 00023 Q_OBJECT 00024 00025 public: 00026 //start 00027 public: 00028 Q_INVOKABLE explicit DataObject(QString name); 00029 Q_INVOKABLE explicit DataObject(QObject* parent=0); 00030 virtual ~DataObject(); 00031 virtual bool readFrom(const QObject& source); 00032 00037 virtual bool writeTo(QObject& dest) const; 00038 00045 void adoptChildren(QObject* wayward); 00046 00052 static bool equals(const QObject& left, const QObject& right, bool compareChildren=true) ; 00053 00054 00055 00056 DataObject& operator=(const DataObject& other); 00057 00058 00066 virtual QString className() const; 00067 00068 00073 virtual QStringList propertyNames() const; 00074 static QStringList propertyNames(const QObject*); 00075 00076 /* public convenience functions that return the QMetaProperty for a given 00077 propertyname (or index).. 00078 */ 00079 virtual QMetaProperty metaProperty(const QString& propname) const; 00080 virtual QMetaProperty metaProperty(int i) const; 00081 00087 virtual uint numProperties() const; 00088 00092 virtual QString toString() const; 00093 00095 virtual QVariant property( QString name ) const; 00096 virtual QVariant property( const char* name) const; 00107 virtual DataObject* clone(bool deep=false) const; 00108 signals: 00112 void dataObjectChanged(const QString& name); 00113 public slots: 00114 00125 virtual bool setProperty(const QString &propName, const QVariant &qv); 00126 virtual bool setProperty(const char* propName, const QVariant& qv); 00127 00128 }; 00129 //end 00130 DOBJS_EXPORT bool operator==(const QObject& left, const QObject& right) ; 00131 00132 00133 #endif // #ifndef DATAOBJECT_H