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是子类重新定义的

  • 相关阅读:
    学习ExtJs的几个资源(转)
    使用Qunit对JavaScript进行单元测试
    Google Analytics基础—追踪代码
    Javascript/jquery异步加载使用方法详解(转)
    Javascript中数组的sort方法的分析
    关于asp.net与winform导出excel的代码
    今天遇到的exeSql问题
    转载 highchat的参数 及其说明
    传智播客的qqtab代码
    几个sql小知识
  • 原文地址:https://www.cnblogs.com/judes/p/11001110.html
Copyright © 2011-2022 走看看