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

QPainter::drawStaticText() draws underline and strikeout lines misaligned and slanted when using QStaticText with scaling

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.15.19, 6.9.1
    • GUI: Painting
    • None
    • Qt 5.15.19 (MSVC2019, x64)
      Qt 6.9.1 (MSVC2022, x64)
      Windows 11 (23H2)
    • Windows

      When using QPainter::drawStaticText() to draw text from a QStaticText object, the underline and strikeout lines are rendered at incorrect positions and angles.
      They appear diagonally shifted, not just vertically misaligned.
      The displacement depends on font size, painter scale, and Qt version.

      This does not happen with QPainter::drawText() under the same transformation.

      Steps to Reproduce:
      1. Build and run the attached file static_text_bug.cpp

       

      Qt 5.15.19 (MSVC2019, x64)

       

      Qt 6.9.1 (MSVC2022, x64)

        1. static_text_bug.cpp
          1 kB
          Atsushi Yamamoto
        2. image-2025-10-20-18-29-35-024.png
          43 kB
          Atsushi Yamamoto
        3. image-2025-10-20-18-30-34-018.png
          50 kB
          Atsushi Yamamoto
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            esabraha Eskil Abrahamsen Blomfeldt
            ayamamoto Atsushi Yamamoto
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes