|
- package main
-
- import (
- "git.openprivacy.ca/openprivacy/lockbox/api"
- "git.openprivacy.ca/openprivacy/log"
- "github.com/therecipe/qt/core"
- "github.com/therecipe/qt/qml"
- "github.com/therecipe/qt/quickcontrols2"
- "github.com/therecipe/qt/widgets"
- "os"
- )
-
- func main() {
- log.SetLevel(log.LevelDebug)
-
- core.QCoreApplication_SetAttribute(core.Qt__AA_EnableHighDpiScaling, true)
-
- app := widgets.NewQApplication(len(os.Args), os.Args)
- app.SetAttribute(core.Qt__AA_EnableHighDpiScaling, true)
- quickcontrols2.QQuickStyle_SetStyle("Material")
- engine := qml.NewQQmlApplicationEngine(nil)
-
- lockapi := api.NewLockBoxAPI(nil)
-
- engine.RootContext().SetContextProperty("lockbox", lockapi)
- // load the embedded qml file
- // created by either qtrcc or qtdeploy
- engine.Load(core.NewQUrl3("qrc:/qml/main.qml", 0))
- // you can also load a local file like this instead:
- //engine.Load(core.QUrl_FromLocalFile("./qml/main.qml"))
-
- // start the main Qt event loop
- // and block until app.Exit() is called
- // or the window is closed by the user
- widgets.QApplication_Exec()
- }
|