Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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)
36 return UIA_E_ELEMENTNOTAVAILABLE;
37
38 QAccessibleActionInterface *actionInterface = accessible->actionInterface();
39 if (!actionInterface)
40 return UIA_E_ELEMENTNOTAVAILABLE;
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;
53 *pRetVal = ToggleState_Off;
54
55 QAccessibleInterface *accessible = accessibleInterface();
56 if (!accessible)
57 return UIA_E_ELEMENTNOTAVAILABLE;
58
59 if (accessible->state().checked)
60 *pRetVal = accessible->state().checkStateMixed ? ToggleState_Indeterminate : ToggleState_On;
61 else
62 *pRetVal = ToggleState_Off;
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