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窗口部件標記被設置的時候,窗口部件自己對繪製它全部的像素負有責任。html
轉:https://www.cnblogs.com/hnrainll/archive/2011/05/26/2057766.htmlless
總之:update會調用PaintEvent,每每PaintEvent是子類從新定義的ide