33package gui
44
55import (
6- "bytes"
76 _ "github.com/peterq/pan-light/pc/functions"
87 _ "github.com/peterq/pan-light/pc/gui/bridge"
98 _ "github.com/peterq/pan-light/pc/gui/comp"
10- "io/ioutil"
11- "time"
12-
13- //_ "github.com/peterq/pan-light/pc/gui/qml"
9+ _ "github.com/peterq/pan-light/pc/gui/qml"
1410 "github.com/peterq/pan-light/qt/bindings/core"
1511 "github.com/peterq/pan-light/qt/bindings/gui"
1612 "github.com/peterq/pan-light/qt/bindings/qml"
@@ -25,19 +21,22 @@ func StartGui() {
2521
2622 // 下面2句话居然能解决windows 异常退出的bug
2723 core .QCoreApplication_SetOrganizationName ("PeterQ" ) //needed to fix an QML Settings issue on windows
28- quick .QQuickWindow_SetSceneGraphBackend (quick .QSGRendererInterface__Software )
24+ if os .Getenv ("pan_light_render_exception_fix" ) == "true" {
25+ quick .QQuickWindow_SetSceneGraphBackend (quick .QSGRendererInterface__Software )
26+ }
27+
28+ //rccFile := "E:\\pan-light\\qml.rcc"
29+ //bin, _ := ioutil.ReadFile(rccFile)
30+ //go func() {
31+ // for range time.Tick(2 * time.Second) {
32+ // n, _ := ioutil.ReadFile(rccFile)
33+ // if !bytes.Equal(bin, n) {
34+ // os.Exit(2)
35+ // }
36+ // }
37+ //}()
38+ //core.QResource_RegisterResource(rccFile, "/")
2939
30- rccFile := "E:\\ pan-light\\ qml.rcc"
31- bin , _ := ioutil .ReadFile (rccFile )
32- go func () {
33- for range time .Tick (2 * time .Second ) {
34- n , _ := ioutil .ReadFile (rccFile )
35- if ! bytes .Equal (bin , n ) {
36- os .Exit (2 )
37- }
38- }
39- }()
40- core .QResource_RegisterResource (rccFile , "/" )
4140 app := gui .NewQGuiApplication (len (os .Args ), os .Args )
4241
4342 engine := qml .NewQQmlApplicationEngine (nil )
0 commit comments