mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-30 22:01:13 +00:00
parent
74bc9521b9
commit
07bf0974d7
5 changed files with 51 additions and 1 deletions
|
@ -383,6 +383,17 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns a std::optional that contains an Image if the type of this Value is
|
||||
/// Type::Image, otherwise an empty optional is returned.
|
||||
std::optional<Image> to_image() const
|
||||
{
|
||||
if (auto *img = cbindgen_private::sixtyfps_interpreter_value_to_image(&inner)) {
|
||||
return *reinterpret_cast<const Image *>(img);
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
// template<typename T> std::optional<T> get() const;
|
||||
|
||||
/// Constructs a new Value that holds the double \a value.
|
||||
|
@ -409,6 +420,12 @@ public:
|
|||
cbindgen_private::sixtyfps_interpreter_value_new_struct(&struc.inner, &inner);
|
||||
}
|
||||
|
||||
/// Constructs a new Value that holds the Image \a img.
|
||||
Value(const Image &img)
|
||||
{
|
||||
cbindgen_private::sixtyfps_interpreter_value_new_image(&img, &inner);
|
||||
}
|
||||
|
||||
/// Returns the type the variant holds.
|
||||
Type type() const { return cbindgen_private::sixtyfps_interpreter_value_type(&inner); }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue