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

A QTextEdit that is not tall enough for a line of text will scroll up and down unnecessarily when the caret is moved by inserting characters or clicking with the mouse

    XMLWordPrintable

Details

    Description

      If you have a QTextEdit control that's too short to contain a single line of the text that is being edited, then the editor will alternate between scrolling to the top and to the bottom of the document whenever text is entered or whenever the caret is repositioned with the mouse.

      You can reproduce this easily with the attached application: just type in to the text edit (set to 72pt Times New Roman) and you'll see the problem.

      "Why would you do that?" I hear you cry. Well, in our application, the editor size is determined by the user adjusting the frame the text is in, and some CJK fonts have a very large line height, meaning that the user may have adjusted the frame (with border) to fit the text visually but the editor may still be too small for a full line's height. This is the case that was reported to us by a user, anyway.

      I think the bug is in QTextEditPrivate::_q_ensureVisible; in this case, rect.t() == verticalOffset(), and this incorrectly goes in to the else construct in the conditional at the end. This case should probably just not reposition.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            jlarcombe James Larcombe
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes