mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-17 00:09:36 -04:00
add createVariant method
This commit is contained in:
parent
567b4a91b9
commit
e1ca4b5478
@ -594,3 +594,13 @@ QVariant::Type QgsVariantUtils::metaTypeToVariantType( QMetaType::Type metaType
|
|||||||
// NOLINTEND(bugprone-branch-clone)
|
// NOLINTEND(bugprone-branch-clone)
|
||||||
return QVariant::Type::UserType;
|
return QVariant::Type::UserType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariant QgsVariantUtils::createVariant( QMetaType::Type metaType )
|
||||||
|
{
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
return QgsVariantUtils::metaTypeToVariantType( metaType );
|
||||||
|
#else
|
||||||
|
return QVariant( QMetaType( metaType ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -70,6 +70,14 @@ class CORE_EXPORT QgsVariantUtils
|
|||||||
*/
|
*/
|
||||||
static QVariant::Type metaTypeToVariantType( QMetaType::Type metaType ) SIP_SKIP;
|
static QVariant::Type metaTypeToVariantType( QMetaType::Type metaType ) SIP_SKIP;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to properly create a QVariant from a \a metaType
|
||||||
|
* Returns the created QVariant
|
||||||
|
* TODO QGIS 4 remove this method
|
||||||
|
*/
|
||||||
|
static QVariant createVariant( QMetaType::Type metaType ) SIP_SKIP;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QGSVARIANTUTILS_H
|
#endif // QGSVARIANTUTILS_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user