mirror of https://github.com/status-im/nimqml.git
Merge pull request #21 from status-im/feat/qguiapplication
feat: QGuiApplication supporting icon() and installEventFilter() meth…
This commit is contained in:
commit
8cf2c4da0d
|
@ -129,7 +129,7 @@ proc dos_qapplication_enable_hdpi() {.cdecl, dynlib: dynLibName, importc.}
|
|||
proc dos_qapplication_initialize_opengl() {.cdecl, dynlib: dynLibName, importc.}
|
||||
|
||||
# QApplication
|
||||
proc dos_qapplication_create(appName: cstring) {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_qapplication_create() {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_qapplication_exec() {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_qapplication_quit() {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_qapplication_icon(filename: cstring) {.cdecl, dynlib: dynLibName, importc.}
|
||||
|
@ -141,7 +141,9 @@ proc dos_qapplication_installEventFilter(engine: DosQQmlApplicationEngine) {.cde
|
|||
proc dos_qguiapplication_create() {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_qguiapplication_exec() {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_qguiapplication_quit() {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_qguiapplication_icon(filename: cstring) {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_qguiapplication_delete() {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_qguiapplication_installEventFilter(engine: DosQQmlApplicationEngine) {.cdecl, dynlib: dynLibName, importc.}
|
||||
|
||||
# QQmlContext
|
||||
proc dos_qqmlcontext_setcontextproperty(context: DosQQmlContext, propertyName: cstring, propertyValue: DosQVariant) {.cdecl, dynlib: dynLibName, importc.}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
proc setup*(application: QApplication, appName: string) =
|
||||
proc setup*(application: QApplication) =
|
||||
## Setup a new QApplication
|
||||
dos_qapplication_create(appName.cstring)
|
||||
dos_qapplication_create()
|
||||
application.deleted = false
|
||||
|
||||
proc exec*(application: QApplication) =
|
||||
|
@ -28,7 +28,7 @@ proc delete*(application: QApplication) =
|
|||
dos_qapplication_delete()
|
||||
application.deleted = true
|
||||
|
||||
proc newQApplication*(appName: string = "Unknown"): QApplication =
|
||||
proc newQApplication*(): QApplication =
|
||||
## Return a new QApplication
|
||||
new(result, delete)
|
||||
result.setup(appName)
|
||||
result.setup()
|
||||
|
|
|
@ -1,18 +1,26 @@
|
|||
import os
|
||||
|
||||
proc setup*(self: QGuiApplication) =
|
||||
## Setup a new QApplication
|
||||
## Setup a new QGuiApplication
|
||||
dos_qguiapplication_create()
|
||||
self.deleted = false
|
||||
|
||||
proc delete*(self: QGuiApplication) =
|
||||
## Delete the given QApplication
|
||||
## Delete the given QGuiApplication
|
||||
if self.deleted:
|
||||
return
|
||||
debugMsg("QApplication", "delete")
|
||||
debugMsg("QGuiApplication", "delete")
|
||||
dos_qguiapplication_delete()
|
||||
self.deleted = true
|
||||
|
||||
proc icon*(application: QGuiApplication, filename: string) =
|
||||
dos_qguiapplication_icon(filename.cstring)
|
||||
|
||||
proc installEventFilter*(application: QGuiApplication, engine: QQmlApplicationEngine) =
|
||||
dos_qguiapplication_installEventFilter(engine.vptr)
|
||||
|
||||
proc newQGuiApplication*(): QGuiApplication =
|
||||
## Return a new QApplication
|
||||
## Return a new QGuiApplication
|
||||
new(result, delete)
|
||||
result.setup()
|
||||
|
||||
|
|
Loading…
Reference in New Issue