16 #include <QMetaClassInfo>
86 m_pXmlWriter->writeAttribute(
"xmlns:xsi",
"http://www.w3.org/2001/XMLSchema-instance" );
91 const QMetaObject *pMeta = pObject->metaObject();
96 nIdx = pMeta->indexOfClassInfo(
"version" );
99 m_pXmlWriter->writeAttribute(
"version", pMeta->classInfo( nIdx ).value() );
119 const QVariant &vValue,
120 const QMetaObject *pMetaParent,
121 const QMetaProperty *pMetaProp )
125 if ((pMetaProp !=
nullptr) &&
126 (pMetaProp->isEnumType() || pMetaProp->isFlagType()))
141 const QVariant &vValue,
142 const QMetaProperty *pMetaProp )
145 QMetaEnum metaEnum = pMetaProp->enumerator();
147 if (pMetaProp->isFlagType())
148 sValue = metaEnum.valueToKeys( vValue.toInt() );
150 sValue = metaEnum.valueToKey ( vValue.toInt() );
154 if (sValue.isEmpty())
155 sValue = vValue.toString();
172 if ( vValue.canConvert< QObject* >())
174 const QObject *pObject = vValue.value< QObject* >();
184 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
185 auto type =
static_cast<QMetaType::Type
>(vValue.type());
187 auto type = vValue.typeId();
191 case QMetaType::QVariantList:
197 case QMetaType::QStringList:
203 case QMetaType::QVariantMap:
209 case QMetaType::QDateTime:
211 QDateTime dt( vValue.toDateTime() );
239 QListIterator< QVariant > it( list );
243 QVariant vValue = it.next();
260 QListIterator< QString > it( list );
277 QMapIterator< QString, QVariant > it( map );
311 QString sTypeName( sName );
313 if ((sName.length() > 0) && (sName.at(0) ==
'Q'))
314 sTypeName = sName.mid( 1 );
316 sTypeName.remove(
"DTC::" );
317 sTypeName.remove( QChar(
'*') );
327 const QMetaObject *pMetaObject,
328 const QMetaProperty * )
335 nClassIdx = pMetaObject->indexOfClassInfo( sName.toLatin1() );
339 QString sOptionData = pMetaObject->classInfo( nClassIdx ).value();
340 QStringList sOptions = sOptionData.split(
';' );
344 if (sNameOption.isEmpty())
347 if (!sNameOption.isEmpty())
353 QString sTypeName( sName );
355 if ((sName.length() > 0) && (sName.at(0) ==
'Q'))
356 sTypeName = sName.mid( 1 );
358 sTypeName.remove(
"DTC::" );
359 sTypeName.remove( QChar(
'*') );
370 QString sKey = sName +
"=";
372 auto hasKey = [&sKey](
const QString& o) {
return o.startsWith( sKey ); };
373 auto it = std::find_if(sOptions.cbegin(), sOptions.cend(), hasKey);
374 if (it != sOptions.cend())
375 return (*it).mid( sKey.length() );