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

a11y: Accessible interface can't be retrieved after calling QAccessibleEvent::setChild on event created using the constructor taking QAccessibleInterface*

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 6.4.0 RC1, 6.5.0 Beta1
    • 6.5
    • None
    • Debian testing, qtbase self-compiled from dev branch as of commit 0131dbd2f95449c09758208d8b190c9238a5c46a
    • Linux/X11
    • 0c0eadc484 (qt/qtbase/dev) 0c0eadc484 (qt/tqtc-qtbase/dev) e3de89533b (qt/qtbase/6.4) e3de89533b (qt/tqtc-qtbase/6.4), 442e347f5 (dev), 012dfa9d0 (6.5), 7b669203b (6.4), cc7e5a7f4 (6.4.3)

    Description

      When creating a QAccessibleEvent using the constructor taking a QAccessibleInterface* parameter, calling the setChild method on it results in QAccessibleEvent::accessibleInterface() returning nullptr instead of an actual QAccessibleInterface*, i.e. it is no not possible to retrieve the associated interface.

      It works as expected when using the QAccessibleEvent constructor that takes a QObject* instead, even if the underlying object is just the same in both cases.

       

      Sample to reproduce:

      (I'll also submit that as a test case along with a suggested fix):

          QWidget widget;
          QWidget childWidget(&widget);
      
          // QAccessibleEvent constructor called with the QObject*
          QAccessibleEvent event1(&widget, QAccessible::Focus);
      
          // QAccessibleEvent constructor called with the QAccessibleInterface* for the same QObject*
          QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&widget);
          QAccessibleEvent event2(iface, QAccessible::Focus);
      
          // all fine here before calling QAccessibleEvent::setChild
          assert(event1.accessibleInterface() != nullptr);
          assert(event2.accessibleInterface() != nullptr);
          assert(event1.accessibleInterface(), event2.accessibleInterface());
      
          // set same child for both
          event1.setChild(0);
          event2.setChild(0);
      
          // this is still OK, case where the ctor taking QObject* was used
          assert(event1.accessibleInterface() != nullptr);
          // these two fail
          assert(event2.accessibleInterface() != nullptr);
          assert(event1.accessibleInterface(), event2.accessibleInterface()); 

       

      (The original scenario where I ran into this was with the Qt 6 based UI variant of LibreOffice where QAccessibleEvent_s e.g. of type _QAccessible::SelectionAdd did not trigger any AT-SPI events when created with the ctor taking QAccessibleInterface.)

       

       

      Attachments

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

        Activity

          People

            smd Jan Arve
            michaelweghorn Michael Weghorn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes