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 enables the use of QPainter 进行描绘在 QWindow with type RasterSurface. The other way of rendering to a QWindow is through the use of OpenGL with QOpenGLContext .

A QBackingStore contains a buffered representation of the window contents, and thus supports partial updates by using QPainter to only update a sub region of the window contents.

QBackingStore might be used by an application that wants to use QPainter without OpenGL acceleration and without the extra overhead of using the QWidget or QGraphicsView UI stacks. For an example of how to use QBackingStore see the 光栅窗口范例 .

成员函数文档编制

QBackingStore:: QBackingStore ( QWindow * window )

构造空表面为给定顶层 window .

QBackingStore:: ~QBackingStore ()

销毁此表面。

void QBackingStore:: beginPaint (const QRegion & region )

Begins painting on the backing store surface in the given region .

You should call this function before using the paintDevice () to paint.

另请参阅 endPaint () 和 paintDevice ().

void QBackingStore:: endPaint ()

Ends painting.

You should call this function after painting with the paintDevice () has ended.

另请参阅 beginPaint () 和 paintDevice ().

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

Flushes the given region from the specified window onto the screen.

window must either be the top level window represented by this backingstore, or a non-transient child of that window. Passing nullptr falls back to using the backingstore's top level window.

window is a child window, the region should be in child window coordinates, and the offset should be the child window's offset in relation to the backingstore's top level window.

You should call this function after ending painting with endPaint ().

QPlatformBackingStore *QBackingStore:: handle () const

Returns a pointer to the QPlatformBackingStore implementation

bool QBackingStore:: hasStaticContents () const

Returns a boolean indicating if this window has static contents or not.

QPaintDevice *QBackingStore:: paintDevice ()

Returns the paint device for this surface.

警告: The device is only valid between calls to beginPaint () 和 endPaint (). You should not cache the returned value.

void QBackingStore:: resize (const QSize & size )

Sets the size of the window surface to 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

Returns the current size of the window surface.

QRegion QBackingStore:: staticContents () const

返回 QRegion representing the area of the window that has static contents.

另请参阅 setStaticContents ().

QWindow *QBackingStore:: window () const

返回关联此表面的顶层窗口指针。