Skip to content

Type Mappings

The types used for properties in .slint design markup each translate to specific types in C++. The follow table summarizes the entire mapping. The .slint types link to the Slint language reference:

.slint TypeC++ TypeNote
intint
floatfloat
boolbool
stringslint::SharedStringA reference-counted string type that uses UTF-8 encoding and can be easily converted to a std::string_view or a const char *.
colorslint::Color
brushslint::Brush
imageslint::Image
physical_lengthfloatThe unit are physical pixels.
lengthfloatAt run-time, logical lengths are automatically translated to physical pixels using the device pixel ratio.
durationstd::int64_tAt run-time, durations are always represented as signed 64-bit integers with millisecond precision.
anglefloatThe angle in degrees.
relative-font-sizefloatRelative font size factor that is multiplied with the Window.default-font-size and can be converted to a length.
structureA class of the same nameThe order of the data member are in the same as in the slint declaration.
anonymous objectA std::tupleThe fields are in alphabetical order.
enumAn enum classThe values are always converted to CamelCase. The order of the values is the same as in the declaration.
data-transferslint::DataTransferData associated with a drag-drop transfer.
styled-textslint::StyledTextStyled text parsed from markdown or plain text. Use StyledText::from_markdown() or StyledText::from_plain_text() to create.
Pointslint::LogicalPositionA struct with x and y fields, representing logical coordinates.

The Slint compiler generates a class with all data members in the same order for any user-defined, exported struct in the .slint code.

For example, this struct in a .slint file

export struct MyStruct {
foo: int,
bar: string,
}
slint

will generate the following type in C++:

class MyStruct {
public:
int foo;
slint::SharedString bar;
};
C++

The Slint compiler generates an enum class with all values in the same order and converted to camel case for any user-defined, exported enum in the .slint code.

For example, this enum in a .slint file

export enum MyEnum { alpha, beta-gamma, omicron }
slint

will generate the following type in C++:

enum class MyEnum { Alpha, BetaGamma, Omicron };
C++

© 2026 SixtyFPS GmbH