mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-16 00:05:45 -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)
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user