- Qt 6.10
- Qt QML Compiler
- C++ Classes
- QtQmlCompiler (Technical Preview)
- Element
- Qt 6.10.2 Reference Documentation

# QQmlSA::Element Class

class QQmlSA::Element

Represents a QML type. More...

Header: | `#include <Element>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS QmlCompiler)` `target_link_libraries(mytarget PRIVATE Qt6::QmlCompiler)`
Status: | Technical Preview

- List of all members, including inherited members

## Public Functions

| 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
QQmlSA::SourceLocation | idSourceLocation() 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)

## Related Non-Members

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)

## Detailed Description

## Member Function Documentation

### Element::Element()

Constructs a new Element object.

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

Creates a copy of other.

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

Move-constructs an Element instance.

### `[noexcept]` Element::~Element()

Destroys the element.

### QQmlSA::AccessSemantics Element::accessSemantics() const

Returns the access semantics of this Element. For example, Reference, Value or Sequence.

### QQmlSA::Element Element::baseType() const

Returns the Element this Element derives from.

### QString Element::baseTypeName() const

Returns the name of the Element this Element derives from.

### QString Element::defaultPropertyName() const

Returns the name of the default property of this Element. If it doesn't have one, returns an empty string.

### QString Element::filePath() const

Returns the file path of the QML code that defines this Element.

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

Returns whether this Element has a method with the name methodName.

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

Returns whether this Element defines a property with the name propertyName which is not defined on its base or extension objects.

### 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 name propertyName.

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

Returns whether this Element has a property with the name propertyName.

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

Returns whether this Element has a property binding with the name name.

### QQmlSA::SourceLocation Element::idSourceLocation() const

Returns the location in the QML code where this Element is assigned its id, if it has one.

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

Returns whether this Element inherits from element.

### bool Element::isComposite() const

Returns `true` for objects defined from Qml, and `false` for objects declared from C++.

### bool Element::isFileRootComponent() const

Returns whether this Element is the root component of its QML file.

### bool Element::isNull() const

Returns `true` if this element is null, `false` otherwise.

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

Returns whether the property with the name propertyName resolved on this Element is required. Returns false if the the property couldn't be found.

### QString Element::name() const

Returns the name of this Element.

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

Returns this Elements's methods, which are not defined on its base or extension objects.

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

Returns this Element's property bindings which are not defined on its base or extension objects.

### 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 name propertyName.

### QQmlSA::Element Element::parentScope() const

Returns the Element that encloses this Element.

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

Returns the property with the name propertyName if it is found in this Element or its base and extension objects, otherwise returns an invalid property.

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

Returns this Element's property bindings that have the name propertyName.

### QQmlSA::ScopeType Element::scopeType() const

Returns the type of Element's scope.

### QQmlSA::SourceLocation Element::sourceLocation() const

Returns the location in the QML code where this Element is defined.

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

Returns `true` if this element is not null, `false` otherwise.

### bool Element::operator!() const

Returns `true` if this element is null, `false` otherwise.

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

Move-assigns other to this Element instance.

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

Assigns other to this element instance.

## Related Non-Members

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

Returns the hash for key using seed to seed the calculation.

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

Returns `true` if lhs and rhs are not equal, and `false` otherwise.

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

Returns `true` if lhs and rhs are equal, and `false` otherwise.