當前位置: 首頁>>代碼示例>>Golang>>正文


Golang qml.Object類代碼示例

本文整理匯總了Golang中github.com/niemeyer/qml.Object的典型用法代碼示例。如果您正苦於以下問題:Golang Object類的具體用法?Golang Object怎麽用?Golang Object使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Object類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Connect

func (ui *UiLib) Connect(button qml.Object) {
	if !ui.connected {
		ui.eth.Start()
		ui.connected = true
		button.Set("enabled", false)
	}
}
開發者ID:jubbsy,項目名稱:go-ethereum,代碼行數:7,代碼來源:ui_lib.go

示例2: Snapshot

func (ctrl *Control) Snapshot(request qml.Object) {
	if request.Int("status") != 2 {
		return
	}
	f, err := os.Create(os.Args[2])
	if err != nil {
		ctrl.done <- err
		return
	}
	defer f.Close()
	img := ctrl.win.Snapshot()
	err = png.Encode(f, img)
	if err != nil {
		os.Remove(os.Args[2])
	}
	ctrl.done <- err
}
開發者ID:ntcong,項目名稱:qml,代碼行數:17,代碼來源:snapweb.go

示例3: StartNewGame

func (g *Game) StartNewGame(parent qml.Object, dialog qml.Object) {
	for _, b := range g.Board {
		if b != nil {
			b.Destroy()
		}
	}

	g.parent = parent
	g.dialog = dialog

	score := 0
	g.parent.Set("score", score)
	g.Score.Set("text", "Score: "+strconv.Itoa(score))

	w := parent.Int("width")
	h := parent.Int("height")
	blockSize := parent.Int("blockSize")
	g.MaxColumn = w / blockSize
	g.MaxRow = h / blockSize
	g.MaxIndex = g.MaxColumn * g.MaxRow

	g.Block.BlockSize = blockSize

	g.Board = make([]qml.Object, g.MaxIndex, g.MaxIndex)
	for col := 0; col < g.MaxColumn; col++ {
		for row := 0; row < g.MaxRow; row++ {
			g.Board[g.index(col, row)] = g.Block.createBlock(col, row, parent)
		}
	}
	g.started = true
}
開發者ID:Kwan36011,項目名稱:samegame,代碼行數:31,代碼來源:samegame.go

示例4: TextReleased

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)
	}()
}
開發者ID:hahaya,項目名稱:qml,代碼行數:17,代碼來源:main.go

示例5: ChangedPolje1

func (ctrl *Control) ChangedPolje1(text qml.Object) {

	fmt.Printf("changed %#v\n", text.String("text"))
}
開發者ID:hernad,項目名稱:go-libreoffice,代碼行數:4,代碼來源:main.go

示例6: Done

func (ctrl *Control) Done(emitter *qml.Object) {
	emitter.Destroy()
}
開發者ID:hahaya,項目名稱:qml,代碼行數:3,代碼來源:main.go

示例7: DestroyBlock

func (g *Game) DestroyBlock(block qml.Object, t int) {
	go func() {
		time.Sleep(time.Duration(t) * time.Millisecond)
		block.Destroy()
	}()
}
開發者ID:Kwan36011,項目名稱:samegame,代碼行數:6,代碼來源:samegame.go


注:本文中的github.com/niemeyer/qml.Object類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。