QMetaClassInfo 类

QMetaClassInfo 类提供有关类的额外信息。 更多...

头: #include <QMetaClassInfo>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core

公共函数

const char * name () const
const char * value () const

详细描述

类信息项是简单的 namevalue 对,其被指定使用 Q_CLASSINFO () 在源代码中。信息可以被检索,使用 name () 和 value ()。例如:

class MyClass
{
    Q_OBJECT
    Q_CLASSINFO("author", "Sabrina Schweinsteiger")
    Q_CLASSINFO("url", "http://doc.moosesoft.co.uk/1.0/")
public:
    ...
};
					

This mechanism is free for you to use in your Qt applications.

注意: It's also used by the Active Qt , Qt D-Bus , Qt QML ,和 Qt Remote Objects modules. Some keys might be set when using these modules.

另请参阅 QMetaObject .

成员函数文档编制

const char *QMetaClassInfo:: name () const

返回此项的名称。

另请参阅 value ().

const char *QMetaClassInfo:: value () const

返回此项的值。

另请参阅 name ().