feat: add DockClicker event filter

Add an event filter to `qApp` that can detect a dock icon click (in macos) when the main window is hidden or closed.
This commit is contained in:
Eric Mastro 2021-05-04 17:41:55 +10:00
parent 6776fed33f
commit bf48b9114a
No known key found for this signature in database
GPG Key ID: 141E3048D95A4E63
2 changed files with 4 additions and 0 deletions

View File

@ -135,6 +135,7 @@ proc dos_qapplication_quit() {.cdecl, dynlib: dynLibName, importc.}
proc dos_qapplication_icon(filename: cstring) {.cdecl, dynlib: dynLibName, importc.}
proc dos_qapplication_delete() {.cdecl, dynlib: dynLibName, importc.}
proc dos_qapplication_clipboard_setText(content: cstring) {.cdecl, dynlib: dynLibName, importc.}
proc dos_qapplication_installEventFilter(engine: DosQQmlApplicationEngine) {.cdecl, dynlib: dynLibName, importc.}
# QGuiApplication
proc dos_qguiapplication_create() {.cdecl, dynlib: dynLibName, importc.}

View File

@ -17,6 +17,9 @@ proc icon*(application: QApplication, filename: string) =
proc setClipboardText*(text: string = "") =
dos_qapplication_clipboard_setText(text.cstring)
proc installEventFilter*(application: QApplication, engine: QQmlApplicationEngine) =
dos_qapplication_installEventFilter(engine.vptr)
proc delete*(application: QApplication) =
## Delete the given QApplication
if application.deleted: