zoukankan      html  css  js  c++  java
  • Qwidget::update

    void QWidget::update ()分析重绘事件激活 1看看手册中这段话
    void QWidget::update () [slot]
    Updates the widget unless updates are disabled or the widget is hidden.
    This function does not cause an immediate repaint; instead it schedules a paint event for processing when Qt returns to the main event loop. This permits Qt to optimize for more speed and less flicker than a call to repaint() does.
    Calling update() several times normally results in just one paintEvent() call.
    Qt normally erases the widget's area before the paintEvent() call. If the WRepaintNoErase widget flag is set, the widget is responsible for painting all its pixels itself.
    See also repaint(), paintEvent(), updatesEnabled, erase(), and setWFlags().
    2.update() 激发Paint Event 事件的发生,而Paint Event 时间将调用QWidegt::PaintEvent(QPaintEvent paint)
    而这个Protected函数是定义窗口自己的绘制特性。
    3.void QWidget::update () [槽]
    更新窗口部件,除非更新已经失效或者窗口部件被隐藏。
    这个函数不会导致一个立刻的重新绘制——更正确的是,当Qt回到主事件回路中时,它规划了所要处理的绘制事件。这样允许Qt来优化得到比调用repaint()更快的速度和更少的闪烁。
    几次调用update()的结果通常仅仅是一次paintEvent()调用。
    Qt通常在paintEvent()调用之前擦除这个窗口部件的区域。仅仅只有在WRepaintNoErase窗口部件标记被设置的时候,窗口部件本身对绘制它所有的像素负有责任。

    转:https://www.cnblogs.com/hnrainll/archive/2011/05/26/2057766.html

    总之:update会调用PaintEvent,往往PaintEvent是子类重新定义的

  • 相关阅读:
    Web开发(二)HTML
    Web开发(一)基础
    Python基础(十二)并发编程02
    Python基础(十一)并发编程01
    Python基础(十)socket编程
    Python基础(九)异常
    计算机基础
    Python基础(八)面向对象02
    jmeter使用正则表达式提取数据
    jmeter+ant 实现自动化接口测试环境配置
  • 原文地址:https://www.cnblogs.com/judes/p/11001110.html
Copyright © 2011-2022 走看看