45 #ifndef DATACONTRACTHELPER_H_
46 #define DATACONTRACTHELPER_H_
49 #include <QStringList>
50 #include <QVariantMap>
56 #define PROPERTYIMP( type, name ) \
57 private: type m_##name; \
63 void set##name(const type val) \
70 #define PROPERTYIMP_REF( type, name ) \
71 private: type m_##name; \
77 void set##name(const type& val) \
84 #define PROPERTYIMP_ENUM( type, name ) \
85 private: type m_##name; \
91 void set##name(const type val) \
95 void set##name( int val) \
97 m_##name = (type)val; \
102 #define PROPERTYIMP_PTR( type, name ) \
103 private: type* m_##name; \
107 if (m_##name == nullptr) \
108 m_##name = new type( this );\
114 #define PROPERTYIMP_RO_REF( type, name ) \
115 private: type m_##name; \
132 while( !list.isEmpty() )
134 QVariant vValue = list.takeFirst();
136 const QObject *pObject = vValue.value< QObject* >();
147 for (
const auto& vValue : std::as_const(src))
149 if ( vValue.canConvert< QObject* >())
151 const QObject *pObject = vValue.value< QObject* >();
153 if (pObject !=
nullptr)
155 QObject *pNew =
new T( pParent );
157 ((T *)pNew)->Copy( (
const T *)pObject );
159 dst.append( QVariant::fromValue<QObject *>( pNew ));