Skip to content

Instantly share code, notes, and snippets.

@jeffbair
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffbair/7162967ee6b61649e702 to your computer and use it in GitHub Desktop.
Save jeffbair/7162967ee6b61649e702 to your computer and use it in GitHub Desktop.
package main
import (
"gopkg.in/qml.v1"
"fmt"
"time"
)
func main() {
err := qml.Run(run)
if err != nil {
}
}
type Control struct{
win * qml.Window
}
func (g *Control) GoDoFreeze() {
fmt.Println("before 5 second sleep")
time.Sleep(5 * time.Second)
fmt.Println("after 5 second sleep")
root := g.win.Root()
ld := root.ObjectByName("loadDialog")
ld.Set("visible", false)
}
func (g *Control) DoFreeze() {
go func() {
g.GoDoFreeze()
}()
}
func run() error {
engine := qml.NewEngine()
ctx := engine.Context()
ctrl_obj := Control{}
ctx.SetVar("ctrl", &ctrl_obj)
component, err := engine.LoadFile("./file.qml")
if err != nil {
return err
}
//win := component.CreateWindow(nil)
ctrl_obj.win = component.CreateWindow(nil)
ctrl_obj.win.Show()
ctrl_obj.win.Wait()
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment