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

QPainter::drawText() fails to draw correct text in some circumstances.Related to QTBUG-12950

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 4.7.4
    • 4.7.1
    • GUI: Painting
    • None
    • Fedora 14 qt-4.7.1
    • fd8183129d0efe99e0d28f524264c59fb9155b80

    Description

      clip rect is 0, 0, 128, 39.
      rect is 4, 4, 120, 31
      font is current system font (liberation sans, size=9).

      painter.drawText(rect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextWordWrap, 
      tr("Save project\nCtrl + S"));

      Draws
      --------
      Save
      project
      ---------

      But should be
      ----------------
      Save project
      Ctrl + S
      ----------------

      Same code works ok with qt-4.6.3, but not with qt-4.7.1 (don't know about 
      4.7.0). Tested on linux (fedora 14), Fedora 13 = qt-4.6.3.Don't know if other platforms are
      affected with this bug.

      Problem exists if first line contains < 3 spaces and line feed and flags 
      contains Qt::TextWordWrap .
      eg. 'Save project\nCtrls + S' - BAD
      eg. 'Save project with\nCtrls + S' - BAD
      eg. 'Save project with keys\nCtrl + S' GOOD

      Note that without Qt::TextWordWrap everything works fine.

      Attachments

        1. bugshot.png
          bugshot.png
          26 kB
        2. main.cpp
          3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jiang Jiang Jiang
            zeljko Zeljan Rikalo
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes