GUI: add ScreenWindowGrabbing capability
On Wayland, there is no protocol to do it yet. Task-number: QTBUG-100792 Task-number: QTBUG-101145 Change-Id: Id72625a8161359111a2d0f43f3215e787778ba6b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
9619cec279
commit
f08e57540d
@ -260,6 +260,10 @@ QPlatformServices *QPlatformIntegration::services() const
|
||||
where there is an alternative, such as Qt Quick with its \c software backend, an
|
||||
automatic fallback to that alternative may occur, if applicable. The default
|
||||
implementation of hasCapability() returns \c true.
|
||||
|
||||
\value ScreenWindowGrabbing The platform supports grabbing window on screen.
|
||||
On Wayland, this capability can be reported as \c false. The default implementation
|
||||
of hasCapability() returns \c true.
|
||||
*/
|
||||
|
||||
/*!
|
||||
@ -284,7 +288,8 @@ QPlatformServices *QPlatformIntegration::services() const
|
||||
bool QPlatformIntegration::hasCapability(Capability cap) const
|
||||
{
|
||||
return cap == NonFullScreenWindows || cap == NativeWidgets || cap == WindowManagement
|
||||
|| cap == TopStackedNativeChildWindows || cap == WindowActivation || cap == RhiBasedRendering;
|
||||
|| cap == TopStackedNativeChildWindows || cap == WindowActivation
|
||||
|| cap == RhiBasedRendering || cap == ScreenWindowGrabbing;
|
||||
}
|
||||
|
||||
QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const
|
||||
|
@ -133,7 +133,8 @@ public:
|
||||
OpenGLOnRasterSurface,
|
||||
MaximizeUsingFullscreenGeometry,
|
||||
PaintEvents,
|
||||
RhiBasedRendering
|
||||
RhiBasedRendering,
|
||||
ScreenWindowGrabbing // whether QScreen::grabWindow() is supported
|
||||
};
|
||||
|
||||
virtual ~QPlatformIntegration() { }
|
||||
|
@ -30,6 +30,8 @@
|
||||
#include <qrasterwindow.h>
|
||||
#include <qscreen.h>
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <private/qguiapplication_p.h>
|
||||
|
||||
#include <QTest>
|
||||
#include <QSignalSpy>
|
||||
@ -205,6 +207,10 @@ void tst_QScreen::orientationChange()
|
||||
|
||||
void tst_QScreen::grabWindow_data()
|
||||
{
|
||||
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(
|
||||
QPlatformIntegration::ScreenWindowGrabbing)) {
|
||||
QSKIP("This platform does not support grabbing windows on screen.");
|
||||
}
|
||||
QTest::addColumn<int>("screenIndex");
|
||||
QTest::addColumn<QByteArray>("screenName");
|
||||
QTest::addColumn<bool>("grabWindow");
|
||||
@ -302,8 +308,6 @@ void tst_QScreen::grabWindow()
|
||||
|
||||
QImage grabbedImage = pixmap.toImage();
|
||||
const QSize grabbedSize = grabbedImage.size();
|
||||
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
|
||||
QEXPECT_FAIL("", "Wayland: Screen grabbing not implemented, See QTBUG-100792.", Abort);
|
||||
QCOMPARE(grabbedSize, expectedGrabSize);
|
||||
|
||||
QPoint pixelOffset = QPoint(0, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user