在Qt 4.4中,Alien Widget誕生了(Window負責與視窗系統的聯絡。Alien被號稱是所有閃爍的終結者)

來源:互聯網
上載者:User

標籤:tin   target   oat   ons   count   phi   private   into   sub   

2011年09月29日 23:47:46閱讀數:7269

Qt 4.0

automatically double-buffers

Qt 4.1

QWidget::autoFillBackground

Qt 4.2

delayed widget creation (DWC)

stylesheet

Qt 4.3

QWidget::render

Qt 4.4

Alien Widget

Qt 4.5

Translucent Windows

Qt 4.6

widget‘s graphics effect

Qt 4.8

lighthouse (qpa)

Qt4.0
  • 在Qt 4.0中,啟用雙緩衝,不必在paintEvent()中編寫雙緩衝代碼來避免閃爍。
Qt4.1
  • 在Qt 4.1中,通過啟用背景自動傳遞(propagation),widget不再有任何預設的背景。引入backingstore這個東西。

 

Qt4.2
  • 在Qt 4.2中,延時控制項建立(delayed widget creation)的引入,使得widget可以在沒有真實視窗控制代碼的情況下被建立。

QWindowSurface 與 QWidgetBackingStore

Even though QWidget is a QPaintDevice subclass, one will never render directly into a QWidget’s surface. Instead, during the paintEvent, the painting is redirected to an offscreen surface which is represented by the internal class QWindowSurface.

QWidgetBackingStore is responsible for figuring out which parts of the window surface needs to be updated prior to showing it to screen, so its really a repaint manager.

When the concept of backingstore was introduced in Qt 4.1, the two classes were the same, but the introduction of more varying ways to get content to screen made us split it in two.

Qt4.4
  • 在Qt 4.4中,Alien Widget誕生了,這樣一來,Window和Widget儘管仍是同一個類,卻是不同的東西。Window負責與視窗系統的聯絡。Alien被號稱是所有閃爍的終結者,見Qt Invaded By Aliens — The End of All Flicker。

Qt::WA_NativeWindow

建立原生表單,即帶控制代碼

Qt::WA_PaintOnScreen

強制建立原生表單

Qt::Window

最上層視窗,必須是原生表單 (?)

QGLWidget

必須是原生表單

如果一個widget已經是alien Widget,如果對其設定上述標誌,或者對其調用winId()函數,都會導致其重新建立為一個native widget。

Qt4.5
  • 在Qt 4.5中,graphics system的概念被引入(比如選項有:raster|opengl|x11|native 等)。引人了一個Qt::WA_TranslucentBackground 屬性,這個東西和QWidget::setWindowOpacity()有些比較容易混哈。

QWidget::setWindowOpacity()函數,設定表單(即:isWindow()為真的widget)的整體不透明度, 從0.0到1.0之間, 值越大越不透明。

Qt::WA_TranslucentBackground,這個屬性每個QWidget都可以單獨設定。不被繪製的地區(背景)都是透明的,繪製的地區的透明程度通過顏色或圖片的Alpha Channel值來控制。

Qt4.6
  • 在Qt 4.6中,graphics effect被引入。但是,現在,已經不建議使用:

 

Graphics EffectsState: DeprecatedReasoning: flawed design, we don’t recommend taking maintainership of this code.

QGraphicsEffect 的子類需要重新實現draw()函數。

以安裝了QGraphicsOpacityEffect了QWidget為例,當每次需要重繪時,QWidgetPrivate::drawWidget()不是發送QPaintEvent事件,以調用我們的paintEvent()函數;而是調用QGraphicsOpacityEffect的draw()函數,該函數內,通過QWidget::render()調用paintEvent()將內容繪製在一個QPixmap中,而後設定QPainter的不透明度,繪製QPixmap到目標。

Qt4.8
  • 在Qt 4.8中,正式引入lighthouse了,...
參考
  • http://labs.qt.nokia.com/2011/04/01/qt-hidden-gems/

  • http://labs.qt.nokia.com/2009/02/13/bnilsenflush/

  • http://labs.qt.nokia.com/2009/12/16/qt-graphics-and-performance-an-overview/

  • http://labs.qt.nokia.com/2008/02/04/qt-44-and-painting-performance/

  • http://labs.qt.nokia.com/2008/05/12/qwidget-vs-graphics-view-ding-ding-ding

  • http://labs.qt.nokia.com/2007/08/09/qt-invaded-by-aliens-the-end-of-all-flicker/

  • http://www.cuteqt.com/blog/?p=340

 

6835722

在Qt 4.4中,Alien Widget誕生了(Window負責與視窗系統的聯絡。Alien被號稱是所有閃爍的終結者)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.