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
qminimalbackingstore.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
7#include "qscreen.h"
8#include <QtCore/qdebug.h>
9#include <qpa/qplatformscreen.h>
10#include <private/qguiapplication_p.h>
11
13
14using namespace Qt::StringLiterals;
15
18 , mDebug(QMinimalIntegration::instance()->options() & QMinimalIntegration::DebugBackingStore)
19{
20 if (mDebug)
21 qDebug() << "QMinimalBackingStore::QMinimalBackingStore:" << (quintptr)this;
22}
23
27
29{
30 if (mDebug)
31 qDebug("QMinimalBackingStore::paintDevice");
32
33 return &mImage;
34}
35
37{
39 Q_UNUSED(region);
41
42 if (mDebug) {
43 static int c = 0;
44 QString filename = QString("output%1.png").arg(c++, 4, 10, QChar(u'0'));
45 qDebug() << "QMinimalBackingStore::flush() saving contents to" << filename.toLocal8Bit().constData();
46 mImage.save(filename);
47 }
48}
49
51{
53 if (mImage.size() != size)
54 mImage = QImage(size, format);
55}
56
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
Definition qbytearray.h:124
\inmodule QtCore
QScreen * primaryScreen
the primary (or default) screen of the application.
\inmodule QtGui
Definition qimage.h:37
QSize size() const
Returns the size of the image, i.e.
bool save(const QString &fileName, const char *format=nullptr, int quality=-1) const
Saves the image to the file with the given fileName, using the given image file format and quality fa...
Definition qimage.cpp:3888
Format
The following image formats are available in Qt.
Definition qimage.h:41
QPaintDevice * paintDevice() override
Implement this function to return the appropriate paint device.
QMinimalBackingStore(QWindow *window)
void resize(const QSize &size, const QRegion &staticContents) override
void flush(QWindow *window, const QRegion &region, const QPoint &offset) override
Flushes the given region from the specified window.
The QPlatformBackingStore class provides the drawing area for top-level windows.
QWindow * window() const
Returns a pointer to the top-level window associated with this surface.
virtual QImage::Format format() const =0
Reimplement in subclass to return the image format which corresponds to the screen format.
\inmodule QtCore\reentrant
Definition qpoint.h:25
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
QPlatformScreen * handle() const
Get the platform screen handle.
Definition qscreen.cpp:83
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
Definition qstring.cpp:8870
QByteArray toLocal8Bit() const &
Definition qstring.h:638
\inmodule QtGui
Definition qwindow.h:63
Combined button and popup list for selecting options.
#define qDebug
[1]
Definition qlogging.h:164
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLintptr offset
GLint GLsizei GLsizei GLenum format
const GLubyte * c
#define Q_UNUSED(x)
size_t quintptr
Definition qtypes.h:167
aWidget window() -> setWindowTitle("New Window Title")
[2]