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

[Reg]: Characters disappear on a line with multiple consecutive spaces and enabled QTextOption::ShowLineAndParagraphSeparators

    XMLWordPrintable

Details

    • d4b30757ab2f66e351a73f087b834d578d21ea15

    Description

      If you activate QTextOption::ShowLineAndParagraphSeparators on a QTextDocument and have spaces in a line, the last characters in that line are not shown.
      If you have the following line:

      1  23   456789

      the text you see is:

      1  23   4567

      Only the last consecutive spaces matter. And for each space a character at the end of the line gets hidden (including the linebreak symbol).

      If you use a TextEdit the navigation and selection behaviour is also broken.
      Pressing 'End' on the line will move the cursor to the previous to last visible character. But if you use the cursor keys you can move to the real end of the line.

      Example:

      QTextEdit *textEdit = new QTextEdit;
      QTextOption option = textEdit->document()->defaultTextOption();
      option.setFlags( option.flags() | QTextOption::ShowTabsAndSpaces | QTextOption::ShowLineAndParagraphSeparators );
      textEdit->document()->setDefaultTextOption( option );
      textEdit->setPlainText( QLatin1String("1234567890\n"
      										 "1 2 3 4 5 6 7 8 9 0\n"
      										 "1   2  3 4  5     67890\n") );
      textEdit->show();
      

      The result can be seen in the attached image.

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            mkrems Marcel Krems
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes