My idea is to instantiate QAccessibleAnnouncementEvent in the main window class of the app, and then exteren this instance to use in other class. Then, we can just call the instance with setMessage.

For now I tried to extern a QObject of my main window and use this object in my non object class, but it seams to be not working.

So, yes, probably add a setMessage method can help.

If it can helps to understand what I'm trying to do, you can check here:

WIP: Support Qt Accessibility Announcement for TTS events by CoBC · Pull Request #2366 · BearWare/TeamTalk5 (github.com) <https://github.com/BearWare/TeamTalk5/pull/2366>

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 à 13:27, Volker Hilsheimer a écrit :
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<coren...@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@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