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

QPlainTextEdit with WordWrap can break navigating

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 4.8.1, 5.0.0
    • None
    • Kubuntu 12.04

    Description

      Having a QPlainTextEdit widget with WordWrapMode set to WordWrap can break navigating with either the mouse or the arrow keys.

      Here's the sample code:

      Snippet from QMainWindow-derived class
      PlainTextTest::PlainTextTest()
      {
        QPlainTextEdit *editor = new QPlainTextEdit(this);
        editor->setWordWrapMode(QTextOption::WordWrap);
        setCentralWidget(editor);
      }
      

      Running this will give a small window with just the editor. Now type a really long word. In my case it was a rather long LaTeX formula on a single line:
      v_

      {\lambda_j})=(\lambda_i\lambda_j)^\alpha\omega_0(v_{\lambda_i},v_{lambda_j}

      )=0=\omega_0(v_

      {\lambda_i}

      ,v_

      {\lambda_j}

      )$$
      A scrollbar will then appear in the QPlainTextEdit widget and scrolling to the right will indeed show the rest of the text that was outside the viewing area.
      When I then try to navigate inside the text by, for example, clicking with the mouse, nothing happens. By that I mean, the cursor will not move the the spot where I clicked with the mouse. This happens only in the part of the text that was scrolled into view.

      I've attached the full sample code for convenience.

      This problem can of course be easily avoided by inserting spaces in the above formula, but a bug is a bug. It does however pose a problem when the font size is turned way up by people who have trouble with their sight.

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            jarno J
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes