diff options
Diffstat (limited to 'Godeps/_workspace/src/github.com/obscuren/qml/examples/modelview')
-rw-r--r-- | Godeps/_workspace/src/github.com/obscuren/qml/examples/modelview/delegate/delegate.go | 53 | ||||
-rw-r--r-- | Godeps/_workspace/src/github.com/obscuren/qml/examples/modelview/delegate/delegate.qml | 17 |
2 files changed, 0 insertions, 70 deletions
diff --git a/Godeps/_workspace/src/github.com/obscuren/qml/examples/modelview/delegate/delegate.go b/Godeps/_workspace/src/github.com/obscuren/qml/examples/modelview/delegate/delegate.go deleted file mode 100644 index 440fd229a..000000000 --- a/Godeps/_workspace/src/github.com/obscuren/qml/examples/modelview/delegate/delegate.go +++ /dev/null @@ -1,53 +0,0 @@ -package main - -import ( - "fmt" - "gopkg.in/qml.v1" - "image/color" - "math/rand" - "os" - "time" -) - -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() - colors := &Colors{} - engine.Context().SetVar("colors", colors) - component, err := engine.LoadFile("delegate.qml") - if err != nil { - return err - } - window := component.CreateWindow(nil) - window.Show() - go func() { - n := func() uint8 { return uint8(rand.Intn(256)) } - for i := 0; i < 100; i++ { - colors.Add(color.RGBA{n(), n(), n(), 0xff}) - time.Sleep(1 * time.Second) - } - }() - window.Wait() - return nil -} - -type Colors struct { - list []color.RGBA - Len int -} - -func (colors *Colors) Add(c color.RGBA) { - colors.list = append(colors.list, c) - colors.Len = len(colors.list) - qml.Changed(colors, &colors.Len) -} - -func (colors *Colors) Color(index int) color.RGBA { - return colors.list[index] -} diff --git a/Godeps/_workspace/src/github.com/obscuren/qml/examples/modelview/delegate/delegate.qml b/Godeps/_workspace/src/github.com/obscuren/qml/examples/modelview/delegate/delegate.qml deleted file mode 100644 index 4b37d31f6..000000000 --- a/Godeps/_workspace/src/github.com/obscuren/qml/examples/modelview/delegate/delegate.qml +++ /dev/null @@ -1,17 +0,0 @@ -import QtQuick 2.0 - -Item { - width: 320; height: 200 - - ListView { - width: 120; - model: colors.len - delegate: Text { - text: "I am color number: " + index - color: colors.color(index) - } - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - } -} |