DOtherSide
0.7.1
C language library for creating bindings for the Qt QML language
|
The DOtherSide types. More...
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
struct | DosQVariantArray |
Store an array of QVariant. More... | |
struct | QmlRegisterType |
The data needed for registering a custom type in the QML environment. More... | |
struct | ParameterDefinition |
Represents a parameter definition. More... | |
struct | SignalDefinition |
Represents a single signal definition. More... | |
struct | SignalDefinitions |
Represents a set of signal definitions. More... | |
struct | SlotDefinition |
Represents a single slot definition. More... | |
struct | SlotDefinitions |
Represents a set of slot definitions. More... | |
struct | PropertyDefinition |
Represents a single property definition. More... | |
struct | PropertyDefinitions |
Represents a set of property definitions. More... | |
struct | DosQAbstractItemModelCallbacks |
Incapsulate all the QAbstractItemModel callbacks. More... | |
Typedefs | |
typedef void | DosQVariant |
A pointer to a QVariant. | |
typedef void | DosQModelIndex |
A pointer to a QModelIndex. | |
typedef void | DosQAbstractItemModel |
A pointer to a QAbstractItemModel. | |
typedef void | DosQAbstractListModel |
A pointer to a QAbstractListModel. | |
typedef void | DosQAbstractTableModel |
A pointer to a QAbstractTableModel. | |
typedef void | DosQQmlApplicationEngine |
A pointer to a QQmlApplicationEngine. | |
typedef void | DosQQuickView |
A pointer to a QQuickView. | |
typedef void | DosQQmlContext |
A pointer to a QQmlContext. | |
typedef void | DosQHashIntQByteArray |
A pointer to a QHash<int,QByteArray> | |
typedef void | DosQUrl |
A pointer to a QUrl. | |
typedef void | DosQMetaObject |
A pointer to a QMetaObject. | |
typedef void | DosQObject |
A pointer to a QObject. | |
typedef void | DosQQuickImageProvider |
A pointer to a QQuickImageProvider. | |
typedef void | DosPixmap |
A pointer to a QPixmap. | |
typedef void | DosQPointer |
A pointer to a QPointer. | |
typedef void(* | RequestPixmapCallback) (const char *id, int *width, int *height, int requestedWidth, int requestedHeight, DosPixmap *result) |
typedef void(* | DObjectCallback) (void *self, DosQVariant *slotName, int argc, DosQVariant **argv) |
typedef void(* | RowCountCallback) (void *self, const DosQModelIndex *parent, int *result) |
typedef void(* | ColumnCountCallback) (void *self, const DosQModelIndex *parent, int *result) |
typedef void(* | DataCallback) (void *self, const DosQModelIndex *index, int role, DosQVariant *result) |
typedef void(* | SetDataCallback) (void *self, const DosQModelIndex *index, const DosQVariant *value, int role, bool *result) |
Called when the QAbstractItemModel::setData method must be executed. | |
typedef void(* | RoleNamesCallback) (void *self, DosQHashIntQByteArray *result) |
Called when the QAbstractItemModel::roleNames method must be executed. | |
typedef void(* | FlagsCallback) (void *self, const DosQModelIndex *index, int *result) |
Called when the QAbstractItemModel::flags method must be called. | |
typedef void(* | HeaderDataCallback) (void *self, int section, int orientation, int role, DosQVariant *result) |
Called when the QAbstractItemModel::headerData method must be called. | |
typedef void(* | IndexCallback) (void *self, int row, int column, const DosQModelIndex *parent, DosQModelIndex *result) |
Called when the QAbstractItemModel::index method must be called. | |
typedef void(* | ParentCallback) (void *self, const DosQModelIndex *child, DosQModelIndex *result) |
Called when the QAbstractItemModel::parent method must be called. | |
typedef void(* | HasChildrenCallback) (void *self, const DosQModelIndex *parent, bool *result) |
Called when the QAbstractItemModel::hasChildren method must be called. | |
typedef void(* | CanFetchMoreCallback) (void *self, const DosQModelIndex *parent, bool *result) |
Called when the QAbstractItemModel::canFetchMore method must be called. | |
typedef void(* | FetchMoreCallback) (void *self, const DosQModelIndex *parent) |
Called when the QAbstractItemModel::fetchMore method must be called. | |
typedef void(* | CreateDObject) (int id, void *wrapper, void **bindedQObject, void **dosQObject) |
Callback called from QML for creating a registered type. More... | |
typedef void(* | DeleteDObject) (int id, void *bindedQObject) |
Callback invoked from QML for deleting a registered type. More... | |
typedef struct DosQVariantArray | DosQVariantArray |
typedef struct QmlRegisterType | QmlRegisterType |
typedef struct ParameterDefinition | ParameterDefinition |
typedef struct SignalDefinition | SignalDefinition |
typedef struct SignalDefinitions | SignalDefinitions |
typedef struct SlotDefinition | SlotDefinition |
typedef struct SlotDefinitions | SlotDefinitions |
typedef struct PropertyDefinition | PropertyDefinition |
typedef struct PropertyDefinitions | PropertyDefinitions |
typedef struct DosQAbstractItemModelCallbacks | DosQAbstractItemModelCallbacks |
The DOtherSide types.
This file contains all the type definitions for structs and callbacks used by the DOtherSide library
typedef void( * ColumnCountCallback) (void *self, const DosQModelIndex *parent, int *result) |
Called when the QAbstractItemModel::columnCount method must be executed
self | The pointer to the QAbstractItemModel in the binded language | |
index | The parent DosQModelIndex | |
[out] | result | The rowCount result. This must be deferenced and filled from the binded language |
parent
QModelIndex is owned by the DOtherSide library thus it shouldn't be deleted result
arg is an out parameter so it shouldn't be deleted typedef void( * CreateDObject) (int id, void *wrapper, void **bindedQObject, void **dosQObject) |
Callback called from QML for creating a registered type.
When a type is created through the QML engine a new QObject "Wrapper"
is created. This becomes a proxy between the "default" QObject created through dos_qobject_create() and the QML engine. This imply that implementation for this callback should swap the DosQObject* stored in the binded language with the wrapper. At the end the wrapper becomes the owner of the original "default" DosQObject. Furthermore if the binding language is garbage collected you should disable (pin/ref) the original object and unref in the DeleteDObject() callback. Since the wrapper has been created from QML is QML that expect to free the memory for it thus it shouldn't be destroyed by the QObject in the binded language.
An example of implementation in pseudocode is:
id | This is the id for which we are requesting the creation. This is the same value that was returned during registration through the calls to dos_qdeclarative_qmlregistertype() or dos_qdeclarative_qmlregistersingletontype() |
wrapper | This is the QObject wrapper that should be stored by the binded language and to which forward the DOtherSide calls |
bindedQObject | This should be deferenced and assigned with the pointer of the QObject modeled in the binded language |
dosQObject | This should be deferenced and assigned with the DosQObject pointer you gained from calling the dos_qobject_create() function |
typedef void( * DataCallback) (void *self, const DosQModelIndex *index, int role, DosQVariant *result) |
Called when the QAbstractItemModel::data method must be executed
self | The pointer to the QAbstractItemModel in the binded language | |
index | The DosQModelIndex to which we request the data | |
[out] | result | The DosQVariant result. This must be deferenced and filled from the binded language. |
index
QModelIndex is owned by the DOtherSide library thus it shouldn't be deleted result
arg is an out parameter so it shouldn't be deleted typedef void( * DeleteDObject) (int id, void *bindedQObject) |
Callback invoked from QML for deleting a registered type.
This is called when the wrapper gets deleted from QML. The implementation should unref/unpin the bindedQObject
or delete it in the case of languages without GC
id | This is the type id for which we are requesting the deletion |
bindedQObject | This is the pointer you given in the CreateDObject callback and you can use it for obtaining the QObject in your binded language. This allows you to unpin/unref it or delete it. |
typedef void( * DObjectCallback) (void *self, DosQVariant *slotName, int argc, DosQVariant **argv) |
Called when a property is readed/written or a slot should be executed
self | The pointer of QObject in the binded language |
slotName | The slotName as DosQVariant |
argc | The number of arguments |
argv | An array of DosQVariant pointers |
argv
is always the return value of the called slot. In other words the length of argv is always 1 + number of arguments of slotName
. The return value should be assigned and modified by calling the dos_qvariant_assign() or other dos_qvariant_set... setters. slotName
is owned by the library thus it shouldn't be deleted argv
array is owned by the library thus it shouldn't be deleted typedef void( * RequestPixmapCallback) (const char *id, int *width, int *height, int requestedWidth, int requestedHeight, DosPixmap *result) |
A pixmap callback to be supplied to an image provider
id | Image source id | |
width | pointer to the width of the image | |
height | pointer to the height of the image | |
requestedHeight | sourceSize.height attribute | |
requestedWidth | sourcesSize.width attribute | |
[out] | result | The result QPixmap. This should be assigned from the binded language |
id
is the trailing part of an image source url for example "image://<provider_id>/<id> result
arg is an out parameter so it shouldn't be deleted. See the dos_qpixmap_assign typedef void( * RowCountCallback) (void *self, const DosQModelIndex *parent, int *result) |
Called when the QAbstractItemModel::rowCount method must be executed
self | The pointer of the QAbstractItemModel in the binded language | |
index | The parent DosQModelIndex | |
[out] | result | The rowCount result. This must be deferenced and filled from the binded language |
parent
QModelIndex is owned by the DOtherSide library thus it shouldn't be deleted result
arg is an out parameter so it shouldn't be deleted