QQmlSA::Element Class

class QQmlSA::Element

代表 QML 类型。更多

头文件: #include <Element>
CMake: find_package(Qt6 REQUIRED COMPONENTS QmlCompiler)
target_link_libraries(mytarget PRIVATE Qt6::QmlCompiler)
状态: 技术预览技术预览

公共函数

Element()
Element(const QQmlSA::Element &other)
Element(QQmlSA::Element &&other)
~Element()
QQmlSA::AccessSemantics accessSemantics() const
QQmlSA::Element baseType() const
QString baseTypeName() const
QString defaultPropertyName() const
QString filePath() const
bool hasMethod(const QString &methodName) const
bool hasOwnProperty(const QString &propertyName) const
bool hasOwnPropertyBindings(const QString &propertyName) const
bool hasProperty(const QString &propertyName) const
bool hasPropertyBindings(const QString &name) const
bool inherits(const QQmlSA::Element &element) const
bool isComposite() const
bool isFileRootComponent() const
bool isNull() const
bool isPropertyRequired(const QString &propertyName) const
QString name() const
QQmlSA::Method::Methods ownMethods() const
QQmlSA::Binding::Bindings ownPropertyBindings() const
QQmlSA::Binding::Bindings ownPropertyBindings(const QString &propertyName) const
QQmlSA::Element parentScope() const
QQmlSA::Property property(const QString &propertyName) const
QList<QQmlSA::Binding> propertyBindings(const QString &propertyName) const
QQmlSA::ScopeType scopeType() const
QQmlSA::SourceLocation sourceLocation() const
bool operator bool() const
bool operator!() const
QQmlSA::Element &operator=(QQmlSA::Element &&other)
QQmlSA::Element &operator=(const QQmlSA::Element &other)
qsizetype qHash(const QQmlSA::Element &key, qsizetype seed = 0)
bool operator!=(const QQmlSA::Element &lhs, const QQmlSA::Element &rhs)
bool operator==(const QQmlSA::Element &lhs, const QQmlSA::Element &rhs)

详细说明

成员函数文档

Element::Element()

构造一个新的元素对象。

Element::Element(const QQmlSA::Element &other)

创建other 的副本。

[noexcept] Element::Element(QQmlSA::Element &&other)

移动-构建一个元素实例。

[noexcept] Element::~Element()

摧毁元素。

QQmlSA::AccessSemantics Element::accessSemantics() const

返回该元素的访问语义。例如,引用、值或序列。

QQmlSA::Element Element::baseType() const

返回此元素派生的元素。

QString Element::baseTypeName() const

返回该元素派生的元素名称。

QString Element::defaultPropertyName() const

返回此元素的默认属性名称。如果没有,则返回空字符串。

QString Element::filePath() const

返回定义此元素的 QML 代码的文件路径。

bool Element::hasMethod(const QString &methodName) const

返回该元素是否有名称为methodName 的方法。

bool Element::hasOwnProperty(const QString &propertyName) const

返回该元素是否定义了名称为propertyName 的属性,该属性未在其基本对象或扩展对象中定义。

bool Element::hasOwnPropertyBindings(const QString &propertyName) const

Returns whether this Element has property bindings which are not defined in its base or extension objects and that have namepropertyName

bool Element::hasProperty(const QString &propertyName) const

返回该元素是否具有名称为propertyName 的属性。

bool Element::hasPropertyBindings(const QString &name) const

返回该元素是否具有名称为name 的属性绑定。

bool Element::inherits(const QQmlSA::Element &element) const

返回此元素是否继承自element

bool Element::isComposite() const

对于由 Qml 定义的对象,返回true ;对于由 C++ 声明的对象,返回false

bool Element::isFileRootComponent() const

返回该元素是否是其 QML 文件的根组件。

bool Element::isNull() const

如果该元素为空,则返回true ,否则返回false

bool Element::isPropertyRequired(const QString &propertyName) const

返回在此元素上解析的名称为propertyName 的属性是否为必填属性。如果找不到该属性,则返回 false。

QString Element::name() const

返回该元素的名称。

QQmlSA::Method::Methods Element::ownMethods() const

返回该元素的方法,这些方法未在其基本对象或扩展对象中定义。

QQmlSA::Binding::Bindings Element::ownPropertyBindings() const

返回该元素未在其基本对象或扩展对象上定义的属性绑定。

QQmlSA::Binding::Bindings Element::ownPropertyBindings(const QString &propertyName) const

Returns this Element's property bindings which are not defined on its base or extension objects and that have the namepropertyName. Returns this Element's property bindings which are not defined on its base or extension objects and that have the name .

QQmlSA::Element Element::parentScope() const

返回包围此元素的元素。

QQmlSA::Property Element::property(const QString &propertyName) const

如果在本元素或其基本对象和扩展对象中找到名称为propertyName 的属性,则返回该属性,否则返回无效属性。

QList<QQmlSA::Binding> Element::propertyBindings(const QString &propertyName) const

返回该元素名称为propertyName 的属性绑定。

QQmlSA::ScopeType Element::scopeType() const

返回 Element 作用域的类型。

QQmlSA::SourceLocation Element::sourceLocation() const

返回 QML 代码中定义此元素的位置。

[explicit] bool Element::operator bool() const

如果该元素不为空,则返回true ,否则返回false

bool Element::operator!() const

如果该元素为空,则返回true ,否则返回false

[noexcept] QQmlSA::Element &Element::operator=(QQmlSA::Element &&other)

移动-将other 指定给此元素实例。

QQmlSA::Element &Element::operator=(const QQmlSA::Element &other)

为该元素实例指定other

相关非成员

[noexcept] qsizetype qHash(const QQmlSA::Element &key, qsizetype seed = 0)

使用seed 作为计算种子,返回key 的哈希值。

bool operator!=(const QQmlSA::Element &lhs, const QQmlSA::Element &rhs)

如果lhsrhs 不相等,则返回true ,否则返回false

bool operator==(const QQmlSA::Element &lhs, const QQmlSA::Element &rhs)

如果lhsrhs 相等,则返回true ,否则返回false

© 2025 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.