mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-31 07:37:24 +00:00
C++: Added ComponentInstance::definition()
getter to retrieve the ComponentDefinition
for an instance
Fixes #4087
This commit is contained in:
parent
d104238cac
commit
75f24163ed
4 changed files with 34 additions and 0 deletions
|
@ -542,6 +542,8 @@ inline Struct::iterator::~iterator()
|
|||
}
|
||||
}
|
||||
|
||||
class ComponentDefinition;
|
||||
|
||||
/// The ComponentInstance represents a running instance of a component.
|
||||
///
|
||||
/// You can create an instance with the ComponentDefinition::create() function.
|
||||
|
@ -806,6 +808,9 @@ public:
|
|||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
/// Return the ComponentDefinition that was used to create this instance.
|
||||
inline ComponentDefinition definition() const;
|
||||
};
|
||||
|
||||
/// ComponentDefinition is a representation of a compiled component from .slint markup.
|
||||
|
@ -819,6 +824,7 @@ public:
|
|||
class ComponentDefinition
|
||||
{
|
||||
friend class ComponentCompiler;
|
||||
friend class ComponentInstance;
|
||||
|
||||
using ComponentDefinitionOpaque = slint::cbindgen_private::ComponentDefinitionOpaque;
|
||||
ComponentDefinitionOpaque inner;
|
||||
|
@ -925,6 +931,13 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
inline ComponentDefinition ComponentInstance::definition() const
|
||||
{
|
||||
cbindgen_private::ComponentDefinitionOpaque result;
|
||||
cbindgen_private::slint_interpreter_component_instance_component_definition(inner(), &result);
|
||||
return ComponentDefinition(result);
|
||||
}
|
||||
|
||||
/// ComponentCompiler is the entry point to the Slint interpreter that can be used
|
||||
/// to load .slint files or compile them on-the-fly from a string
|
||||
/// (using build_from_source()) or from a path (using build_from_source())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue