QBackingStore 類

QBackingStore 類提供繪製區域為 QWindow . 更多...

頭: #include <QBackingStore>
qmake: QT += gui
Since: Qt 5.0

該類在 Qt 5.0 引入。

公共函數

QBackingStore (QWindow * window )
~QBackingStore ()
void beginPaint (const QRegion & region )
void endPaint ()
void flush (const QRegion & region , QWindow * window = nullptr, const QPoint & offset = QPoint())
QPlatformBackingStore * handle () const
bool hasStaticContents () const
QPaintDevice * paintDevice ()
void resize (const QSize & size )
bool scroll (const QRegion & area , int dx , int dy )
void setStaticContents (const QRegion & region )
QSize size () const
QRegion staticContents () const
QWindow * window () const

詳細描述

QBackingStore 使能夠使用 QPainter 進行描繪在 QWindow 按 RasterSurface 類型。其它方式渲染到 QWindow 是通過使用 OpenGL 采用 QOpenGLContext .

QBackingStore 包含錶示窗口內容的緩衝,因此支持部分更新通過使用 QPainter 以僅更新窗口內容的子區域。

QBackingStore 可以用於應用程序想要使用 QPainter 沒有 OpenGL 加速,且在沒有額外開銷下使用 QWidget or QGraphicsView UI 堆棧。如何使用 QBackingStore 的範例見 光柵窗口範例 .

成員函數文檔編製

QBackingStore:: QBackingStore ( QWindow * window )

構造空錶麵為給定頂層 window .

QBackingStore:: ~QBackingStore ()

銷毀此錶麵。

void QBackingStore:: beginPaint (const QRegion & region )

開始在後備存儲錶麵描繪按給定 region .

應該調用此函數先於使用 paintDevice () 進行描繪。

另請參閱 endPaint () 和 paintDevice ().

void QBackingStore:: endPaint ()

結束描繪。

應調用此函數後於描繪采用 paintDevice () 已結束。

另請參閱 beginPaint () 和 paintDevice ().

void QBackingStore:: flush (const QRegion & region , QWindow * window = nullptr, const QPoint & offset = QPoint())

刷新給定 region 從指定 window 到屏幕。

The window 必須是由此 backingstore 錶示的頂層窗口,或是該窗口的非瞬時子級。傳遞 nullptr 迴退到使用 backingstore 的頂層窗口。

window 是子級窗口, region 應在子級窗口坐標中,且 offset 應是子級窗口相對於 backingstore 頂層窗口的偏移。

應該調用此函數後於結束描繪采用 endPaint ().

QPlatformBackingStore *QBackingStore:: handle () const

返迴指嚮 QPlatformBckingStore 實現的指針

bool QBackingStore:: hasStaticContents () const

返迴指示此窗口是否擁有靜態內容的 bool。

QPaintDevice *QBackingStore:: paintDevice ()

返迴用於此錶麵的描繪設備。

警告: 設備纔有效介於調用 beginPaint () 和 endPaint ()。不應緩存返迴值。

void QBackingStore:: resize (const QSize & size )

將窗口錶麵大小設為 size .

另請參閱 size ().

bool QBackingStore:: scroll (const QRegion & area , int dx , int dy )

捲動給定 area dx 像素到右側和 dy 嚮下;兩者 dx and dy 可能為負值。

返迴 true 若捲動區域成功;否則 false。

void QBackingStore:: setStaticContents (const QRegion & region )

Set region 作為此窗口的靜態內容。

另請參閱 staticContents ().

QSize QBackingStore:: size () const

返迴窗口錶麵的當前大小。

QRegion QBackingStore:: staticContents () const

返迴 QRegion 錶示擁有靜態內容的窗口區域。

另請參閱 setStaticContents ().

QWindow *QBackingStore:: window () const

返迴關聯此錶麵的頂層窗口指針。