lockbox/lockbox.go

37 lines
1.0 KiB
Go
Raw Permalink Normal View History

2020-03-20 21:14:00 +00:00
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)
2020-03-21 21:09:09 +00:00
quickcontrols2.QQuickStyle_SetStyle("Material")
2020-03-20 21:14:00 +00:00
engine := qml.NewQQmlApplicationEngine(nil)
lockapi := api.NewLockBoxAPI(nil)
engine.RootContext().SetContextProperty("lockbox", lockapi)
// load the embedded qml file
// created by either qtrcc or qtdeploy
2020-03-21 00:00:04 +00:00
engine.Load(core.NewQUrl3("qrc:/qml/main.qml", 0))
2020-03-20 21:14:00 +00:00
// you can also load a local file like this instead:
2020-03-21 00:00:04 +00:00
//engine.Load(core.QUrl_FromLocalFile("./qml/main.qml"))
2020-03-20 21:14:00 +00:00
// start the main Qt event loop
// and block until app.Exit() is called
// or the window is closed by the user
widgets.QApplication_Exec()
}