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

Transparent pixmaps rendered using QGraphicsView not aligned with background

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.2
    • Widgets: GraphicsView
    • None
    • Intel(R) Xeon(R) W-2223 CPU @ 3.60GHz 3.60 GHz
      32.0 Go
      NVidia Quadro P2200

      Windows 10 Pro
      19042.746
    • Windows

    Description

      Using a QGraphicsView to render two QPixmaps of the same size, one as a background and the other, semi-transparent with some pixels painted opaque used as an overlay.

      When scaling the view, the pixmaps appear mis-aligned at specific scales but not at others.

      The issue is not present when setting a QGLWidget or QOpenGLWidget as the viewport.

       

       

      // Example code that produce the issue
          QGraphicsScene* scene = new QGraphicsScene();
          setScene(scene);
      
      
          // Load background image of size(320,240)
          QPixmap* backgroundLayer = new QPixmap("C:\\path_to_image_file\\22-02-2022_16h13m03s.png");
          scene->addPixmap(*backgroundLayer);
      
          badPixelsLayer = new QPixmap(backgroundLayer->size());
          badPixelsLayer->fill(Qt::transparent);
          // Paint some pixels on this pixmap
          scenePixmapItem = scene->addPixmap(*badPixelsLayer);
          float scaleFactor = 86.7362;
      
          scale(scaleFactor, scaleFactor);
      

      Below is the scaled view of the two pixmaps, the squares are the images' pixels. Background is in grayscale, overlay transparent with red pixels.

       

       

       

      Attachments

        1. mis-aligned-pixmaps.PNG
          14 kB
          Mickael Pouchol
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            bibr Andreas Aardal Hanssen
            mickaelp Mickael Pouchol
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes