Avoid return QImage::Format_Invalid from QPlatformScreen::format()

This can be used to set the pixmap format, and needs to be defined to
something sane even if there is no primary screen.

Task-number: QTBUG-81671
Change-Id: Ic0d41cec31ac71309123aa8bb8b840fa4a4122bb
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2020-01-28 18:00:20 +01:00
parent b26b40f7e1
commit 115e39f9be

View File

@ -665,7 +665,9 @@ QImage::Format QXcbScreen::format() const
bool needsRgbSwap;
qt_xcb_imageFormatForVisual(connection(), screen()->root_depth, visualForId(screen()->root_visual), &format, &needsRgbSwap);
// We are ignoring needsRgbSwap here and just assumes the backing-store will handle it.
if (format != QImage::Format_Invalid)
return format;
return QImage::Format_RGB32;
}
int QXcbScreen::forcedDpi() const