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

REG: Nbsp no longer works in Qt 5

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.3.2
    • 5.3.0
    • GUI: Text handling
    • None
    • b56a42be1476d7b3330968d81329a5e29b5fb819

    Description

      Make a widget with the following paint event:

          void paintEvent(QPaintEvent *)
          {
              QPainter p(this);
      
              QString s = QString() + QChar(' ') + QChar('a') + QString(10, QChar::Nbsp) + QChar('a') + QChar(' ') + QChar('A');
              QString text = s + s + s + s + s + s + s + s + s + s + s + s + s + s ;
              QTextLayout layout(text);
              layout.beginLayout();
      
              qreal y = 0.0;
              while (1) {
                  QTextLine line = layout.createLine();
                  if (!line.isValid())
                      break;
      
                  line.setLineWidth(width());
                  line.setPosition(QPointF(0, y));
                  y += line.height();
              }
              layout.endLayout();
      
              layout.draw(&p, QPoint(0, 0));
          }
      

      Then resize the width of the window to cause different line breaks. In Qt 4.8, it correctly does not break between the two lower case characters (where there's a string of nbsp chars), but in Qt 5 the nbsp is treated like regular spaces and it will break anywhere.

      Attachments

        For Gerrit Dashboard: QTBUG-39832
        # Subject Branch Project Status CR V

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            esabraha Eskil Abrahamsen Blomfeldt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes