Qt
  1. Qt
  2. QTBUG-54384

[Regression] Settings a QPixmap larger than screen size to a QBrush/QPalette is broken.

    Details

      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

      1. qbrush_bug.tar.gz
        1.38 MB
        Hong Jen Yee
      1. actual.png
        225 kB
      2. expected.png
        243 kB
      No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

        Hide
        Hong Jen Yee added a comment -

        Also add my XRANDR setup for debugging.

        [pcman@arch-pc ~]$ xrandr
        Screen 0: minimum 8 x 8, current 3840 x 1200, maximum 32767 x 32767
        DP1 disconnected (normal left inverted right x axis y axis)
        DP2 disconnected (normal left inverted right x axis y axis)
        HDMI1 disconnected (normal left inverted right x axis y axis)
        HDMI2 connected primary 1920x1200+1920+0 (normal left inverted right x axis y axis) 550mm x 340mm
        1920x1200 59.95*+
        1680x1050 59.88
        1280x1024 75.02 60.02
        1440x900 59.90
        1280x960 60.00
        1152x864 75.00
        1024x768 75.03 70.07 60.00
        832x624 74.55
        800x600 72.19 75.00 60.32 56.25
        640x480 75.00 72.81 66.67 59.94
        720x400 70.08
        VGA1 connected 1920x1200+0+0 (normal left inverted right x axis y axis) 550mm x 340mm
        1920x1200 59.95*+
        1920x1080 60.00
        1680x1050 59.95
        1280x1024 75.02 60.02
        1440x900 59.89
        1280x960 60.00
        1152x864 75.00
        1024x768 75.03 70.07 60.00
        832x624 74.55
        800x600 72.19 75.00 60.32 56.25
        640x480 75.00 72.81 66.67 59.94
        720x400 70.08
        VIRTUAL1 disconnected (normal left inverted right x axis y axis)

        Show
        Hong Jen Yee added a comment - Also add my XRANDR setup for debugging. [pcman@arch-pc ~] $ xrandr Screen 0: minimum 8 x 8, current 3840 x 1200, maximum 32767 x 32767 DP1 disconnected (normal left inverted right x axis y axis) DP2 disconnected (normal left inverted right x axis y axis) HDMI1 disconnected (normal left inverted right x axis y axis) HDMI2 connected primary 1920x1200+1920+0 (normal left inverted right x axis y axis) 550mm x 340mm 1920x1200 59.95*+ 1680x1050 59.88 1280x1024 75.02 60.02 1440x900 59.90 1280x960 60.00 1152x864 75.00 1024x768 75.03 70.07 60.00 832x624 74.55 800x600 72.19 75.00 60.32 56.25 640x480 75.00 72.81 66.67 59.94 720x400 70.08 VGA1 connected 1920x1200+0+0 (normal left inverted right x axis y axis) 550mm x 340mm 1920x1200 59.95*+ 1920x1080 60.00 1680x1050 59.95 1280x1024 75.02 60.02 1440x900 59.89 1280x960 60.00 1152x864 75.00 1024x768 75.03 70.07 60.00 832x624 74.55 800x600 72.19 75.00 60.32 56.25 640x480 75.00 72.81 66.67 59.94 720x400 70.08 VIRTUAL1 disconnected (normal left inverted right x axis y axis)
        Hide
        Erik Nordstrøm added a comment -

        This affects me as well, using LXQt 0.10.0 on Fedora 23. I have only a single monitor.

        xrandr output:

        Screen 0: minimum 8 x 8, current 2560 x 1440, maximum 32767 x 32767
        DP1 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
        2560x1440 59.95*+
        1920x1080 60.00 60.00 50.00 59.94
        1920x1080i 60.00 50.00 59.94
        1680x1050 59.88
        1280x1024 75.02 60.02
        1440x900 59.90
        1280x960 60.00
        1280x800 59.91
        1152x864 75.00
        1280x720 60.00 50.00 59.94
        1440x576 50.00
        1024x768 75.03 70.07 60.00
        1440x480 60.00 59.94
        832x624 74.55
        800x600 72.19 75.00 60.32 56.25
        720x576 50.00
        720x480 60.00 59.94
        640x480 75.00 66.67 60.00 59.94
        720x400 70.08
        HDMI1 disconnected (normal left inverted right x axis y axis)
        HDMI2 disconnected (normal left inverted right x axis y axis)
        1024x768 60.00
        800x600 60.32
        640x480 59.94
        VIRTUAL1 disconnected (normal left inverted right x axis y axis)

        Show
        Erik Nordstrøm added a comment - This affects me as well, using LXQt 0.10.0 on Fedora 23. I have only a single monitor. xrandr output: Screen 0: minimum 8 x 8, current 2560 x 1440, maximum 32767 x 32767 DP1 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm 2560x1440 59.95*+ 1920x1080 60.00 60.00 50.00 59.94 1920x1080i 60.00 50.00 59.94 1680x1050 59.88 1280x1024 75.02 60.02 1440x900 59.90 1280x960 60.00 1280x800 59.91 1152x864 75.00 1280x720 60.00 50.00 59.94 1440x576 50.00 1024x768 75.03 70.07 60.00 1440x480 60.00 59.94 832x624 74.55 800x600 72.19 75.00 60.32 56.25 720x576 50.00 720x480 60.00 59.94 640x480 75.00 66.67 60.00 59.94 720x400 70.08 HDMI1 disconnected (normal left inverted right x axis y axis) HDMI2 disconnected (normal left inverted right x axis y axis) 1024x768 60.00 800x600 60.32 640x480 59.94 VIRTUAL1 disconnected (normal left inverted right x axis y axis)

          People

          • Assignee:
            Gunnar Sletta
            Reporter:
            Hong Jen Yee
          • Votes:
            10 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

            • Created:
              Updated:

              Gerrit Reviews

              There are no open Gerrit changes