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

Spaces Not Accounted for in QFontMetrics Width Calculation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 5.12.12
    • GUI: Font handling
    • None
    • msvc2017
    • Windows

    Description

                  QString text = button->text().replace(" ", "_");
                  QFont boldArialFont("Arial", 14, QFont::Bold);
                  QFontMetrics fm(boldArialFont);
                  QRect textRect = fm.boundingRect(0, 0, 0, 0, Qt::TextWordWrap, text);
                  int textWidth = textRect.width();

      spaces are not counted in the width

       

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            xingwozhonghua 世杰 陈
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes