[Interest] QAccessibleAnnouncementEvent on a non-object class

Corentin Bacqué-cazenave corentin at progaccess.net
Thu Jun 13 12:28:08 CEST 2024


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 <https://linktr.ee/CoBC1>Sponsor 
<https://github.com/sponsors/nvaccess?sp=CoBC> NVDA, Référent commission 
Cécité & Co et Mandataire CNCPH à la commission Accessibilité 
Universelle - Fédé 100% Handinamique <https://www.handinamique.org/>

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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20240613/64c322d1/attachment.htm>


More information about the Interest mailing list