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

Windows with D3D or Vulkan: stretch effect is not ideal when resizing QQuickWindow

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.3, 6.4
    • 6.2.2
    • Qt RHI
    • None
    • Windows 10.0.19041, Microsoft Visual Studio Professional 2019 (Version 16.11.7)
    • Windows

    Description

      Below is an example that paints three rectangles with fixed sizes & positions in a QQuickWindow. 

      When I resize the window I expect the rectangles not to change. 

      Instead, the rectangles seem to change their size & position as I resize the window. 

       

      Note: this artefact does not appear if the graphics API is set to OpenGL. 

       

      Example:

      #include <QGuiApplication>
      #include <QQuickPaintedItem>
      #include <QQuickWindow>
      #include <QPainter>
      
      
      class Paintable final : public QQuickPaintedItem
      {
      public:
          explicit Paintable(QQuickItem* parent = nullptr)
          : QQuickPaintedItem(parent)
          {
              setOpaquePainting(true);
          }
      
          void paint(QPainter* painter) override
          {
              QColor highlight{255, 0, 0, 50};
      
              painter->fillRect(QRect{QPoint{10, 0},    QSize{100, 100}}, highlight);
              painter->fillRect(QRect{QPoint{20, 20},   QSize{100, 100}}, highlight);
              painter->fillRect(QRect{QPoint{100, 100}, QSize{100, 100}}, highlight);
          }
      };
      
      int main(int argc, char* argv[])
      {
          QGuiApplication app(argc, argv);
      
          // QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
          auto* qquickWindow = new QQuickWindow();
      
          auto* paintable = new Paintable(qquickWindow->contentItem());
          paintable->setSize(QSize{1000, 1000});
          paintable->setVisible(true);
          qquickWindow->show();
      
      
          return app.exec();
      }
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              lagocs Laszlo Agocs
              manu-ni Manuel Grünberg
              Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes