当前位置:网站首页>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 :
边栏推荐
- Integritee通过XCM集成至Moonriver,为其生态系统带来企业级隐私解决方案
- Taishan Office Technology Lecture: about the order of background (shading and highlighting)
- 九齐单片机NY8B062D单按键控制4种LED状态
- AP8022开关电源小家电ACDC芯片离线式开关电源IC
- Every time I look at the interface documents of my colleagues, I get confused and have a lot of problems...
- 面对同样复杂的测试任务为什么大老很快能梳理解决方案,阿里十年测试工程师道出其中的技巧
- FS8B711S14电动红酒开瓶器单片机IC方案开发专用集成IC
- 【深度学习】一文看尽Pytorch之十九种损失函数
- [in-depth learning] review pytoch's 19 loss functions
- 凌云出海记 | 一零跃动&华为云:共助非洲普惠金融服务
猜你喜欢
Dynamic memory management
idea恢复默认快捷键
电脑怎么保存网页到桌面上使用
Jiuqi ny8b062d MCU specification /datasheet
Flet教程之 06 TextButton基础入门(教程含源码)
Practice examples to understand JS strong cache negotiation cache
Qt五子棋人机对战画棋子之QPainter的使用误区总结
看腾讯大老如何做接口自动化测试
How to solve the problem that win11 cannot write the value to the registry key?
输入的查询SQL语句,是如何执行的?
随机推荐
一文搞懂Go语言中文件的读写与创建
面对同样复杂的测试任务为什么大老很快能梳理解决方案,阿里十年测试工程师道出其中的技巧
mysql语句执行详解
[in-depth learning] review pytoch's 19 loss functions
字节测试工程师十年经验直击UI 自动化测试痛点
2022 version of stronger jsonpath compatibility and performance test (snack3, fastjson2, jayway.jsonpath)
Taishan Office Technology Lecture: about the order of background (shading and highlighting)
Hash哈希竞猜游戏系统开发如何开发丨哈希竞猜游戏系统开发(多套案例)
Employment prospects and current situation of Internet of things application technology
软件客户端数字签名一定要申请代码签名证书吗?
MySQL中的日期时间类型与格式化方式
CDGA|数据治理不得不坚持的六个原则
tcp为啥是三次握手和四次挥手
Every time I look at the interface documents of my colleagues, I get confused and have a lot of problems...
Redis分布式锁的实现
复杂因子计算优化案例:深度不平衡、买卖压力指标、波动率计算
Hash quiz game system development how to develop hash quiz game system development (multiple cases)
Process of manually encrypt the mass-producing firmware and programming ESP devices
Win11共享文件打不开怎么办?Win11共享文件打不开的解决方法
What if win11u disk refuses access? An effective solution to win11u disk access denial