Qt画而不清除背景 [英] Qt painting without clearing the background

查看:430
本文介绍了Qt画而不清除背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用QPainter在窗口上获取一些图形.不幸的是,每次调用paintEvent()函数时,都会清除整个窗口.我如何在不清理的情况下绘画? IE.如何保持以前绘画事件中的内容不变?

I'm using a QPainter to get some graphics on a window. Unfortunately every time the paintEvent() function is called, the whole window is cleared. How can I draw without clearing? I.e. how do I leave the stuff from previous paint event untouched?

我正在使用Qt4

推荐答案

您需要设置 setBackgroundMode 设置器. Qt::NoBackground枚举就是您要搜索的.

You need to set the backgroundMode by using the setBackgroundMode setter. The Qt::NoBackground enum is what you are searching for.

这篇关于Qt画而不清除背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆