Mercurial > projects > qtd
view cpp/qt_core/QMetaType_shell.cpp @ 248:7664de4a55e5
Fixed #23.
QtD_QObjectEntity is not created dynamically for shell classes any more.
Class initialization is now performed by static constructors.
When wrapping QObjects returned from functions, their run-time types are now taken into account.
QObjects are allocated on GC heap, a doubly-linked list is used to prevent them from been collected (arguably a better solution than allocating on C heap and adding GC ranges)
Minor changes (including unnecessary).
author | maxter |
---|---|
date | Thu, 20 Aug 2009 14:47:17 +0000 |
parents | f46133029d8b |
children | 9784459f0750 |
line wrap: on
line source
#include <QMetaType> #include "qtd_core.h" typedef void * Ctor (const void *copy); typedef void Dtor(void *obj); extern "C" DLL_PUBLIC int qtd_registerType(char* namePtr, Ctor ctor, Dtor dtor) { return QMetaType::registerType(namePtr, dtor, ctor); } typedef void (*SaveOperator)(void *, void *); typedef void (*LoadOperator)(void *, void *); extern "C" DLL_PUBLIC void qtd_registerStreamOperators(const char *typeName, SaveOperator saveOp, LoadOperator loadOp) { QMetaType::registerStreamOperators(typeName, reinterpret_cast<QMetaType::SaveOperator>(saveOp), reinterpret_cast<QMetaType::LoadOperator>(loadOp)); } extern "C" DLL_PUBLIC int qtd_MetatypeId(char *id) { return QMetaType::type(id); }