Skip to content
  • Volker Hilsheimer's avatar
    Accessibility: respect value in attached Accessible in controls · ebc044fc
    Volker Hilsheimer authored and Albert Astals Cid's avatar Albert Astals Cid committed
    
    
    QQuickItemPrivate::accessibleRole is virtual and called by the framework
    to determine the role of an item. The default implementation checks and
    respects a possible Accessible attached object. However, subclasses that
    override the virtual don't, so the attached properties are ignored, and
    the class-specific implementation wins. This makes it impossible to
    change the role of e.g. a checkable button.
    
    To fix that, move the code respecting the attached object into a non-
    virtual function that the framework calls instead, and only call the
    virtual member if there is no attached object, or if that object is not
    initialized with a role. Replace calls to the virtual from the
    framework with calls to the non-virtual wrapper.
    
    Do this for both QQuickItem and for QQuickPopup, and adjust the logic
    in QQuickControl types that create an attached object and initialize
    it's role when accessibility becomes active. Use the non-overridable
    effective role value for that as well.
    
    Add a test case, and to avoid any new framework calls to the virtual,
    make it private.
    
    Fixes: QTBUG-110114
    Pick-to: 6.5 6.2
    Change-Id: Ia709cecbd181b6d8ee3297a4af60c1e7db9a2c51
    Reviewed-by: default avatarQt CI Bot <qt_ci_bot@qt-project.org>
    Reviewed-by: default avatarJan Arve Sæther <jan-arve.saether@qt.io>
    (cherry picked from commit 3c08d08a)
    ebc044fc