当前位置:网站首页>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 :
边栏推荐
- Related concepts of federal learning and motivation (1)
- [Beijing Xunwei] i.mx6ull development board porting Debian file system
- Employment prospects of neural network Internet of things application technology [welcome to add]
- 【深度学习】一文看尽Pytorch之十九种损失函数
- jekins初始化密码没有或找不到
- Is it necessary to apply for code signing certificate for software client digital signature?
- What if the WiFi of win11 system always drops? Solution of WiFi total drop in win11 system
- 【ISMB2022教程】图表示学习的精准医疗,哈佛大学Marinka Zitnik主讲,附87页ppt
- GVM使用
- Win11U盘拒绝访问怎么办?Win11U盘拒绝访问的有效解决方法
猜你喜欢

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

Flet教程之 08 AppBar工具栏基础入门(教程含源码)

What if the WiFi of win11 system always drops? Solution of WiFi total drop in win11 system

On communication bus arbitration mechanism and network flow control from the perspective of real-time application

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

Flet教程之 04 FilledTonalButton基础入门(教程含源码)

B2B mall system development of electronic components: an example of enabling enterprises to build standardized purchase, sale and inventory processes

Development and construction of DFI ecological NFT mobile mining system

Detailed explanation of Audi EDI invoice message

idea恢复默认快捷键
随机推荐
同事的接口文档我每次看着就头大,毛病多多。。。
Win11无法将值写入注册表项如何解决?
FS4061A升压8.4V充电IC芯片和FS4061B升压12.6V充电IC芯片规格书datasheet
Process of manually encrypt the mass-producing firmware and programming ESP devices
B2B mall system development of electronic components: an example of enabling enterprises to build standardized purchase, sale and inventory processes
托管式服务网络:云原生时代的应用体系架构进化
Oracle database, numbers Force 2 decimal places to display-Alibaba Cloud
Talking about cookies of client storage technology
实践示例理解js强缓存协商缓存
被奉为经典的「金字塔原理」,教给我们哪些PPT写作技巧?
工厂从自动化到数字孪生,图扑能干什么?
Selected review | machine learning technology for Cataract Classification / classification
Every time I look at the interface documents of my colleagues, I get confused and have a lot of problems...
面对同样复杂的测试任务为什么大老很快能梳理解决方案,阿里十年测试工程师道出其中的技巧
Form组件常用校验规则-1(持续更新中~)
1500万员工轻松管理,云原生数据库GaussDB让HR办公更高效
2022 version of stronger jsonpath compatibility and performance test (snack3, fastjson2, jayway.jsonpath)
Integritee通过XCM集成至Moonriver,为其生态系统带来企业级隐私解决方案
Win11共享文件打不开怎么办?Win11共享文件打不开的解决方法
Win11亮度被锁定怎么办?Win11亮度被锁定的解决方法