[Interest] QAccessibleAnnouncementEvent on a non-object class

Volker Hilsheimer volker.hilsheimer at qt.io
Thu Jun 13 13:27:09 CEST 2024


I don’t think I understand the problem.

Are you not able to instantiate QAccessibleAnnouncementEvent because you are not in C++? Or do you not have access to Qt APIs?

If adding QAccessibleAnnouncementEvent::setMessage would help, then how do you get hold of the QAccessibleAnnouncementEvent instance to call that method on?


FWIW, QAccessibleAnnouncementEvent, is a new type in Qt 6.8, and we are still in beta, so if there’s anything missing from that class to make it usable, then there’s still time to add it.

Volker

 
> On 13 Jun 2024, at 12:28, Corentin Bacqué-cazenave <corentin at progaccess.net> wrote:
> 
> Hi,
> yes, I understand, but in this case, how should we make to send a notification from everywhere. In the project I'm contributing to, we have to send notification for some events (E.G. by an user send a message, or when we change the volume), so we have just a method to send a text to speech message, but this method can be called from any object class.
> A solution could be to extern the QAccessibleAnnouncementEvent, but unfortunately we don't have a setMessage method so we can't do this :(
> 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
> Le 13/06/2024 à 12:14, Volker Hilsheimer a écrit :
>>> On 13 Jun 2024, at 11:48, Corentin Bacqué-cazenave via Interest <interest at 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
>> 
>> 
>> 



More information about the Interest mailing list