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

Use of KeyNavigation does not have visual change of focus

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.6.0 RC
    • 5.4.0 Alpha
    • Quick: Controls 1
    • None
    • ArchLinux
    • 4f3379352a265bab00a7265f85ffc38a9ca4ffe4

    Description

      If I have set of buttons with KeyNavigation.<direction> between them, I can move focus, but I don't see that.

      The reason is that KeyNavigation.<direction> uses Qt.OtherFocusReason. And QQuickStyleItem sets its hasFocus property only in case of Qt.TabFocusReason or Qt.BacktabFocusReason (See here).

          // some styles don't draw a focus rectangle if
          // QStyle::State_KeyboardFocusChange is not set
          if (window()) {
               Qt::FocusReason lastFocusReason = QQuickWindowPrivate::get(window())->lastFocusReason;
               if (lastFocusReason == Qt::TabFocusReason || lastFocusReason == Qt::BacktabFocusReason) {
                   m_styleoption->state |= QStyle::State_KeyboardFocusChange;
               }
          }
      

      Possible solutions would be to respect Qt.OtherFocusReason in QQuickStyleItem or make KeyNavigation use Qt.TabFocusReason instead of its current behaviour.

      Personally, I don't like both ways. I would prefer to add a new focus reason (e.g. Qt.KeyNavigationFocusReason) to specify this particular case.

      Attachments

        For Gerrit Dashboard: QTBUG-41801
        # Subject Branch Project Status CR V

        Activity

          People

            liaqi Liang Qi
            trollixx Oleg Shparber
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes