libqmlbind
A C library for creating QML bindings for other languages easily through exporting objects to QML
|
encapsulates a QML component definition. More...
Files | |
file | component.h |
Contains all methods defined on qmlbind_component. | |
Classes | |
struct | qmlbind_component |
an opaque struct mainly used as self argument in the methods defined in qmlbind_component. More... | |
Functions | |
QMLBIND_API qmlbind_component * | qmlbind_component_new (qmlbind_engine *engine) |
Create a new qmlbind_component with no data. More... | |
QMLBIND_API void | qmlbind_component_release (qmlbind_component *self) |
Destroys the qmlbind_component . More... | |
QMLBIND_API void | qmlbind_component_load_path (qmlbind_component *self, const char *path) |
Sets the qmlbind_component to use the QML code loaded from the provided file path. More... | |
QMLBIND_API void | qmlbind_component_load_url (qmlbind_component *self, const char *url) |
Sets the qmlbind_component to use the QML code loaded from the provided URL. More... | |
QMLBIND_API void | qmlbind_component_set_data (qmlbind_component *self, const char *data, const char *path) |
QMLBIND_API qmlbind_string * | qmlbind_component_get_error_string (qmlbind_component *self) |
Returns a human-readable description of any error. More... | |
QMLBIND_API qmlbind_value * | qmlbind_component_create (qmlbind_component *self) |
Create an object instance from this component. Returns a nullptr if creation failed. More... | |
encapsulates a QML component definition.
Components are reusable, encapsulated QML types with well-defined interfaces.
You can find a simple usage example in examples/hello_world_window
.
libqmlbind's equivalent of QQmlComponent.
QMLBIND_API qmlbind_component* qmlbind_component_new | ( | qmlbind_engine * | engine | ) |
Create a new qmlbind_component
with no data.
Use qmlbind_component_set_data
or qmlbind_component_load_path
to load QML code into the component.
libqmlbind's equivalent of QQmlComponent::QQmlComponent.
QMLBIND_API void qmlbind_component_release | ( | qmlbind_component * | self | ) |
Destroys the qmlbind_component
.
libqmlbind's equivalent of QQmlComponent::~QQmlComponent.
QMLBIND_API void qmlbind_component_load_path | ( | qmlbind_component * | self, |
const char * | path | ||
) |
Sets the qmlbind_component
to use the QML code loaded from the provided file path.
libqmlbind's equivalent of QQmlComponent::loadUrl using QUrl::fromLocalFile for path parsing.
QMLBIND_API void qmlbind_component_load_url | ( | qmlbind_component * | self, |
const char * | url | ||
) |
Sets the qmlbind_component
to use the QML code loaded from the provided URL.
libqmlbind's equivalent of QQmlComponent::loadUrl.
QMLBIND_API void qmlbind_component_set_data | ( | qmlbind_component * | self, |
const char * | data, | ||
const char * | path | ||
) |
Sets the qmlbind_component
to use the given QML data
.
If url
is provided, it is used to set the component name and to provide a base path for items resolved by this component.
libqmlbind's equivalent of QQmlComponent::setData using QUrl::fromLocalFile for path parsing.
QMLBIND_API qmlbind_string* qmlbind_component_get_error_string | ( | qmlbind_component * | self | ) |
Returns a human-readable description of any error.
The string includes the file, location, and description of each error. If multiple errors are present, they are separated by a newline character.
The ownership of the returned string is transferred to the caller.
If no errors are present, an nullptr is returned.
libqmlbind's equivalent of qtqml-component's errorString
QMLBIND_API qmlbind_value* qmlbind_component_create | ( | qmlbind_component * | self | ) |
Create an object instance from this component. Returns a nullptr if creation failed.
All instances will be created in the qmlbind_engine
's root context.
The ownership of the returned object instance is transferred to the caller.
libqmlbind's equivalent of QQmlComponent::create.