Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.3.0
-
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.