Golang和Qt, 开发桌面应用程序

#简单的例子
参考

https://tw.saowen.com/a/e0496e173ca67dd7f0dc111cbcb872a53a14d8275e750219f5d2854c82c05749
https://github.com/therecipe/qt/wiki/Setting-the-Application-Icon //设置应用图标

package main

import (
"os"
"github.com/therecipe/qt/core"
"github.com/therecipe/qt/widgets"
)

func main() {
	widgets.NewQApplication(len(os.Args), os.Args)

	// left sider
	splitterLeft := widgets.NewQSplitter2(core.Qt__Horizontal, nil)
	textTop := widgets.NewQTextEdit2("左部文字", splitterLeft)
	splitterLeft.AddWidget(textTop)

	// right sider
	splitterRight := widgets.NewQSplitter2(core.Qt__Vertical, splitterLeft)
	textRight := widgets.NewQTextEdit2("右部文字", splitterRight)
	textbuttom := widgets.NewQTextEdit2("下部文字", splitterLeft)
	splitterRight.AddWidget(textRight)
	splitterRight.AddWidget(textbuttom)

	splitterLeft.SetWindowTitle("splitter")
	splitterLeft.Show()

	widgets.QApplication_Exec()
}

使用以下命令编译

qtdeploy build desktop main.go

你可能感兴趣的:(golang)