Skip to content

slint::interpreter::Struct Struct

struct Struct;
C++
#include <slint-interpreter.h>
C++

This type represents a runtime instance of structure in .slint.

This can either be an instance of a name structure introduced with the struct keyword in the .slint file, or an anonymous struct written with the { key: value, } notation.

It can be constructed with the range constructor or initializer lst, and converted into or from a Value with the Value constructor and Value::to_struct().

slint::interpreter::Struct::Struct()

Constructs a new empty struct. You can add fields with set_field() and read them with get_field().

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

Creates a new Struct as a copy from other. All fields are copied as well.

slint::interpreter::Struct::Struct(Struct &&other)

Creates a new Struct by moving all fields from other into this struct.

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

Assigns all the fields of other to this struct.

Struct & slint::interpreter::Struct::operator=(Struct &&other)

Moves all the fields of other to this struct.

slint::interpreter::Struct::~Struct()

Destroys this struct.

slint::interpreter::Struct::Struct(std::initializer_list< std::pair< std::string_view, Value > > args)

Creates a new struct with the fields of the std::initializer_list given by args.

slint::interpreter::Struct::Struct(InputIterator it, InputIterator end)

Creates a new struct with the fields produced by the iterator it. it is advanced until it equals end.

iterator slint::interpreter::Struct::begin() const

Returns an iterator over the fields of the struct.

iterator slint::interpreter::Struct::end() const

Returns an iterator that when compared with an iterator returned by begin() can be used to detect when all fields have been visited.

std::optional< Value > slint::interpreter::Struct::get_field(std::string_view name) const

Returns the value of the field with the given name; Returns an std::optional without value if the field does not exist.

void slint::interpreter::Struct::set_field(std::string_view name, const Value &value)

Sets the value of the field with the given name to the specified value. If the field does not exist yet, it is created; otherwise the existing field is updated to hold the new value.


© 2026 SixtyFPS GmbH