QBackingStore Class
The QBackingStore class provides the backing store for a QWindow. More…
| Header | #include <QBackingStore> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Gui) |
| Module | Nt GUI C++ Classes |
List of all members, including inherited members
Public Functions
| QBackingStore(QWindow *window) | |
| ~QBackingStore() | |
| QWindow * | window() const |
| QPaintDevice * | paintDevice() |
| void | flush(const QRegion ®ion, QWindow *window = nullptr, const QPoint &offset = QPoint()) |
| void | resize(const QSize &size) |
| QSize | size() const |
| void | beginPaint(const QRegion ®ion) |
| void | endPaint() |
Detailed Description
A backing store keeps the pixels of a window. The window paints into the paintDevice() between beginPaint() and endPaint(), and flush() puts the result on the screen:
backingStore.resize(window.size());
backingStore.beginPaint(region);
QPainter painter(backingStore.paintDevice());
painter.fillRect(region.boundingRect(), Qt::white);
painter.end();
backingStore.endPaint();
backingStore.flush(region);
QRasterWindow does this for you.
See also QRasterWindow and QWindow.
Differences from Qt
There is no staticContents(), hasStaticContents() or scroll(). The paint device is always a QImage.
Member Function Documentation
QBackingStore::QBackingStore(QWindow *window)
Constructs a backing store for window. A QGuiApplication must exist.
QBackingStore::~QBackingStore()
Destroys the backing store.
void QBackingStore::beginPaint(const QRegion ®ion)
Prepares the backing store for painting region.
See also endPaint().
void QBackingStore::endPaint()
Ends the painting that beginPaint() started.
void QBackingStore::flush(const QRegion ®ion, QWindow *window = nullptr, const QPoint &offset = QPoint())
Puts region of the backing store on the screen, in window or, if that is nullptr, in the window of the backing store. offset is the position of the window inside the backing store.
QPaintDevice * QBackingStore::paintDevice()
Returns the device to paint on, which has the size that resize() set. Returns nullptr if there is no platform.
void QBackingStore::resize(const QSize &size)
Resizes the backing store to size. The contents are not preserved.
See also size().
QSize QBackingStore::size() const
Returns the size that resize() set.
QWindow * QBackingStore::window() const
Returns the window the backing store belongs to.