summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets/code
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2022-08-26 11:53:00 -0300
committerThiago Macieira <thiago.macieira@intel.com>2022-08-29 14:15:36 -0300
commit5ff637cc140abc07c4c7934fcd6a048a3d0aa66f (patch)
tree64f8ff2611fa0dc6b2f6c26832772cebbd8558a2 /src/corelib/doc/snippets/code
parent30489eb66195b84fadc422273d2454a69ffd322e (diff)
QMetaType/Doc: update some wording about type registration
Type registration isn't necessary any more, unless you're trying to look up a name back to ID or QMetaType object. It hasn't been since 6.0. Drive-by update the example not to use deprecated API. Drive-by remove the paragraph about requirements that aren't accurate any more. Pick-to: 6.4 Task-number: QTBUG-104858 Change-Id: Ic6547f8247454b47baa8fffd170eecb66719fa65 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/doc/snippets/code')
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_kernel_qmetatype.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qmetatype.cpp b/src/corelib/doc/snippets/code/src_corelib_kernel_qmetatype.cpp
index b66951357d..a213ccbca6 100644
--- a/src/corelib/doc/snippets/code/src_corelib_kernel_qmetatype.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qmetatype.cpp
@@ -35,12 +35,12 @@ MyStruct s2 = var.value<MyStruct>();
//! [3]
-int id = QMetaType::type("MyClass");
-if (id != QMetaType::UnknownType) {
- void *myClassPtr = QMetaType::create(id);
+QMetaType type = QMetaType::fromName("MyClass");
+if (type.isValid()) {
+ void *myClassPtr = type.create();
...
- QMetaType::destroy(id, myClassPtr);
- myClassPtr = 0;
+ type.destroy(myClassPtr);
+ myClassPtr = nullptr;
}
//! [3]