Class ComponentDefinition

Class Documentation

class ComponentDefinition

ComponentDefinition is a representation of a compiled component from .slint markup.

It can be constructed from a .slint file using the ComponentCompiler::build_from_path() or ComponentCompiler::build_from_source() functions. And then it can be instantiated with the create() function.

The ComponentDefinition acts as a factory to create new instances. When you’ve finished creating the instances it is safe to destroy the ComponentDefinition.

Public Functions

inline ComponentDefinition(const ComponentDefinition &other)

Constructs a new ComponentDefinition as a copy of other.

inline ComponentDefinition &operator=(const ComponentDefinition &other)

Assigns other to this ComponentDefinition.

inline ~ComponentDefinition()

Destroys this ComponentDefinition.

inline ComponentHandle<ComponentInstance> create() const

Creates a new instance of the component and returns a shared handle to it.

inline slint::SharedVector<PropertyDescriptor> properties() const

Returns a vector of that contains PropertyDescriptor instances that describe the list of public properties that can be read and written using ComponentInstance::set_property and ComponentInstance::get_property.

inline slint::SharedVector<slint::SharedString> callbacks() const

Returns a vector of strings that describe the list of public callbacks that can be invoked using ComponentInstance::invoke_callback and set using ComponentInstance::set_callback.

inline slint::SharedString name() const

Returns the name of this Component as written in the .slint file.

inline slint::SharedVector<slint::SharedString> globals() const

Returns a vector of strings with the names of all exported global singletons.

inline std::optional<slint::SharedVector<PropertyDescriptor>> global_properties(std::string_view global_name) const

Returns a vector of the property descriptors of the properties of the specified publicly exported global singleton. An empty optional is returned if there exists no exported global singleton under the specified name.

inline std::optional<slint::SharedVector<slint::SharedString>> global_callbacks(std::string_view global_name) const

Returns a vector of the names of the callbacks of the specified publicly exported global singleton. An empty optional is returned if there exists no exported global singleton under the specified name.