zoukankan      html  css  js  c++  java
  • void 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窗口部件标记被设置的时候,窗口部件本身对绘制它所有的像素负有责任。

  • 相关阅读:
    Codeforces 235C Cyclical Quest 后缀自动机
    HDU-6583 Typewriter 后缀自动机+dp
    HDU-4436 str2int 后缀自动机
    [题解]诸侯安置(dp+组合)
    [题解]洛谷P1350车的放置
    二进制表示中1的个数与异或关系
    [洛谷P1593][POJ-1845Sumdiv] 因子和
    [USACO08DEC]拍头Patting Heads 题解
    [小白逛公园]|[SP1716]|[UVA1400]解题报告(三合一)
    P2034选择数字题解
  • 原文地址:https://www.cnblogs.com/hnrainll/p/2057766.html
Copyright © 2011-2022 走看看