mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
committed by
Mathew Sutcliffe
parent
ab46ed615c
commit
51e8a6a208
@@ -119,6 +119,8 @@ namespace BlackMisc
|
||||
|
||||
void CVariant::convertFromJson(const QJsonObject &json)
|
||||
{
|
||||
// Remark: Names "type" and "value" are also used for drag and drop
|
||||
// Changing the names here requires the change for drag and drop too
|
||||
QString typeName = json.value("type").toString();
|
||||
int typeId = QMetaType::type(qPrintable(typeName));
|
||||
|
||||
|
||||
@@ -50,12 +50,19 @@ namespace BlackMisc
|
||||
Private::MetaTypeHelper<Derived>::maybeRegisterMetaType();
|
||||
}
|
||||
|
||||
//! Returns the Qt meta type ID of this object.
|
||||
//! Returns the Qt meta type ID of this object
|
||||
//! \remark for CVariant this returns the id of CVariant, not of the encapsulated object. valueVariant.userType()` returns metatype of the contained object
|
||||
int getMetaTypeId() const
|
||||
{
|
||||
return Private::MetaTypeHelper<Derived>::maybeGetMetaTypeId();
|
||||
}
|
||||
|
||||
//! Class name
|
||||
QString getClassName() const
|
||||
{
|
||||
return QMetaType::typeName(getMetaTypeId());
|
||||
}
|
||||
|
||||
//! Returns true if this object is an instance of the class with the given meta type ID, or one of its subclasses.
|
||||
bool isA(int metaTypeId) const
|
||||
{
|
||||
@@ -79,6 +86,7 @@ namespace BlackMisc
|
||||
# define BLACKMISC_DECLARE_USING_MIXIN_METATYPE(DERIVED) \
|
||||
using ::BlackMisc::Mixin::MetaType<DERIVED>::registerMetadata; \
|
||||
using ::BlackMisc::Mixin::MetaType<DERIVED>::getMetaTypeId; \
|
||||
using ::BlackMisc::Mixin::MetaType<DERIVED>::getClassName; \
|
||||
using ::BlackMisc::Mixin::MetaType<DERIVED>::isA;
|
||||
|
||||
} // Mixin
|
||||
|
||||
Reference in New Issue
Block a user