Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwindowsuiaprovidercache.h
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#ifndef QWINDOWSUIAPROVIDERCACHE_H
5#define QWINDOWSUIAPROVIDERCACHE_H
6
7#include <QtGui/qtguiglobal.h>
8#if QT_CONFIG(accessibility)
9
10#include "qwindowsuiamainprovider.h"
11
12#include <QtCore/qhash.h>
13#include <QtCore/qmutex.h>
14#include <QtGui/qaccessible.h>
15#include <QtCore/private/qcomptr_p.h>
16
17QT_BEGIN_NAMESPACE
18
19// Singleton used to cache provider instances using the accessibility ID as the key.
20class QWindowsUiaProviderCache : public QObject
21{
22 QWindowsUiaProviderCache();
23 Q_OBJECT
24public:
25 static QWindowsUiaProviderCache *instance();
26 ComPtr<QWindowsUiaMainProvider> providerForId(QAccessible::Id id) const;
27 void insert(QAccessible::Id id, QWindowsUiaMainProvider *provider);
28
29private Q_SLOTS:
30 void remove(QObject *obj);
31
32private:
33 mutable QMutex m_tableMutex; // TODO: Can tables be accessed concurrently?
34 QHash<QAccessible::Id, QWindowsUiaMainProvider *> m_providerTable;
35 QHash<QObject *, QAccessible::Id> m_inverseTable;
36};
37
38QT_END_NAMESPACE
39
40#endif // QT_CONFIG(accessibility)
41
42#endif // QWINDOWSUIAPROVIDERCACHE_H