mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 02:39:28 +00:00
Replace sixtyfps::
almost everywhere
This commit is contained in:
parent
323dc8f66b
commit
fc6b7cc966
7 changed files with 42 additions and 42 deletions
|
@ -20,7 +20,7 @@ and lowest memory consumption.
|
|||
The `slint_target_sources` cmake command makes the translation automatic
|
||||
and [generated code](generated_code.md) has an API that allows setting and getting
|
||||
property values, etc. That API will use types from the {ref}`sixtyfps <namespace_sixtyfps>`
|
||||
namespace, for example {cpp:class}`sixtyfps::SharedString` or {cpp:class}`sixtyfps::Color`.
|
||||
namespace, for example {cpp:class}`slint::SharedString` or {cpp:class}`slint::Color`.
|
||||
|
||||
## Run-time interpreted `.slint` designs
|
||||
|
||||
|
@ -28,29 +28,29 @@ Instead of compiling `.slint` designs to C++, you can also choose to dynamically
|
|||
files at run-time. This is slower than compiling them ahead of time and requires more memory,
|
||||
however it provides more flexibility in your application design.
|
||||
|
||||
The entry point to loading a `.slint` file is the {cpp:class}`sixtyfps::interpreter::ComponentCompiler`
|
||||
class in the {ref}`sixtyfps::interpreter <namespace_sixtyfps__interpreter>` namespace.
|
||||
The entry point to loading a `.slint` file is the {cpp:class}`slint::interpreter::ComponentCompiler`
|
||||
class in the {ref}`slint::interpreter <namespace_sixtyfps__interpreter>` namespace.
|
||||
|
||||
With the help of {cpp:class}`sixtyfps::interpreter::ComponentCompiler` you create a {cpp:class}`sixtyfps::interpreter::ComponentDefinition`,
|
||||
With the help of {cpp:class}`slint::interpreter::ComponentCompiler` you create a {cpp:class}`slint::interpreter::ComponentDefinition`,
|
||||
which provides you with information about properties and callbacks that are common to all instances. The
|
||||
{cpp:func}`sixtyfps::interpreter::ComponentDefinition::create()` function creates new instances, which
|
||||
are wrapped in {cpp:class}`sixtyfps::ComponentHandle`. This is a smart pointer that owns the actual instance
|
||||
and keeps it alive as long as at least one {cpp:class}`sixtyfps::ComponentHandle` is in scope, similar to `std::shared_ptr<T>`.
|
||||
{cpp:func}`slint::interpreter::ComponentDefinition::create()` function creates new instances, which
|
||||
are wrapped in {cpp:class}`slint::ComponentHandle`. This is a smart pointer that owns the actual instance
|
||||
and keeps it alive as long as at least one {cpp:class}`slint::ComponentHandle` is in scope, similar to `std::shared_ptr<T>`.
|
||||
|
||||
All property values in `.slint` are mapped to {cpp:class}`sixtyfps::interpreter::Value` in C++. This is a
|
||||
All property values in `.slint` are mapped to {cpp:class}`slint::interpreter::Value` in C++. This is a
|
||||
polymorphic data type that can hold different kinds of values, such as numbers, strings or even data models.
|
||||
|
||||
For more complex UIs it is common to supply data in the form of an abstract data model, that is used with
|
||||
[`for` - `in`](markdown/langref.md#repetition) repetitions or [`ListView`](markdown/widgets.md#listview) elements in the `.slint` language.
|
||||
All models in C++ with the interpreter API are sub-classes of the {cpp:class}`sixtyfps::Model` where the template
|
||||
parameter is {cpp:class}`sixtyfps::interpreter::Value`. Therefore to provide your own data model, you can subclass
|
||||
`sixtyfps::Model<sixtyfps::interpreter::Value>`.
|
||||
All models in C++ with the interpreter API are sub-classes of the {cpp:class}`slint::Model` where the template
|
||||
parameter is {cpp:class}`slint::interpreter::Value`. Therefore to provide your own data model, you can subclass
|
||||
`slint::Model<slint::interpreter::Value>`.
|
||||
|
||||
In `.slint` files it is possible to declare [singletons that are globally available](markdown/langref.md#global-singletons).
|
||||
You can access them from to your C++ code by exporting them and using the getter and setter functions on
|
||||
{cpp:class}`sixtyfps::interpreter::ComponentInstance` to change properties and callbacks:
|
||||
{cpp:class}`slint::interpreter::ComponentInstance` to change properties and callbacks:
|
||||
|
||||
1. {cpp:func}`sixtyfps::interpreter::ComponentInstance::set_global_property()`
|
||||
1. {cpp:func}`sixtyfps::interpreter::ComponentInstance::get_global_property()`
|
||||
1. {cpp:func}`sixtyfps::interpreter::ComponentInstance::set_global_callback()`
|
||||
1. {cpp:func}`sixtyfps::interpreter::ComponentInstance::invoke_global_callback()`
|
||||
1. {cpp:func}`slint::interpreter::ComponentInstance::set_global_property()`
|
||||
1. {cpp:func}`slint::interpreter::ComponentInstance::get_global_property()`
|
||||
1. {cpp:func}`slint::interpreter::ComponentInstance::set_global_callback()`
|
||||
1. {cpp:func}`slint::interpreter::ComponentInstance::invoke_global_callback()`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue