4#include <QtGui/qtguiglobal.h>
5#if QT_CONFIG(accessibility)
11#include <QtGui/qaccessible.h>
12#include <QtGui/qwindow.h>
13#include <QtGui/qguiapplication.h>
14#include <QtGui/private/qguiapplication_p.h>
15#include <QtCore/qt_windows.h>
16#include <qpa/qplatformintegration.h>
17#include <QtGui/private/qwindowsuiawrapper_p.h>
19#include <QtCore/private/qwinregistry_p.h>
23using namespace QWindowsUiAutomation;
25bool QWindowsUiaAccessibility::m_accessibleActive =
false;
27QWindowsUiaAccessibility::QWindowsUiaAccessibility()
31QWindowsUiaAccessibility::~QWindowsUiaAccessibility()
36bool QWindowsUiaAccessibility::handleWmGetObject(HWND hwnd, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
40 m_accessibleActive =
true;
47 if (QAccessibleInterface *accessible =
window->accessibleRoot()) {
48 QWindowsUiaMainProvider *provider = QWindowsUiaMainProvider::providerForAccessible(accessible);
60 if (
object->inherits(
"QMessageBox")) {
66 switch (
object->property(
"icon").toInt()) {
86static void playSystemSound(
const QString &soundName)
88 if (!soundName.
isEmpty() && !soundFileName(soundName).isEmpty()) {
89 PlaySound(
reinterpret_cast<const wchar_t *
>(soundName.
utf16()),
nullptr,
90 SND_ALIAS | SND_ASYNC | SND_NODEFAULT | SND_NOWAIT);
95void QWindowsUiaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *
event)
102 if (!m_accessibleActive)
105 switch (
event->type()) {
106 case QAccessible::PopupMenuStart:
109 case QAccessible::MenuCommand:
112 case QAccessible::Alert:
113 playSystemSound(alertSound(
event->object()));
119 QAccessibleInterface *accessible =
event->accessibleInterface();
120 if (!
isActive() || !accessible || !accessible->isValid())
131 switch (
event->type()) {
132 case QAccessible::Focus:
133 QWindowsUiaMainProvider::notifyFocusChange(
event);
135 case QAccessible::StateChanged:
136 QWindowsUiaMainProvider::notifyStateChange(
static_cast<QAccessibleStateChangeEvent *
>(
event));
138 case QAccessible::ValueChanged:
139 QWindowsUiaMainProvider::notifyValueChange(
static_cast<QAccessibleValueChangeEvent *
>(
event));
141 case QAccessible::NameChanged:
142 QWindowsUiaMainProvider::notifyNameChange(
event);
144 case QAccessible::SelectionAdd:
145 QWindowsUiaMainProvider::notifySelectionChange(
event);
147 case QAccessible::TextAttributeChanged:
148 case QAccessible::TextColumnChanged:
149 case QAccessible::TextInserted:
150 case QAccessible::TextRemoved:
151 case QAccessible::TextUpdated:
152 case QAccessible::TextSelectionChanged:
153 case QAccessible::TextCaretMoved:
154 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
const ushort * utf16() const
Returns the QString as a '\0\'-terminated array of unsigned shorts.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QString stringValue(QStringView subKey) const
static QWindowsContext * instance()
static QWindowsUiaWrapper * instance()
LRESULT returnRawElementProvider(HWND hwnd, WPARAM wParam, LPARAM lParam, IRawElementProviderSimple *el)
Combined button and popup list for selecting options.
#define QStringLiteral(str)