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

QLabel wordwrap ignores non-breaking spaces

XMLWordPrintable

      When wordwrap is enabled and text contains non-breaking space, text is getting splitted into multiple lines, which obviously shouldn't happen.

      #include <QApplication>
      #include <QLabel>
      #include <QTextEdit>
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          QLabel label;
          label.setWordWrap(true);
          QFont font;
          font.setPixelSize(20);
          label.setFont(font);
          label.setTextFormat(Qt::RichText);
          label.setText("Non&nbsp;breaking&nbsp;space.&nbsp;Non&nbsp;breaking&nbsp;space.&nbsp;Non&nbsp;breaking&nbsp;space.");
          label.show();
          return a.exec();
      }
      

      This does not happen in Qt4.8.

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

            esabraha Eskil Abrahamsen Blomfeldt
            anylitok Antti Yli-Tokola (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes