Details
-
Bug
-
Resolution: Cannot Reproduce
-
P1: Critical
-
None
-
5.6, 5.7.0
-
None
-
X11, Linux, Qt XCB backend, LXQt desktop, XRANDR 1.3
Description
Using a QPixmap to paint the background of a window could be done by setting the QPixmap to the texture of a QBrush, and then set the QBrush to the QPalette. This is broken in newer versions of Qt 5 if the pixmap is larger than current screen size in a XRANDR multi-monitor setting.
The attachment contain a test case to reproduce this bug.
Widget::Widget() { QScreen* screen = qApp->primaryScreen(); // make the window as large as the virtual screen setGeometry(screen->availableVirtualGeometry()); QImage img("numix.png"); // resize the image to the virtual screen size QPixmap pix = QPixmap::fromImage(img.scaled(screen->availableVirtualSize())); QBrush b(pix); QPalette p(palette()); p.setBrush(QPalette::Window, b); // use the image to paint the window background setPalette(p); }
I have two monitors with the resolution 1920x1200. Side-by-side, they can form a large virtual screen with the size of 3840 x 1200.
In the code I set a 3840 x 1200 QPixmap to a QBrush, and use that QBrush to paint a window whose size is also 3840 x 1200.
The expected result should be like "expected.png", the window background is filled by the 3840x1200 pixmap.
However, the actual result is "actual.png", in which the QPixmap is clipped and only the left part (1920x1200) is used as the texture pattern and it's repeated twice.
This never happened in earlier Qt 4.8 and 5.4 versions. So I guess it's a regression bug. Please help fix this.
This bug breaks the desktop icon manager of the LXQt desktop environment.
Reported in LXQt bug tracker by many users. https://github.com/lxde/lxqt/issues/1027