mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-02 12:58:23 +00:00
Fix C++ build
With ImageInner::StaticTextures (the variant) and StaticTextures (the struct), we need to disambiguate for the generated enum contructor functions. This is done by prefixing the enum variant with their name.
This commit is contained in:
parent
f1dae75d53
commit
583c7a1b80
4 changed files with 5 additions and 3 deletions
|
|
@ -227,6 +227,7 @@ fn gen_corelib(
|
|||
"slint_image_path",
|
||||
"SharedPixelBuffer",
|
||||
"SharedImageBuffer",
|
||||
"StaticTextures",
|
||||
],
|
||||
vec!["Color"],
|
||||
"slint_image_internal.h",
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ namespace slint {
|
|||
struct Image
|
||||
{
|
||||
public:
|
||||
Image() : data(Data::None()) { }
|
||||
Image() : data(Data::ImageInner_None()) { }
|
||||
|
||||
/// Load an image from an image file
|
||||
static Image load_from_path(const SharedString &file_path)
|
||||
{
|
||||
Image img;
|
||||
img.data = Data::AbsoluteFilePath(file_path);
|
||||
img.data = Data::ImageInner_AbsoluteFilePath(file_path);
|
||||
return img;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1944,7 +1944,7 @@ fn compile_expression(expr: &llr::Expression, ctx: &EvaluationContext) -> String
|
|||
crate::expression_tree::ImageReference::EmbeddedData { resource_id, extension } => {
|
||||
let symbol = format!("slint_embedded_resource_{}", resource_id);
|
||||
format!(
|
||||
r#"slint::Image(slint::cbindgen_private::types::ImageInner::EmbeddedData(slint::cbindgen_private::Slice<uint8_t>{{std::data({}), std::size({})}}, slint::cbindgen_private::Slice<uint8_t>{{const_cast<uint8_t *>(reinterpret_cast<const uint8_t *>(u8"{}")), {}}}))"#,
|
||||
r#"slint::Image(slint::cbindgen_private::types::ImageInner::ImageInner_EmbeddedData(slint::cbindgen_private::Slice<uint8_t>{{std::data({}), std::size({})}}, slint::cbindgen_private::Slice<uint8_t>{{const_cast<uint8_t *>(reinterpret_cast<const uint8_t *>(u8"{}")), {}}}))"#,
|
||||
symbol, symbol, escape_string(extension), extension.as_bytes().len()
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -236,6 +236,7 @@ pub struct StaticTextures {
|
|||
/// A resource is a reference to binary data, for example images. They can be accessible on the file
|
||||
/// system or embedded in the resulting binary. Or they might be URLs to a web server and a downloaded
|
||||
/// is necessary before they can be used.
|
||||
/// cbindgen:prefix-with-name
|
||||
#[derive(Clone, PartialEq, Debug)]
|
||||
#[repr(u8)]
|
||||
#[allow(missing_docs)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue