libqmlbind
A C library for creating QML bindings for other languages easily through exporting objects to QML
Public Attributes | List of all members
qmlbind_client_callbacks Struct Reference

encapsulates client-side functions that are used from QML for C object creation, destruction, method calls and property modification. More...

#include <qmlbind_global.h>

Public Attributes

qmlbind_client_object *(* new_object )(qmlbind_client_class *classRef, qmlbind_signal_emitter *signalEmitter)
 creates a new qmlbind_client_object to be used in QML. More...
 
void(* delete_object )(qmlbind_client_object *object)
 deletes a qmlbind_client_object that was created by new_object.
 
qmlbind_value *(* call_method )(qmlbind_engine *engine, qmlbind_client_object *object, const char *name, int argc, const qmlbind_value *const *argv)
 executes the name method defined on the qmlbind_client_object, with argc parameters in argv, and returns the result. More...
 
qmlbind_value *(* get_property )(qmlbind_engine *engine, qmlbind_client_object *object, const char *name)
 returns the value of the name property of the object C object. Ownership must be transferred to the caller. More...
 
void(* set_property )(qmlbind_engine *engine, qmlbind_client_object *object, const char *name, const qmlbind_value *value)
 sets the value of the name property to of the object C object to value. More...
 

Detailed Description

encapsulates client-side functions that are used from QML for C object creation, destruction, method calls and property modification.

Those functions need to be implemented by libqmlbind's users for qmlbind_client_objects they want to expose to QML.

This struct is needed to construct new qmlbind_exporters. All function pointers need to be defined, a nullptr is not a valid value here.

Member Data Documentation

qmlbind_client_object*(* qmlbind_client_callbacks::new_object) (qmlbind_client_class *classRef, qmlbind_signal_emitter *signalEmitter)

creates a new qmlbind_client_object to be used in QML.

qmlbind_client_callbacks hands over the qmlbind_client_object returned from this function as object to call_method(), get_property() and set_property().

Parameters
classRefthe qmlbind_client_class value that was given to qmlbind_exporter_new. Does not transfer ownership.
signalEmittershould be stored in the returned object to be able to emit signals. Ownership is transfered.
Returns
the newly-created object, transfering ownership to libqmlbind.
qmlbind_value*(* qmlbind_client_callbacks::call_method) (qmlbind_engine *engine, qmlbind_client_object *object, const char *name, int argc, const qmlbind_value *const *argv)

executes the name method defined on the qmlbind_client_object, with argc parameters in argv, and returns the result.

If the method does not return a value, call_method() should return qmlbind_value_new_undefined().

Ownership of the result must be transfered to the caller.

Ownership of engine and object is not transfered.

engine is intended to be used to create new objects or arrays.

qmlbind_value*(* qmlbind_client_callbacks::get_property) (qmlbind_engine *engine, qmlbind_client_object *object, const char *name)

returns the value of the name property of the object C object. Ownership must be transferred to the caller.

In case the name property does not exist, you should return a qmlbind_value_new_undefined().

Ownership of engine and object is not transfered.

engine is intended to be used to create new objects or arrays.

void(* qmlbind_client_callbacks::set_property) (qmlbind_engine *engine, qmlbind_client_object *object, const char *name, const qmlbind_value *value)

sets the value of the name property to of the object C object to value.

Ownership of engine and object is not transfered.

engine is intended to be used to create new objects or arrays.


The documentation for this struct was generated from the following file: