status-desktop/src/nim_status_client.nim

35 lines
1002 B
Nim
Raw Normal View History

2020-05-06 17:40:00 +00:00
import NimQml
import applicationLogic
proc mainProc() =
2020-05-10 23:24:06 +00:00
# From QT docs:
# For any GUI application using Qt, there is precisely one QApplication object,
# no matter whether the application has 0, 1, 2 or more windows at any given time.
# For non-QWidget based Qt applications, use QGuiApplication instead, as it does
# not depend on the QtWidgets library. Use QCoreApplication for non GUI apps
var app = newQApplication()
defer: app.delete() # Defer will run this just before mainProc() function ends
2020-05-06 17:40:00 +00:00
2020-05-10 23:24:06 +00:00
2020-05-06 17:40:00 +00:00
var engine = newQQmlApplicationEngine()
defer: engine.delete()
2020-05-10 23:24:06 +00:00
let logic = newApplicationLogic(app)
defer: logic.delete
2020-05-06 17:40:00 +00:00
let logicVariant = newQVariant(logic)
defer: logicVariant.delete
engine.setRootContextProperty("logic", logicVariant)
engine.load("main.qml")
2020-05-10 23:24:06 +00:00
# Qt main event loop is entered here
# The termination of the loop will be performed when exit() or quit() is called
2020-05-06 17:40:00 +00:00
app.exec()
when isMainModule:
mainProc()
GC_fullcollect()