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

TextInput scrolls unnecessarily when committing a word near right edge while having text on front of committed word

    XMLWordPrintable

Details

    Description

      Steps to reproduce:

      1) have a TextInput with a explicit width.
      2) add text so that the TextInput starts to scroll (more than it's width)
      3) Move the cursor before the last word and start typing a word in preedit
      4) type until the cursor is at the right edge
      5) commit the word

      Expected result:
      word is committed and the textinput scrolls one character

      Actual result:
      word is committed but the TextInput scrolls the length of the word being commited

      After some study I found out that QDeclarativeTextInputPrivate::updateHorizontalScroll gets called after adding the preedit word and not yet having the preedit text reseted. This leads to scrolling too much.

      The problem was solved by moving
      setPreeditArea(m_cursor, event->preeditString());

      in void QLineControl::processInputMethodEvent(QInputMethodEvent *event) before the
      if (!event->commitString().isEmpty())

      { insert(event->commitString()); cursorPositionChanged = true; }

      This is critical for us since unexpected scrolling breaks our custom behavior (in addition to looking weird).

      Attachments

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

        Activity

          People

            denexter Andrew den Exter (closed Nokia identity) (Inactive)
            arantone Aleksi Rantonen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes