Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qwindowsuiatoggleprovider.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include <QtGui/qtguiglobal.h>
5#if QT_CONFIG(accessibility)
6
8#include "qwindowsuiautils.h"
9#include "qwindowscontext.h"
10
11#include <QtGui/qaccessible.h>
12#include <QtCore/qloggingcategory.h>
13#include <QtCore/qstring.h>
14
16
17using namespace QWindowsUiAutomation;
18
19
20QWindowsUiaToggleProvider::QWindowsUiaToggleProvider(QAccessible::Id id) :
21 QWindowsUiaBaseProvider(id)
22{
23}
24
25QWindowsUiaToggleProvider::~QWindowsUiaToggleProvider()
26{
27}
28
29// toggles the state by invoking the toggle action
30HRESULT STDMETHODCALLTYPE QWindowsUiaToggleProvider::Toggle()
31{
32 qCDebug(lcQpaUiAutomation) << __FUNCTION__;
33
34 QAccessibleInterface *accessible = accessibleInterface();
35 if (!accessible)
37
38 QAccessibleActionInterface *actionInterface = accessible->actionInterface();
39 if (!actionInterface)
41
42 actionInterface->doAction(QAccessibleActionInterface::toggleAction());
43 return S_OK;
44}
45
46// Gets the current toggle state.
47HRESULT STDMETHODCALLTYPE QWindowsUiaToggleProvider::get_ToggleState(ToggleState *pRetVal)
48{
49 qCDebug(lcQpaUiAutomation) << __FUNCTION__;
50
51 if (!pRetVal)
52 return E_INVALIDARG;
54
55 QAccessibleInterface *accessible = accessibleInterface();
56 if (!accessible)
58
59 if (accessible->state().checked)
60 *pRetVal = accessible->state().checkStateMixed ? ToggleState_Indeterminate : ToggleState_On;
61 else
63 return S_OK;
64}
65
67
68#endif // QT_CONFIG(accessibility)
Combined button and popup list for selecting options.
#define qCDebug(category,...)
GLenum GLuint id
[7]
long HRESULT
#define UIA_E_ELEMENTNOTAVAILABLE
IRawElementProviderFragment __RPC__deref_out_opt IRawElementProviderFragment ** pRetVal
ToggleState
Definition uiatypes_p.h:75
@ ToggleState_On
Definition uiatypes_p.h:77
@ ToggleState_Indeterminate
Definition uiatypes_p.h:78
@ ToggleState_Off
Definition uiatypes_p.h:76