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>
This commit is contained in:
parent
e85de7d787
commit
b7858e9b4b
@ -105,6 +105,8 @@ public:
|
|||||||
QPlatformScreen();
|
QPlatformScreen();
|
||||||
virtual ~QPlatformScreen();
|
virtual ~QPlatformScreen();
|
||||||
|
|
||||||
|
virtual bool isPlaceholder() const { return false; };
|
||||||
|
|
||||||
virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const;
|
virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const;
|
||||||
|
|
||||||
virtual QRect geometry() const = 0;
|
virtual QRect geometry() const = 0;
|
||||||
@ -172,6 +174,16 @@ private:
|
|||||||
friend class QScreenPrivate;
|
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
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QPLATFORMSCREEN_H
|
#endif // QPLATFORMSCREEN_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user