当前位置:网站首页>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 :
边栏推荐
- B2B mall system development of electronic components: an example of enabling enterprises to build standardized purchase, sale and inventory processes
- What ppt writing skills does the classic "pyramid principle" teach us?
- [today in history] July 4: the first e-book came out; The inventor of magnetic stripe card was born; Palm computer pioneer was born
- 1500万员工轻松管理,云原生数据库GaussDB让HR办公更高效
- 易周金融 | Q1保险行业活跃人数8688.67万人 19家支付机构牌照被注销
- NLP, vision, chip What is the development direction of AI? Release of the outlook report of Qingyuan Association [download attached]
- Regular replacement [JS, regular expression]
- How does win11 search for wireless displays? Win11 method of finding wireless display device
- Flet教程之 08 AppBar工具栏基础入门(教程含源码)
- FS4061A升压8.4V充电IC芯片和FS4061B升压12.6V充电IC芯片规格书datasheet
猜你喜欢
MySQL中的日期时间类型与格式化方式
What if the brightness of win11 is locked? Solution to win11 brightness locking
What if the computer page cannot be full screen? The solution of win11 page cannot be full screen
Understand the reading, writing and creation of files in go language
关于联邦学习和激励的相关概念(1)
node强缓存和协商缓存实战示例
九齐NY8B062D MCU规格书/datasheet
How does win11 search for wireless displays? Win11 method of finding wireless display device
[in-depth learning] review pytoch's 19 loss functions
NLP、视觉、芯片...AI重点方向发展几何?青源会展望报告发布[附下载]
随机推荐
Informatics Olympiad 1336: [example 3-1] find roots and children
Length of the longest integrable subarray
《动手学深度学习》(三) -- 卷积神经网络 CNN
Optimize if code with policy mode [policy mode]
QT writing the Internet of things management platform 38- multiple database support
Cdga | six principles that data governance has to adhere to
Ziguang zhanrui completed the first 5g R17 IOT NTN satellite on the Internet of things in the world
go语言笔记(4)go常用管理命令
idea大小写快捷键
ICML 2022 | Meta提出鲁棒的多目标贝叶斯优化方法,有效应对输入噪声
最长的可整合子数组的长度
Hash哈希竞猜游戏系统开发如何开发丨哈希竞猜游戏系统开发(多套案例)
托管式服务网络:云原生时代的应用体系架构进化
记一次 .NET 某工控数据采集平台 线程数 爆高分析
Redis分布式锁的实现
什么叫内卷?
What does the neural network Internet of things mean? Popular explanation
Aiming at the "amnesia" of deep learning, scientists proposed that based on similarity weighted interleaved learning, they can board PNAS
Flet教程之 06 TextButton基础入门(教程含源码)
【历史上的今天】7 月 4 日:第一本电子书问世;磁条卡的发明者出生;掌上电脑先驱诞生