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

Cannot get keyboard focus on dynamically loaded components

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: P2: Important P2: Important
    • 4.7.0
    • 3.x
    • Widgets: GraphicsView
    • None
    • Tested on Mac OS X

      In QML, there are some issues with clearing/resetting the focus for dynamically created components.

      I've attached an example where a ListView delegate dynamically creates a component (using Loader) that contains a TextInput widget. Clicking "Toggle" toggles this widget on/off. If you toggle the widget on, and then click the TextInput widget, it correctly receives keyboard focus and text can be entered. However, on subsequent toggles, the TextInput widget will not receive keyboard focus and text cannot be entered.

      I have noticed that QGraphicsItem::clearSubFocus() is only called the first time the TextInput widget is clicked. Perhaps the issue is that the focus is not cleared correctly on subsequent clicks so the focus cannot be reassigned.

        1. Archive.zip
          1 kB
          Bea Lam (closed Nokia identity)
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            ylopes Yoann Lopes
            bealam Bea Lam (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes