示例#1
0
文件: main.go 项目: 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)
	}()
}
示例#2
0
文件: delegate.go 项目: hbdlb/qml-1
func (colors *Colors) Add(c color.RGBA) {
	colors.list = append(colors.list, c)
	colors.Len = len(colors.list)
	qml.Changed(colors, &colors.Len)
}