简体   繁体   English

Qt:更新qwidget的区域

[英]Qt: Update an area of qwidget

I have a problem, need some helps. 我有问题,需要一些帮助。 I have a Qwidget that have paint event, assume I have 3 areas on my qwidget are area 1, area 2 and area 3. I want to repaint only area 2 and area 3(not repaint area 1) when I call update or repaint of Qwidget. 我有一个具有绘制事件的Qwidget,假设我在我的qwidget上有3个区域分别是区域1,区域2和区域3。当我调用update或repaint时,我只想重绘区域2和区域3(而不重绘区域1)。 Qwidget。 How can I do that. 我怎样才能做到这一点。

There is QWidget::update(int x, int y, int w, int h) function. QWidget::update(int x, int y, int w, int h)函数。 According to Qt docs it: 根据Qt的文档

This is an overloaded function. 这是一个过载功能。 This version updates a rectangle (x, y, w, h) inside the widget. 此版本更新了小部件内的矩形(x,y,w,h)。

You can use it to repaint only a particular region of your widget. 您可以使用它仅重绘窗口小部件的特定区域。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM