Esempio n. 1
0
File: main.go Progetto: hbdlb/qml-1
func (ctrl *Control) TextReleased(text qml.Object) {
	x := text.Int("x")
	y := text.Int("y")
	width := text.Int("width")
	height := text.Int("height")

	ctrl.Emit(x+15, y+height/2)
	ctrl.Emit(x+width/2, 1.0*y+height/2)
	ctrl.Emit(x+width-15, 1.0*y+height/2)

	go func() {
		time.Sleep(500 * time.Millisecond)
		messages := []string{"Hello", "Hello", "Hacks"}
		ctrl.Message = messages[rand.Intn(len(messages))] + " from Go!"
		qml.Changed(ctrl, &ctrl.Message)
	}()
}
Esempio n. 2
0
func (colors *Colors) Add(c color.RGBA) {
	colors.list = append(colors.list, c)
	colors.Len = len(colors.list)
	qml.Changed(colors, &colors.Len)
}