Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
DomBase Class Reference

Abstract class common to all elements of the Qml code model. More...

Collaboration diagram for DomBase:

Detailed Description

Abstract class common to all elements of the Qml code model.

DomBase represents the base class common to all objects exposed by the Dom Model through a DomItem. Single inheritence is mandatory for the inline items (Empty, Map, List, ConstantData, Reference), so that the base pointer of the object can be used a base pointer of the superclass directly.

The subclass must have a

constexpr static Kind kindValue

entry with its kind to enable casting usng the DomItem::as DomItem::ownerAs templates.

The minimal overload set to be usable consists of following methods: \list

  • {kind()} returns the kind of the current element:
    Kind kind() const override { return kindValue; }
  • {pathFromOwner()} returns the path from the owner to the current element
    Path pathFromOwner() const override;
  • {iterateDirectSubpaths} iterates the direct subpaths/children and returns false if a quick end was requested:
    bool iterateDirectSubpaths(const DomItem &self, function_ref<bool(Path, DomItem)>) const = 0;

\endlist

But you probably want to subclass either DomElement or OwningItem for your element. DomElement stores its pathFromOwner, and computes the canonicalPath from it and its owner. OwningItem is the unit for updates to the Dom model, exposed changes always change at least one OwningItem. They have their lifetime handled with shared_ptr and own (i.e. are responsible of freeing) other items in them.

See also
QQml::Dom::DomItem, QQml::Dom::DomElement, QQml::Dom::OwningItem

The documentation for this class was generated from the following file: