当前位置:网站首页>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 :
边栏推荐
猜你喜欢
Optimization cases of complex factor calculation: deep imbalance, buying and selling pressure index, volatility calculation
什么叫内卷?
ICML 2022 | meta proposes a robust multi-objective Bayesian optimization method to effectively deal with input noise
工厂从自动化到数字孪生,图扑能干什么?
Understand the reading, writing and creation of files in go language
What if the computer page cannot be full screen? The solution of win11 page cannot be full screen
FS4061A升压8.4V充电IC芯片和FS4061B升压12.6V充电IC芯片规格书datasheet
Flet教程之 08 AppBar工具栏基础入门(教程含源码)
Selected review | machine learning technology for Cataract Classification / classification
[ismb2022 tutorial] the picture shows the precision medicine of learning. Marinka zitnik, Harvard University, keynote speaker, with 87 ppt
随机推荐
栈:如何实现有效括号的判断?
Form组件常用校验规则-1(持续更新中~)
[today in history] July 4: the first e-book came out; The inventor of magnetic stripe card was born; Palm computer pioneer was born
看腾讯大老如何做接口自动化测试
Win11无法将值写入注册表项如何解决?
原来这才是 BGP 协议
凌云出海记 | 文华在线&华为云:打造非洲智慧教学新方案
Related concepts of federal learning and motivation (1)
Ziguang zhanrui completed the first 5g R17 IOT NTN satellite on the Internet of things in the world
Hash哈希竞猜游戏系统开发如何开发丨哈希竞猜游戏系统开发(多套案例)
go笔记(3)Go语言fmt包的用法
输入的查询SQL语句,是如何执行的?
Regular replacement [JS, regular expression]
Write it down once Net analysis of thread burst height of an industrial control data acquisition platform
二叉树的四种遍历方式以及中序后序、前序中序、前序后序、层序创建二叉树【专为力扣刷题而打造】
面对同样复杂的测试任务为什么大老很快能梳理解决方案,阿里十年测试工程师道出其中的技巧
六石编程学:关于代码,有六个得意
左右最值最大差问题
go语言笔记(2)go一些简单运用
2022 Health Exhibition, health exhibition, Beijing Great Health Exhibition and health industry exhibition were held in November