QMetaClassInfo Class
QMetaClassInfo 类提供了有关某个类的更多信息。更多内容...
| 头文件: | #include <QMetaClassInfo> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
| qmake: | QT += core |
公共函数
详细说明
类信息项是简单的名称-值对,通过在源代码中使用 `Q_CLASSINFO()` 进行指定。可通过 `name()` 和 `value()` 获取这些信息。例如:
class MyClass : public QObject
{
Q_OBJECT
Q_CLASSINFO("author", "Sabrina Schweinsteiger")
Q_CLASSINFO("url", "http://doc.moosesoft.co.uk/1.0/")
public:
//...
};您可以在 Qt 应用程序中自由使用此机制。
注意: Active Qt、 Qt D-Bus、 Qt Qml和 Qt Remote Objects 模块也使用该机制。使用这些模块时,可能会设置某些键。
另请参阅 QMetaObject 。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.