therecipe / qt Windows版本安装

先记录环境变量

在这里插入图片描述

 

在这里插入图片描述

 

在这里插入图片描述

 

在这里插入图片描述

 

在这里插入图片描述

 

在这里插入图片描述

 

四件套

这篇文章很有作用:https://qiita.com/manymanyuni/items/a28acb545200f1f45c79

https://qiita.com/

我使用的步骤和命令


注意: GOPATH和GOROOT不是同一个目录!


1. 将Go和QT安装好

2. go get -v github.com/therecipe/qt

3. go install -v -tags=no_env github.com/therecipe/qt/cmd/...

4. 将 therecipe-qt 放到 $GOPATH 目录下的github.com文件夹下面去

5. 将 env_windows_amd64_513 放到 $GOPATH/pkg/mod/github.com/therecipe/ 下面。

6. for /f %v in ('go env GOPATH') do %v\bin\qtsetup

如果出现异常情况,例如下图:

在这里插入图片描述

 

你可能需要执行set GO111MODULE=off

在这里插入图片描述

在这里插入图片描述

 下面是成功的截图组:

在这里插入图片描述

 

在这里插入图片描述

 

在这里插入图片描述

 

 在这里插入图片描述

 

在这里插入图片描述

 

在这里插入图片描述

 

在这里插入图片描述

 

下面是测试代码

package main
import (
	"os"

	"github.com/therecipe/qt/core"
	"github.com/therecipe/qt/widgets"
)
func main() {
	core.QCoreApplication_SetApplicationName("sample")
	core.QCoreApplication_SetOrganizationName("sample")
	core.QCoreApplication_SetAttribute(core.Qt__AA_EnableHighDpiScaling, true)
	widgets.NewQApplication(len(os.Args), os.Args)
	window := widgets.NewQMainWindow(nil, 0)
	window.SetMinimumSize2(400, 300)
	window.SetWindowTitle("Hello World")
	window.Show()
	widgets.QApplication_Exec()
}

运行命令

1. qtenv
2. go run D:\GoProjectIdea\HelloGoQT\main.go

在这里插入图片描述

 

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值