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

selectAll does nothing in onFocusChanged triggered by touch input

XMLWordPrintable

    • Linux/X11, Windows
    • d6ddfa3d4 (dev), d0c73a757 (6.4), bea45bb3a (6.5)

      Given this example:

      TextField {
          text: '1990'
      
          onFocusChanged: function(focus) {
              if(focus) {
                  selectAll();
               }
          }
      } 

      In 6.4.0 beta 1 you could do selectAll in a onFocusChanged when it was triggered by a touch screen.

      In 6.4.0 beta 3 is does not work anymore. Text does not get selected when touched on a touch panel. It only get selected when I click on it with a mouse.

      As workaround I do selectAll in a setTimeout like function.

      setTimeout(selectAll, 1)

      where setTimeout is inspired by this answer https://stackoverflow.com/a/56014403

      Then it works again.

      EDIT:
      the onFocusChanged signal is received and focus is true. It really is selectAll that does not have an effect. 

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

            tokorpip Tomi Korpipää
            jorisvergeer Joris Vergeer
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes