Fixed missing return type in QDeclarative global functions

This commit is contained in:
Filippo Cucchetto 2016-03-23 22:52:07 +01:00
parent 47e23871e9
commit 2c4ab16442
1 changed files with 10 additions and 8 deletions

View File

@ -15,20 +15,22 @@ proc deleter(id: cint, nimQObject: NimQObject) {.cdecl.} =
let qobject = cast[QObject](nimQObject) let qobject = cast[QObject](nimQObject)
GC_unref(qobject) GC_unref(qobject)
proc qmlRegisterType*[T](uri: string, major: int, minor: int, qmlName: string, ctor: proc(): T) {.cdecl.} = proc qmlRegisterType*[T](uri: string, major: int, minor: int, qmlName: string, ctor: proc(): T): int =
var result: cint = 0 var id: cint = 0
let metaObject: QMetaObject = T.staticMetaObject() let metaObject: QMetaObject = T.staticMetaObject()
let dosQmlRegisterType = DosQmlRegisterType(major: major.cint, minor: minor.cint, uri: uri.cstring, let dosQmlRegisterType = DosQmlRegisterType(major: major.cint, minor: minor.cint, uri: uri.cstring,
qml: qmlName.cstring, staticMetaObject: metaObject.vptr, qml: qmlName.cstring, staticMetaObject: metaObject.vptr,
createCallback: creator, deleteCallback: deleter) createCallback: creator, deleteCallback: deleter)
dos_qdeclarative_qmlregistertype(dosQmlRegisterType.unsafeAddr, result) dos_qdeclarative_qmlregistertype(dosQmlRegisterType.unsafeAddr, id)
ctorTable[result] = proc(): QObject = ctor().QObject ctorTable[id] = proc(): QObject = ctor().QObject
id.int
proc qmlRegisterSingletonType*[T](uri: string, major: int, minor: int, qmlName: string, ctor: proc(): T) {.cdecl.} = proc qmlRegisterSingletonType*[T](uri: string, major: int, minor: int, qmlName: string, ctor: proc(): T): int =
var result: cint = 0 var id: cint = 0
let metaObject: QMetaObject = T.staticMetaObject() let metaObject: QMetaObject = T.staticMetaObject()
let dosQmlRegisterType = DosQmlRegisterType(major: major.cint, minor: minor.cint, uri: uri.cstring, let dosQmlRegisterType = DosQmlRegisterType(major: major.cint, minor: minor.cint, uri: uri.cstring,
qml: qmlName.cstring, staticMetaObject: metaObject.vptr, qml: qmlName.cstring, staticMetaObject: metaObject.vptr,
createCallback: creator, deleteCallback: deleter) createCallback: creator, deleteCallback: deleter)
dos_qdeclarative_qmlregistersingletontype(dosQmlRegisterType.unsafeAddr, result) dos_qdeclarative_qmlregistersingletontype(dosQmlRegisterType.unsafeAddr, id)
ctorTable[result] = proc(): QObject = ctor().QObject ctorTable[id] = proc(): QObject = ctor().QObject
id.int