|
| | Components (std::function< void(ComponentFailure const &)> report={}) |
| | An empty set.
|
|
| ~Components () |
| | Releases the compiled components and the contained engine.
|
|
| Components (Components const &)=delete |
|
Components & | operator= (Components const &)=delete |
|
| Components (Components &&)=delete |
|
Components & | operator= (Components &&)=delete |
| void | addHost (std::string name, int version, QUrl const &source) |
| | Registers a host component, replacing one of the same name.
|
| void | addBundle (std::string name, std::string qml, std::string digest) |
| | Registers a bundle component, replacing one of the same name.
|
| std::expected< void, ComponentFailure > | restyle (QQmlEngine &engine, std::string const &kind, std::string const &component) |
| | Maps a built-in kind to a registered component, checking that the component declares every property and function of the kind's MorphUi component.
|
| std::unique_ptr< QQmlComponent > | restyled (QQmlEngine &engine, std::string const &type) |
| | The compiled component a restyle maps a MorphUi type to, for a backend to instantiate.
|
| std::expected< QQmlComponent *, ComponentFailure > | load (QQmlEngine &engine, std::string const &name, int minVersion=0) |
| | Compiles a registered component, or says why it cannot be used.
|
| void | report (ComponentFailure const &failure) |
| | Reports a failure, once per name and reason.
|
| std::vector< ComponentFailure > const & | failures () const noexcept |
| | Every failure reported so far, oldest first.
|
The QML components a client renders beside the built-in kinds (spec 5 §10).
- A host component is QML the client carries, registered by name and version. It loads into the backend's own engine, so it may import the application's other modules.
- A bundle component is QML text delivered in the application's bundle and named by its SHA-256 digest. It loads only when the text matches the digest, and compiles in a dedicated engine whose root context holds nothing, so it sees nothing but what is set on it.
- The restyle map names a component for a built-in kind, or for a part a built-in component draws (tableRow, a table row's background; tableHeader, a table's header background; scrollBar, a scroll area's bar; splitterHandle, a splitter's handle). The component must declare every property and function of its MorphUi base; one that does not is refused when it is mapped.
Each component reports its events through host.fire(event, payload), host being a var property it declares and the renderer sets. A component that fails to load is reported once, through the callback, and the caller renders its fallback. Neither copyable nor movable; it outlives every backend that uses it.
Definition at line 48 of file components.hpp.