比方说我想在原先有背景图片的widget中更新某个局部区域的图片时采用这种方法
void Widget::paniterEvent(QPainterEvent *)
{
QPainter painter(this);
painter.drawPixmap(30,30,100,100,newpicture);
}
结果会把整个Widget里的内容擦除,然后在指定区域画上新图片。
请问一个用什么方法可以只对局部区域的显示内容更新,而不影响全局。
遇问题还是得多查帮助文档啊,
void QWidget::repaint ( int x, int y, int w, int h )
This is an overloaded function.
This version repaints a rectangle (x, y, w, h) inside the widget.
If w is negative, it is replaced with width() - x, and if h is negative, it is replaced width height() - y.
void QWidget::repaint ( const QRect & rect )
This is an overloaded function.
This version repaints a rectangle rect inside the widget.
void QWidget::repaint ( const QRegion & rgn )
This is an overloaded function.
This version repaints a region rgn inside the widget..
void Widget::paniterEvent(QPainterEvent *)
{
QPainter painter(this);
painter.drawPixmap(30,30,100,100,newpicture);
}
结果会把整个Widget里的内容擦除,然后在指定区域画上新图片。
请问一个用什么方法可以只对局部区域的显示内容更新,而不影响全局。
遇问题还是得多查帮助文档啊,
void QWidget::repaint ( int x, int y, int w, int h )
This is an overloaded function.
This version repaints a rectangle (x, y, w, h) inside the widget.
If w is negative, it is replaced with width() - x, and if h is negative, it is replaced width height() - y.
void QWidget::repaint ( const QRect & rect )
This is an overloaded function.
This version repaints a rectangle rect inside the widget.
void QWidget::repaint ( const QRegion & rgn )
This is an overloaded function.
This version repaints a region rgn inside the widget..