Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qrasterwindow.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qrasterwindow.h"
5
6#include <QtGui/private/qpaintdevicewindow_p.h>
7
8#include <QtGui/QBackingStore>
9#include <QtGui/QPainter>
10
12
34{
35 Q_DECLARE_PUBLIC(QRasterWindow)
36public:
37 void handleResizeEvent() override
38 {
39 Q_Q(QRasterWindow);
40 if (backingstore->size() != q->size())
42 }
43
44 void beginPaint(const QRegion &region) override
45 {
46 Q_Q(QRasterWindow);
47 const QSize size = q->size();
48 if (backingstore->size() != size)
50
51 backingstore->beginPaint(region);
52 }
53
54 void endPaint() override
55 {
57 }
58
59 void flush(const QRegion &region) override
60 {
61 Q_Q(QRasterWindow);
62 backingstore->flush(region, q);
63 }
64
65 QScopedPointer<QBackingStore> backingstore;
66};
67
73{
74 setSurfaceType(QSurface::RasterSurface);
75 d_func()->backingstore.reset(new QBackingStore(this));
76}
77
79{
80 Q_D(QRasterWindow);
81 // Delete backingstore while window is still alive, as it
82 // might need to reference the window in the process
83 d->backingstore.reset(nullptr);
84}
85
90{
91 Q_D(const QRasterWindow);
92
93 switch (metric) {
94 case PdmDepth:
95 return d->backingstore->paintDevice()->depth();
96 default:
97 break;
98 }
100}
101
106{
107 Q_D(const QRasterWindow);
108 return d->backingstore->paintDevice();
109}
110
114
116
117#include "moc_qrasterwindow.cpp"
The QBackingStore class provides a drawing area for QWindow.
void beginPaint(const QRegion &)
Begins painting on the backing store surface in the given region.
void flush(const QRegion &region, QWindow *window=nullptr, const QPoint &offset=QPoint())
Flushes the given region from the specified window onto the screen.
void resize(const QSize &size)
Sets the size of the window surface to size.
QSize size() const
Returns the current size of the window surface.
void endPaint()
Ends painting.
int metric(PaintDeviceMetric metric) const override
\inmodule QtCore\reentrant
Definition qpoint.h:25
void endPaint() override
QScopedPointer< QBackingStore > backingstore
void handleResizeEvent() override
void flush(const QRegion &region) override
void beginPaint(const QRegion &region) override
\inmodule QtGui
void resizeEvent(QResizeEvent *event) override
Override this to handle resize events (ev).
QRasterWindow(QWindow *parent=nullptr)
Constructs a new QRasterWindow with parent.
int metric(PaintDeviceMetric metric) const override
QPaintDevice * redirected(QPoint *) const override
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
The QResizeEvent class contains event parameters for resize events.
Definition qevent.h:548
\inmodule QtCore
Definition qsize.h:25
@ RasterSurface
Definition qsurface.h:31
\inmodule QtGui
Definition qwindow.h:63
Combined button and popup list for selecting options.
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259