Skip to content

slint::interpreter::ComponentDefinition Class

class ComponentDefinition;
C++
#include <slint-interpreter.h>
C++

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.

slint::interpreter::ComponentDefinition::ComponentDefinition(const ComponentDefinition &other)

Constructs a new ComponentDefinition as a copy of other.

ComponentDefinition & slint::interpreter::ComponentDefinition::operator=(const ComponentDefinition &other)

Assigns other to this ComponentDefinition.

slint::interpreter::ComponentDefinition::~ComponentDefinition()

Destroys this ComponentDefinition.

ComponentHandle< ComponentInstance > slint::interpreter::ComponentDefinition::create() const

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

slint::SharedVector< PropertyDescriptor > slint::interpreter::ComponentDefinition::properties() const

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

slint::SharedVector< slint::SharedString > slint::interpreter::ComponentDefinition::callbacks() const

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

slint::SharedVector< slint::SharedString > slint::interpreter::ComponentDefinition::functions() const

Returns a vector of strings that describe the list of public functions that can be invoked using ComponentInstance::invoke.

slint::SharedString slint::interpreter::ComponentDefinition::name() const

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

slint::SharedVector< slint::SharedString > slint::interpreter::ComponentDefinition::globals() const

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

std::optional< slint::SharedVector< PropertyDescriptor > > slint::interpreter::ComponentDefinition::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.

std::optional< slint::SharedVector< slint::SharedString > > slint::interpreter::ComponentDefinition::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.

std::optional< slint::SharedVector< slint::SharedString > > slint::interpreter::ComponentDefinition::global_functions(std::string_view global_name) const

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


© 2026 SixtyFPS GmbH