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

the visual focus indicator of Button in FluentWinUI3 style doesn't work well with FocusScope

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8.0
    • Quick: Controls 2
    • None
    • Windows

    Description

      Update: seems to be a problem with FocusScope in general. See the comment below.

       


       

      import QtQuick
      import QtQuick.Window
      import QtQuick.Controls.FluentWinUI3
      
      ApplicationWindow {
          width: 640
          height: 480
          visible: true
      
          ListModel {
              id: mymodel
              ListElement {
                  name: "1"
              }
              ListElement {
                  name: "2"
              }
              ListElement {
                  name: "3"
              }
          }
          component MyButton: Button {
              required property string name
              text: name
              onFocusChanged: {
                  console.log(name + focus)
              }
              onClicked: {
                  console.log(name + " clicked")
              }
              focusPolicy: Qt.StrongFocus
          }
      
          GridView {
              id: grid
              anchors.fill: parent
              focus: true
              model: mymodel
              keyNavigationEnabled: true
              delegate: MyButton {}
              highlight: Rectangle {
                  id: highlighter
                  color: "lightgray"
              }
          }
      }
      
      

      First try to change focus to the third button using Tab key, then use arrow keys to change focus, you can see that the focus is overridden by the GridView's own keyboard navigation handling. However, the Button's focus indicator (line border) doesn't disappear. The same happens when you use a mouse to click on a button. This doesn't follow WinUI 2/3 behavior with elements' focus indicator.

      Material style doesn't have this issue: the visual highlight drew by the Button fades away when either the focus changes, or when mouse clicks on a button. However, it does seem to share a problem with FluentWinUI3 which is the inability to reuse the Control style's focus indicator for ListView/GridView selection highlight: I would like to have ListView/GridView trigger whatever the Control style has for the Button's focus visual highlight, instead of having to draw my own.

      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
            jclink Jessia Clinkscale
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes