当前位置:网站首页>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 :
边栏推荐
- Why is the maximum speed the speed of light
- idea插件
- 字节测试工程师十年经验直击UI 自动化测试痛点
- Employment prospects and current situation of Internet of things application technology
- 软件客户端数字签名一定要申请代码签名证书吗?
- CDGA|数据治理不得不坚持的六个原则
- 左右最值最大差问题
- 2022 Health Exhibition, Beijing Health Expo, China Health Exhibition, great health exhibition November 13
- Lingyun going to sea | Murong Technology & Huawei cloud: creating a model of financial SaaS solutions in Africa
- 易周金融 | Q1保险行业活跃人数8688.67万人 19家支付机构牌照被注销
猜你喜欢
Qt五子棋人机对战画棋子之QPainter的使用误区总结
ICML 2022 | meta proposes a robust multi-objective Bayesian optimization method to effectively deal with input noise
ICML 2022 | Meta提出鲁棒的多目标贝叶斯优化方法,有效应对输入噪声
Flet教程之 08 AppBar工具栏基础入门(教程含源码)
Qt编写物联网管理平台38-多种数据库支持
Flet tutorial 05 outlinedbutton basic introduction (tutorial includes source code)
Flet教程之 06 TextButton基础入门(教程含源码)
What if the brightness of win11 is locked? Solution to win11 brightness locking
一文搞懂Go语言中文件的读写与创建
Win11亮度被锁定怎么办?Win11亮度被锁定的解决方法
随机推荐
Neural network IOT platform construction (IOT platform construction practical tutorial)
1500万员工轻松管理,云原生数据库GaussDB让HR办公更高效
Flet教程之 06 TextButton基础入门(教程含源码)
Stack: how to realize the judgment of valid brackets?
word中插入图片后,图片上方有一空行,且删除后布局变乱
更强的 JsonPath 兼容性及性能测试之2022版(Snack3,Fastjson2,jayway.jsonpath)
Win11共享文件打不开怎么办?Win11共享文件打不开的解决方法
电脑怎么保存网页到桌面上使用
QT writing the Internet of things management platform 38- multiple database support
Template_ Large integer subtraction_ Regardless of size
What ppt writing skills does the classic "pyramid principle" teach us?
凌云出海记 | 文华在线&华为云:打造非洲智慧教学新方案
哈希(Hash)竞猜游戏系统开发功能分析及源码
idea大小写快捷键
Flet教程之 08 AppBar工具栏基础入门(教程含源码)
mysql语句执行详解
idea恢复默认快捷键
太方便了,钉钉上就可完成代码发布审批啦!
go笔记(1)go语言介绍以及特点
凌云出海记 | 沐融科技&华为云:打造非洲金融SaaS解决方案样板