DOtherSide  0.7.1
C language library for creating bindings for the Qt QML language
Data Structures | Macros | Typedefs | Enumerations
DOtherSideTypes.h File Reference

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
 

Enumerations

enum  DosQEventLoopProcessEventFlag { DosQEventLoopProcessEventFlagProcessAllEvents = 0x00, DosQEventLoopProcessEventFlagExcludeUserInputEvents = 0x01, DosQEventLoopProcessEventFlagProcessExcludeSocketNotifiers = 0x02, DosQEventLoopProcessEventFlagProcessAllEventsWaitForMoreEvents = 0x03 }
 
enum  DosQtConnectionType {
  DosQtConnectionTypeAutoConnection = 0, DosQtConnectionTypeDirectConnection = 1, DosQtConnectionTypeQueuedConnection = 2, DosQtConnectionTypeBlockingConnection = 3,
  DosQtCOnnectionTypeUniqueConnection = 0x80
}
 

Detailed Description

The DOtherSide types.

This file contains all the type definitions for structs and callbacks used by the DOtherSide library

Typedef Documentation

◆ ColumnCountCallback

typedef void( * ColumnCountCallback) (void *self, const DosQModelIndex *parent, int *result)

Called when the QAbstractItemModel::columnCount method must be executed

Parameters
selfThe pointer to the QAbstractItemModel in the binded language
indexThe parent DosQModelIndex
[out]resultThe rowCount result. This must be deferenced and filled from the binded language
Note
The parent QModelIndex is owned by the DOtherSide library thus it shouldn't be deleted
The result arg is an out parameter so it shouldn't be deleted

◆ CreateDObject

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:

proc createCallback(.....) =
# Call the constructor for the given type and create a QObject in Nim
let nimQObject = constructorMap[id]()
# Disable GC
GC.ref(nimQObject)
# Retrieve the DosQObject created dos_qobject_create() inside the nimQObject
*dosQObject = nimQObject.vptr
# Store the pointer to the nimQObject
*bindedQObject = cast[ptr](&nimQObject)
# Swap the vptr inside the nimQObject with the wrapper
nimQObject.vptr = wrapper
# The QObject in the Nim language should not destroy its inner DosQObject
nimQObject.owner = false
Parameters
idThis 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()
wrapperThis is the QObject wrapper that should be stored by the binded language and to which forward the DOtherSide calls
bindedQObjectThis should be deferenced and assigned with the pointer of the QObject modeled in the binded language
dosQObjectThis should be deferenced and assigned with the DosQObject pointer you gained from calling the dos_qobject_create() function

◆ DataCallback

typedef void( * DataCallback) (void *self, const DosQModelIndex *index, int role, DosQVariant *result)

Called when the QAbstractItemModel::data method must be executed

Parameters
selfThe pointer to the QAbstractItemModel in the binded language
indexThe DosQModelIndex to which we request the data
[out]resultThe DosQVariant result. This must be deferenced and filled from the binded language.
Note
The index QModelIndex is owned by the DOtherSide library thus it shouldn't be deleted
The result arg is an out parameter so it shouldn't be deleted

◆ DeleteDObject

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

Parameters
idThis is the type id for which we are requesting the deletion
bindedQObjectThis 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.

◆ DObjectCallback

typedef void( * DObjectCallback) (void *self, DosQVariant *slotName, int argc, DosQVariant **argv)

Called when a property is readed/written or a slot should be executed

Parameters
selfThe pointer of QObject in the binded language
slotNameThe slotName as DosQVariant
argcThe number of arguments
argvAn array of DosQVariant pointers
Note
The first argument of 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.
The slotName is owned by the library thus it shouldn't be deleted
The argv array is owned by the library thus it shouldn't be deleted

◆ RequestPixmapCallback

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

Parameters
idImage source id
widthpointer to the width of the image
heightpointer to the height of the image
requestedHeightsourceSize.height attribute
requestedWidthsourcesSize.width attribute
[out]resultThe result QPixmap. This should be assigned from the binded language
Note
id is the trailing part of an image source url for example "image://<provider_id>/<id>
The result arg is an out parameter so it shouldn't be deleted. See the dos_qpixmap_assign

◆ RowCountCallback

typedef void( * RowCountCallback) (void *self, const DosQModelIndex *parent, int *result)

Called when the QAbstractItemModel::rowCount method must be executed

Parameters
selfThe pointer of the QAbstractItemModel in the binded language
indexThe parent DosQModelIndex
[out]resultThe rowCount result. This must be deferenced and filled from the binded language
Note
The parent QModelIndex is owned by the DOtherSide library thus it shouldn't be deleted
The result arg is an out parameter so it shouldn't be deleted