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

cursorPosition by default contains a length of text

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 4.7.4, 4.8.6, 5.2.1
    • None

    Description

      Quotation from help:

      cursorPosition : int
      This property holds the current cursor position for this line edit.
      ...
      By default, this property contains a value of 0.

      Actually cursorPosition value contains a length of text. That causes QLineEdit showing end of text which is not expected behaviour.

      setText always passes -1 for cursorPosition

      void setText(const QString &txt) { internalSetText(txt, -1, false); }
      

      internalSetText, pos is -1:

      m_cursor = (pos < 0 || pos > m_text.length()) ? m_text.length() : pos;
      

      Attachments

        1. cursorPosition.PNG
          cursorPosition.PNG
          13 kB
        2. cursorPosition.ui
          1 kB
        3. jira-search.PNG
          jira-search.PNG
          2 kB

        Issue Links

          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
              hellclown Dmitry Yelizarov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes