当前位置:网站首页>Summary of the mistakes in the use of qpainter in QT gobang man-machine game
Summary of the mistakes in the use of qpainter in QT gobang man-machine game
2022-07-04 20:43:00 【Trendy technology research society】
After the last Gobang drawing board , We are going to proceed to the next step , Briefly break down the functions :
1. Move later , Our side and the other side fall , The sub functions here include : Who's first , How to settle the problem of backhand
2. How to keep the pieces on the chessboard , At present, every time we draw , The chess pieces will disappear , So you need to save the position information of the pieces on the chessboard , That point needs to be drawn at the same time
3. Draw the chess pieces on the grid , Need some calculation

Back to the point , Whatever you draw , It's all in paintEvent It's in Chinese , therefore , Draw different things , You need to use different tags .
Let's first look at some wrong QPainter Use cases :
QPainter blackPainter(this);
QPainter whitePainter(this);
QPainter greenPainter(this);
blackPainter.setBrush(Qt::black);
whitePainter.setBrush(Qt::white);
greenPainter.setBrush(Qt::green);Pictured above , Think very well , Create multiple QPainter, I feel good at first sight , After all, we have to draw different objects , Then use different brushes , Isn't it natural ? The truth is , You can't do that , Although these brushes defined can work , however , There is only one color value set last , in other words , This setting is meaningless .
There's another situation , as follows :
边栏推荐
- Six stones programming: about code, there are six triumphs
- 关于联邦学习和激励的相关概念(1)
- Is it necessary to apply for code signing certificate for software client digital signature?
- 最长的可整合子数组的长度
- 同事的接口文档我每次看着就头大,毛病多多。。。
- Win11无法将值写入注册表项如何解决?
- 原来这才是 BGP 协议
- How does win11 search for wireless displays? Win11 method of finding wireless display device
- 1500万员工轻松管理,云原生数据库GaussDB让HR办公更高效
- [in-depth learning] review pytoch's 19 loss functions
猜你喜欢

Win11无法将值写入注册表项如何解决?

Qt编写物联网管理平台38-多种数据库支持

二叉树的四种遍历方式以及中序后序、前序中序、前序后序、层序创建二叉树【专为力扣刷题而打造】
一文搞懂Go语言中文件的读写与创建

Ziguang zhanrui completed the first 5g R17 IOT NTN satellite on the Internet of things in the world

字节测试工程师十年经验直击UI 自动化测试痛点

【深度学习】一文看尽Pytorch之十九种损失函数

实操自动生成接口自动化测试用例

精选综述 | 用于白内障分级/分类的机器学习技术

FS4061A升压8.4V充电IC芯片和FS4061B升压12.6V充电IC芯片规格书datasheet
随机推荐
漫谈客户端存储技术之Cookie篇
idea恢复默认快捷键
九齐单片机NY8B062D单按键控制4种LED状态
tcp为啥是三次握手和四次挥手
字节测试工程师十年经验直击UI 自动化测试痛点
更强的 JsonPath 兼容性及性能测试之2022版(Snack3,Fastjson2,jayway.jsonpath)
BFC面试简述
QT writing the Internet of things management platform 38- multiple database support
Reinforcement learning - learning notes 2 | value learning
浏览器渲染页面过程
idea配置标准注释
node强缓存和协商缓存实战示例
工厂从自动化到数字孪生,图扑能干什么?
哈希(Hash)竞猜游戏系统开发功能分析及源码
What financial products can you buy with a deposit of 100000 yuan?
【ISMB2022教程】图表示学习的精准医疗,哈佛大学Marinka Zitnik主讲,附87页ppt
[ismb2022 tutorial] the picture shows the precision medicine of learning. Marinka zitnik, Harvard University, keynote speaker, with 87 ppt
Informatics Olympiad 1336: [example 3-1] find roots and children
Process of manually encrypt the mass-producing firmware and programming ESP devices
word中使用自动插入题注功能