aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/obscuren/qml/examples/reparent/reparent.go
diff options
context:
space:
mode:
Diffstat (limited to 'Godeps/_workspace/src/github.com/obscuren/qml/examples/reparent/reparent.go')
-rw-r--r--Godeps/_workspace/src/github.com/obscuren/qml/examples/reparent/reparent.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/obscuren/qml/examples/reparent/reparent.go b/Godeps/_workspace/src/github.com/obscuren/qml/examples/reparent/reparent.go
new file mode 100644
index 000000000..c1399f88c
--- /dev/null
+++ b/Godeps/_workspace/src/github.com/obscuren/qml/examples/reparent/reparent.go
@@ -0,0 +1,37 @@
+package main
+
+import (
+ "fmt"
+ "gopkg.in/qml.v1"
+ "os"
+)
+
+func main() {
+ if err := qml.Run(run); err != nil {
+ fmt.Fprintf(os.Stderr, "error: %v\n", err)
+ os.Exit(1)
+ }
+}
+
+func run() error {
+ engine := qml.NewEngine()
+
+ base, err := engine.LoadFile("base.qml")
+ if err != nil {
+ return err
+ }
+ rect, err := engine.LoadFile("rect.qml")
+ if err != nil {
+ return err
+ }
+
+ win := base.CreateWindow(nil)
+ obj := rect.Create(nil)
+
+ obj.Set("parent", win.Root())
+
+ win.Show()
+ win.Wait()
+
+ return nil
+}