mirror of https://github.com/status-im/nimqml.git
Added QCoreApplication appDirPath
This commit is contained in:
parent
1dab7a8e89
commit
4813b30f11
|
@ -17,8 +17,9 @@ include private/qmetaobject.nim
|
|||
include private/qvariant.nim
|
||||
include private/qobject.nim
|
||||
include private/qqmlapplicationengine.nim
|
||||
include private/qapplication.nim
|
||||
include private/qcoreapplication.nim
|
||||
include private/qguiapplication.nim
|
||||
include private/qapplication.nim
|
||||
include private/qurl.nim
|
||||
include private/qquickview.nim
|
||||
include private/qhashintbytearray.nim
|
||||
|
|
|
@ -79,6 +79,12 @@ proc isNil(x: DosQQuickView): bool = x.pointer.isNil
|
|||
proc isNil(x: DosQHashIntByteArray): bool = x.pointer.isNil
|
||||
proc isNil(x: DosQModelIndex): bool = x.pointer.isNil
|
||||
|
||||
# CharArray
|
||||
proc dos_chararray_delete(str: cstring) {.cdecl, importc.}
|
||||
|
||||
# QCoreApplication
|
||||
proc dos_qcoreapplication_application_dir_path(str: var cstring) {.cdecl, importc.}
|
||||
|
||||
# QApplication
|
||||
proc dos_qapplication_create() {.cdecl, importc.}
|
||||
proc dos_qapplication_exec() {.cdecl, importc.}
|
||||
|
@ -97,6 +103,7 @@ proc dos_qqmlcontext_setcontextproperty(context: DosQQmlContext, propertyName: c
|
|||
# QQmlApplicationEngine
|
||||
proc dos_qqmlapplicationengine_create(engine: var DosQQmlApplicationEngine) {.cdecl, importc.}
|
||||
proc dos_qqmlapplicationengine_load(engine: DosQQmlApplicationEngine, filename: cstring) {.cdecl, importc.}
|
||||
proc dos_qqmlapplicationengine_load_url(engine: DosQQmlApplicationEngine, url: DosQUrl) {.cdecl, importc.}
|
||||
proc dos_qqmlapplicationengine_load_data(engine: DosQQmlApplicationEngine, data: cstring) {.cdecl, importc.}
|
||||
proc dos_qqmlapplicationengine_add_import_path(engine: DosQQmlApplicationEngine, path: cstring) {.cdecl, importc.}
|
||||
proc dos_qqmlapplicationengine_context(engine: DosQQmlApplicationEngine, context: var DosQQmlContext) {.cdecl, importc.}
|
||||
|
@ -125,7 +132,6 @@ proc dos_qvariant_setFloat(variant: DosQVariant, value: float) {.cdecl, importc
|
|||
proc dos_qvariant_toDouble(variant: DosQVariant, value: var cdouble) {.cdecl, importc.}
|
||||
proc dos_qvariant_setDouble(variant: DosQVariant, value: cdouble) {.cdecl, importc.}
|
||||
proc dos_qvariant_setQObject(variant: DosQVariant, value: DosQObject) {.cdecl, importc.}
|
||||
proc dos_chararray_delete(str: cstring) {.cdecl, importc.}
|
||||
|
||||
# QObject
|
||||
proc dos_qobject_qmetaobject(vptr: var DosQmetaObject) {.cdecl, importc.}
|
||||
|
|
|
@ -15,13 +15,13 @@ type
|
|||
## A QQmlApplicationEngine
|
||||
vptr: DosQQmlApplicationEngine
|
||||
|
||||
QApplication* = ref object of RootObj ## \
|
||||
## A QApplication
|
||||
QCoreApplication* = ref object of RootObj ## \
|
||||
## A QCoreApplication
|
||||
deleted: bool
|
||||
|
||||
QGuiApplication* = ref object of RootObj ## \
|
||||
## A QGuiApplication
|
||||
deleted: bool
|
||||
QGuiApplication* = ref object of QCoreApplication ## \
|
||||
|
||||
QApplication* = ref object of QGuiApplication ## \
|
||||
|
||||
QQuickView* = ref object of RootObj ## \
|
||||
# A QQuickView
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
proc applicationDirPath*(app: QCoreApplication): string =
|
||||
var str: cstring = nil
|
||||
dos_qcoreapplication_application_dir_path(str)
|
||||
result = $str
|
||||
dos_chararray_delete(str)
|
|
@ -10,6 +10,10 @@ proc load*(self: QQmlApplicationEngine, filename: string) =
|
|||
## Load the given Qml file
|
||||
dos_qqmlapplicationengine_load(self.vptr, filename.cstring)
|
||||
|
||||
proc load*(self: QQmlApplicationEngine, url: QUrl) =
|
||||
## Load the given Qml file
|
||||
dos_qqmlapplicationengine_load_url(self.vptr, url.vptr)
|
||||
|
||||
proc addImportPath*(self: QQmlApplicationEngine, path: string) =
|
||||
## Add an import path
|
||||
dos_qqmlapplicationengine_add_import_path(self.vptr, path.cstring)
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
proc registerResource*(c: type QResource, filename: cstring) =
|
||||
proc registerResource*(c: type QResource, filename: string) =
|
||||
dos_qresource_register(filename.cstring)
|
||||
|
|
Loading…
Reference in New Issue