> On 13 Jun 2024, at 11:48, Corentin Bacqué-cazenave via Interest 
> <interest@qt-project.org> wrote:
> 
> Hi,
> I'm trying to implement the new QAccessibleAnnouncementEvent in my project. 
> However, I have a class to hander some TTS functions, and this class is not 
> derived from QObject.
> Is there a way to use QAccessibleAnnouncementEvent to send a notification to 
> screenreaders without a QObject class? I saw we can also use a 
> QAccessibleInterface but it seams we also need a QObject for this.
> Does anyone have a solution?
> Thanks.
> -- 
> Corentin : expert certifié 2022 et Sponsor NVDA, Référent commission Cécité & 
> Co et Mandataire CNCPH à la commission Accessibilité Universelle - Fédé 100% 
> Handinamique

Hi Corentin,


Qt's accessibility framework is based on a tree of QAcessibleInterfaces. For 
most cases, that tree mirrors the corresponding QObject trees. Only QObjects 
can respond to events (which is required to handle incoming calls), so an 
introspection through accessibility technology has to start with something that 
is a QObject (typically a widget).

But e.g. an item view’s items are not QObjects, so the implementation of 
QAccessibleInterface for an item view returns interfaces for items based on 
their position in the view. To raise an event for such an item, you have to get 
the interface for that item, and then you can construct a 
QAccessibleAnnouncementEvent with that interface.

Alternatively, if you have only one level of children and already have the 
QObject that they belong to, then you can create the event with the QObject, 
and the child index by calling QAccessibleEvent::setChild.


Volker


_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to