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
qwindowsuiatableprovider.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
9#include "qwindowsuiautils.h"
10#include "qwindowscontext.h"
11
12#include <QtGui/qaccessible.h>
13#include <QtCore/qloggingcategory.h>
14#include <QtCore/qstring.h>
15
17
18using namespace QWindowsUiAutomation;
19
20
21QWindowsUiaTableProvider::QWindowsUiaTableProvider(QAccessible::Id id) :
22 QWindowsUiaBaseProvider(id)
23{
24}
25
26QWindowsUiaTableProvider::~QWindowsUiaTableProvider()
27{
28}
29
30// Gets the providers for all the row headers in the table.
31HRESULT STDMETHODCALLTYPE QWindowsUiaTableProvider::GetRowHeaders(SAFEARRAY **pRetVal)
32{
33 qCDebug(lcQpaUiAutomation) << __FUNCTION__;
34
35 if (!pRetVal)
36 return E_INVALIDARG;
37 *pRetVal = nullptr;
38
39 QAccessibleInterface *accessible = accessibleInterface();
40 if (!accessible)
41 return UIA_E_ELEMENTNOTAVAILABLE;
42
43 QAccessibleTableInterface *tableInterface = accessible->tableInterface();
44 if (!tableInterface)
45 return UIA_E_ELEMENTNOTAVAILABLE;
46
47 QList<QAccessibleInterface *> headers;
48
49 for (int i = 0; i < tableInterface->rowCount(); ++i) {
50 if (QAccessibleInterface *cell = tableInterface->cellAt(i, 0)) {
51 if (QAccessibleTableCellInterface *tableCellInterface = cell->tableCellInterface()) {
52 headers.append(tableCellInterface->rowHeaderCells());
53 }
54 }
55 }
56 if ((*pRetVal = SafeArrayCreateVector(VT_UNKNOWN, 0, headers.size()))) {
57 for (LONG i = 0; i < headers.size(); ++i) {
58 if (QWindowsUiaMainProvider *headerProvider = QWindowsUiaMainProvider::providerForAccessible(headers.at(i))) {
59 SafeArrayPutElement(*pRetVal, &i, static_cast<IRawElementProviderSimple *>(headerProvider));
60 headerProvider->Release();
61 }
62 }
63 }
64 return S_OK;
65}
66
67// Gets the providers for all the column headers in the table.
68HRESULT STDMETHODCALLTYPE QWindowsUiaTableProvider::GetColumnHeaders(SAFEARRAY **pRetVal)
69{
70 qCDebug(lcQpaUiAutomation) << __FUNCTION__;
71
72 if (!pRetVal)
73 return E_INVALIDARG;
74 *pRetVal = nullptr;
75
76 QAccessibleInterface *accessible = accessibleInterface();
77 if (!accessible)
78 return UIA_E_ELEMENTNOTAVAILABLE;
79
80 QAccessibleTableInterface *tableInterface = accessible->tableInterface();
81 if (!tableInterface)
82 return UIA_E_ELEMENTNOTAVAILABLE;
83
84 QList<QAccessibleInterface *> headers;
85
86 for (int i = 0; i < tableInterface->columnCount(); ++i) {
87 if (QAccessibleInterface *cell = tableInterface->cellAt(0, i)) {
88 if (QAccessibleTableCellInterface *tableCellInterface = cell->tableCellInterface()) {
89 headers.append(tableCellInterface->columnHeaderCells());
90 }
91 }
92 }
93 if ((*pRetVal = SafeArrayCreateVector(VT_UNKNOWN, 0, headers.size()))) {
94 for (LONG i = 0; i < headers.size(); ++i) {
95 if (QWindowsUiaMainProvider *headerProvider = QWindowsUiaMainProvider::providerForAccessible(headers.at(i))) {
96 SafeArrayPutElement(*pRetVal, &i, static_cast<IRawElementProviderSimple *>(headerProvider));
97 headerProvider->Release();
98 }
99 }
100 }
101 return S_OK;
102}
103
104// Returns the primary direction of traversal for the table.
105HRESULT STDMETHODCALLTYPE QWindowsUiaTableProvider::get_RowOrColumnMajor(enum RowOrColumnMajor *pRetVal)
106{
107 qCDebug(lcQpaUiAutomation) << __FUNCTION__;
108
109 if (!pRetVal)
110 return E_INVALIDARG;
111 *pRetVal = RowOrColumnMajor_Indeterminate;
112 return S_OK;
113}
114
116
117#endif // QT_CONFIG(accessibility)
Combined button and popup list for selecting options.
#define qCDebug(category,...)
GLenum GLuint id
[7]
long HRESULT