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

forceActiveFocus should be able to change focusReason for a Control with activeFocus

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.15, 6.5.0
    • All

    Description

      Calling forceActiveFocus(…) on an otherwise already focused QQC2 control with a different focus reason than the control currently has, has no effect whatsoever. The method short-circuits on the fact that an item is already focused, and refuses doing anything further.

      Consider gaming system with a hybrid touch screen + gamepad input. Whenever user touches the screen, software switched into touch mode (think of a smartphone) where the concept of "current item" or "focus" is almost non-existent except for the text fields. On the other hand, as soon as user presses any button on their gamepad, system goes into key navigation mode, in which it draws huge easily recognizable visual focus ring around focused control.

      The problem is, QtQuick forceActiveFocus(…) API won't do anything about already focused item, so the best we could do is to set the relevant focusReason manually, (ab-?)using the fact that it's a read-write property, despite documentation telling you otherwise.

      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
            ratijas ivan tkachenko
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes