diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2019-10-09 15:24:08 +0200 |
---|---|---|
committer | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2019-11-06 11:18:49 +0100 |
commit | b7858e9b4bdb2866f0c76ecaa8dd25bd9b618afc (patch) | |
tree | 739a0ed5ff3b6915dfc61626b1e0246a70850278 /src | |
parent | e85de7d787498624020884ef2e269c15faf76b50 (diff) |
Add QPlatformPlaceholderScreen
...and QPlatformScreen::isPlaceholder()
This class can be used to reduce the amount of boiler-plate required to create
a fake screen when there are no real screens (Qt doesn't currently support
running with no QScreens).
Change-Id: I7290406a3d010bcbaf15a1a8a84216e3abf75c78
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qplatformscreen.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformscreen.h b/src/gui/kernel/qplatformscreen.h index d7378aed51..e27355a940 100644 --- a/src/gui/kernel/qplatformscreen.h +++ b/src/gui/kernel/qplatformscreen.h @@ -105,6 +105,8 @@ public: QPlatformScreen(); virtual ~QPlatformScreen(); + virtual bool isPlaceholder() const { return false; }; + virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; virtual QRect geometry() const = 0; @@ -172,6 +174,16 @@ private: friend class QScreenPrivate; }; +// Qt doesn't currently support running with no platform screen +// QPA plugins can use this class to create a fake screen +class QPlatformPlaceholderScreen : public QPlatformScreen { + bool isPlaceholder() const override { return true; }; + QRect geometry() const override { return QRect(); } + QRect availableGeometry() const override { return QRect(); } + int depth() const override { return 32; } + QImage::Format format() const override { return QImage::Format::Format_RGB32; } +}; + QT_END_NAMESPACE #endif // QPLATFORMSCREEN_H |