diff options
author | Jędrzej Nowacki <jedrzej.nowacki@qt.io> | 2018-09-24 13:58:43 +0200 |
---|---|---|
committer | Jędrzej Nowacki <jedrzej.nowacki@qt.io> | 2018-10-01 09:45:20 +0000 |
commit | dca3dd66b4b9f06403d22757f8957c3d8d57e845 (patch) | |
tree | 10f83860a289f62a4f53e3264d4edd252c2256cb /src/corelib/kernel/qmetatype.h | |
parent | 20a8a277ee0d507d2b9a369ab0c41d23ab8b2291 (diff) |
Expose type id from QMetaType instance
There is not reason why it should be kept in secret. Not having public
accessor forces a user code to keep a copy of the id. Visible for
example in QML (QQmlValueType).
Change-Id: If0de65fb8d91bcd50880c66b5f87c68f6d888dd3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qmetatype.h')
-rw-r--r-- | src/corelib/kernel/qmetatype.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index ed7feee775..0bf430bb26 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -570,6 +570,7 @@ public: inline bool isValid() const; inline bool isRegistered() const; + inline int id() const; inline int sizeOf() const; inline TypeFlags flags() const; inline const QMetaObject *metaObject() const; @@ -2221,6 +2222,11 @@ inline bool QMetaType::isRegistered() const return isValid(); } +inline int QMetaType::id() const +{ + return m_typeId; +} + inline void *QMetaType::create(const void *copy) const { // ### TODO Qt6 remove the extension |