4#include <QtGui/qtguiglobal.h>
5#if QT_CONFIG(accessibility)
12#include <QtGui/qaccessible.h>
13#include <QtGui/qwindow.h>
14#include <QtGui/qguiapplication.h>
15#include <QtGui/private/qguiapplication_p.h>
16#include <QtCore/qt_windows.h>
17#include <qpa/qplatformintegration.h>
19#include <QtCore/private/qwinregistry_p.h>
23using namespace QWindowsUiAutomation;
26bool QWindowsUiaAccessibility::m_accessibleActive =
false;
28QWindowsUiaAccessibility::QWindowsUiaAccessibility()
32QWindowsUiaAccessibility::~QWindowsUiaAccessibility()
37bool QWindowsUiaAccessibility::handleWmGetObject(HWND hwnd, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
41 m_accessibleActive =
true;
48 if (QAccessibleInterface *accessible =
window->accessibleRoot()) {
49 QWindowsUiaMainProvider *provider = QWindowsUiaMainProvider::providerForAccessible(accessible);
50 *lResult = UiaReturnRawElementProvider(hwnd, wParam, lParam, provider);
61 if (
object->inherits(
"QMessageBox")) {
67 switch (
object->property(
"icon").toInt()) {
82 const QString key =
"AppEvents\\Schemes\\Apps\\.Default\\"_L1
83 + soundName +
"\\.Current"_L1;
87static void playSystemSound(
const QString &soundName)
89 if (!soundName.isEmpty() && !soundFileName(soundName).isEmpty()) {
90 PlaySound(
reinterpret_cast<const wchar_t *
>(soundName.utf16()),
nullptr,
91 SND_ALIAS | SND_ASYNC | SND_NODEFAULT | SND_NOWAIT);
96void QWindowsUiaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *
event)
102 switch (
event->type()) {
103 case QAccessible::PopupMenuStart:
106 case QAccessible::MenuCommand:
109 case QAccessible::Alert:
110 playSystemSound(alertSound(
event->object()));
118 if (!m_accessibleActive)
121 QAccessibleInterface *accessible =
event->accessibleInterface();
122 if (!
isActive() || !accessible || !accessible->isValid())
126 if (!UiaClientsAreListening())
129 switch (
event->type()) {
130 case QAccessible::Announcement:
131 QWindowsUiaMainProvider::raiseNotification(
static_cast<QAccessibleAnnouncementEvent *
>(
event));
133 case QAccessible::Focus:
134 QWindowsUiaMainProvider::notifyFocusChange(
event);
136 case QAccessible::StateChanged:
137 QWindowsUiaMainProvider::notifyStateChange(
static_cast<QAccessibleStateChangeEvent *
>(
event));
139 case QAccessible::ValueChanged:
140 QWindowsUiaMainProvider::notifyValueChange(
static_cast<QAccessibleValueChangeEvent *
>(
event));
142 case QAccessible::NameChanged:
143 QWindowsUiaMainProvider::notifyNameChange(
event);
145 case QAccessible::SelectionAdd:
146 QWindowsUiaMainProvider::notifySelectionChange(
event);
148 case QAccessible::TextAttributeChanged:
149 case QAccessible::TextColumnChanged:
150 case QAccessible::TextInserted:
151 case QAccessible::TextRemoved:
152 case QAccessible::TextUpdated:
153 case QAccessible::TextSelectionChanged:
154 case QAccessible::TextCaretMoved:
155 QWindowsUiaMainProvider::notifyTextChange(
event);
static bool closingDown()
Returns true if the application objects are being destroyed; otherwise returns false.
static bool startingUp()
Returns true if an application object has not been created yet; otherwise returns false.
static QPlatformIntegration * platformIntegration()
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString stringValue(QStringView subKey) const
static QWindowsContext * instance()
Combined button and popup list for selecting options.
#define QStringLiteral(str)