Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-141361

Content inside window is not properly rendered when displaying more than one window

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.10.0
    • GUI: Painting
    • None
    • OS: Archlinux
      WM: Hyprland
    • Linux/Wayland

      When displaying more than 2 Windows, content rendered inside them, (atleast in a qquickwindow) appears very broken. The computed size of the red rectangle is correct and does for example compute the mouse area properly, meaning this appears to be a purely visual issue. In addition to that this issue seems to only manifest itself when I use a fractional scale (1.6 in my case), and seems to be absent at 1x or 2x scaling. Attached below is a minimal example and a video showcasing the behaviour.

       

      #include <qguiapplication.h>
      #include <qquickwindow.h>
      #include <qpainter.h>
      #include <qquickpainteditem.h>
      
      class RedRectangle : public QQuickPaintedItem
      {
      public:
          RedRectangle(QQuickItem *parent = nullptr) : QQuickPaintedItem(parent) {}
      
          void paint(QPainter *painter) override
          {
              painter->fillRect(boundingRect(), Qt::red);
          }
      };
      
      void init_window(QQuickWindow* window)
      {
          RedRectangle* rect = new RedRectangle();
          rect->setParentItem(window->contentItem());
          rect->setWidth (100);
          rect->setHeight(100);
          
          window->show();
      }
      
      int main(int argc, char* argv[])
      {
          QGuiApplication app(argc, argv);
          
          QQuickWindow window_0{};
          init_window(&window_0);
          
          // Both lines commented out for first example
          QQuickWindow window_1{};
          init_window(&window_1);
          
          return QGuiApplication::exec();
      }
      

       

      Querying both screens yields:

      Screen: "DP-1" Logical DPI: 96 Device Pixel Ratio: 2 Geometry: QRect(0,0 2400x1350)
      Screen: "DP-3" Logical DPI: 96 Device Pixel Ratio: 2 Geometry: QRect(2400,0 2400x1350)

        1. win_dual.mp4
          2.34 MB
        2. win_single.mp4
          778 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            vgt Eirik Aavitsland
            jsentity Timur Vaydogan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes