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

QPainter incorrect drawing when using Qt Static lib on Intel or Rosetta 2

    XMLWordPrintable

Details

    • macOS

    Description

      When two widgets are created and one moves under the second widget, the second widget's drawing will be incorrect.

      The attaches sample project draws objects as below.

      void MdiChild::paintEvent(QPaintEvent* /*pPaintEvent*/)
      {
       QPainter painter(this);
       QPoint origin = mapToParent(QPoint(0,0));
       painter.translate(-origin);
       painter.setBrush(QBrush(QColor(Qt::darkGray)));
       
       QRectF rect(geometry());
      
       // On Intel or Rosetta, draws incorrectly after moving.
       painter.drawRect(rect);
       
       // On Intel or Rosetta, with a High DPI display, both draw incorrectly after moving.
       painter.drawLine(rect.toRect().topLeft(), rect.toRect().bottomRight());
       painter.drawLine(rect.topRight(), rect.bottomLeft());
      }
      

      How to reproduce
      1. Build Qt with the following configuration

      -static -debug-and-release -commercial -platform macx-clang -nomake examples -nomake tests -skip multimedia -no-dbus -cmake-generator "Ninja Multi-Config" 
      -- -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64";
      

      2. Use qtbug98911-mdi-incorrectDrawing.zip (modified version of Qt mdi example) and run with #1

      3. Click on the New tool button to create two widgets.
      4. Click on the Cut tool button to move the first widget.
      5. As it moves under the second widget, the second widget's drawing will be incorrect.
      6. Resize the window to force both widgets to repaint correctly.
      7. Click Copy to move the first widget so that its top left is offscreen, and it will now be drawn incorrectly. Resizing the window does not produce the correct result in this case.

      Expected result (and also in M1 (ARM))

      Actual result (Intel or Rosetta 2)

      Static Qt build environment : Qt6.2.1, M1, Xcode 13.1, macOS 11.6.
      Project build environment : Qt6.2.1, M1, Xcode 13.1, macOS 11.6.

      What is known

      • This does NOT happen with pre-build Qt 6.2.1
      • This does NOT happen on M1(ARM) with the static libs.

      Attachments

        Issue Links

          Activity

            People

              vgt Eirik Aavitsland
              nagrohn Nahomi Gröhn (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: