mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-30 22:01:13 +00:00
Fix read-access through C++ interpreter to models declared as arrays
Arrays declared in .60 are mapped to a SharedVectorModel<Value> in order to permit for write access. They can also be turned intoValue::Array / SharedVector<Value> very cheaply, when reading from C++.
This commit is contained in:
parent
99644a741a
commit
b6492b02e8
5 changed files with 132 additions and 14 deletions
|
@ -419,8 +419,10 @@ inline Value::Value(const sixtyfps::SharedVector<Value> &array)
|
|||
|
||||
inline std::optional<sixtyfps::SharedVector<Value>> Value::to_array() const
|
||||
{
|
||||
if (auto *array = cbindgen_private::sixtyfps_interpreter_value_to_array(&inner)) {
|
||||
return *reinterpret_cast<const sixtyfps::SharedVector<Value> *>(array);
|
||||
sixtyfps::SharedVector<Value> array;
|
||||
if (cbindgen_private::sixtyfps_interpreter_value_to_array(
|
||||
&inner, &reinterpret_cast<sixtyfps::SharedVector<ValueOpaque> &>(array))) {
|
||||
return array;
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue