summaryrefslogtreecommitdiffstats
path: root/src/gui/accessible/qaccessiblecache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/accessible/qaccessiblecache.cpp')
-rw-r--r--src/gui/accessible/qaccessiblecache.cpp58
1 files changed, 12 insertions, 46 deletions
diff --git a/src/gui/accessible/qaccessiblecache.cpp b/src/gui/accessible/qaccessiblecache.cpp
index 84d0936386..b41a2481f9 100644
--- a/src/gui/accessible/qaccessiblecache.cpp
+++ b/src/gui/accessible/qaccessiblecache.cpp
@@ -1,47 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qaccessiblecache_p.h"
#include <QtCore/qdebug.h>
#include <QtCore/qloggingcategory.h>
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
QT_BEGIN_NAMESPACE
@@ -84,18 +48,18 @@ QAccessibleCache *QAccessibleCache::instance()
QAccessible::Id QAccessibleCache::acquireId() const
{
static const QAccessible::Id FirstId = QAccessible::Id(INT_MAX) + 1;
- static QAccessible::Id lastUsedId = FirstId;
+ static QAccessible::Id nextId = FirstId;
- while (idToInterface.contains(lastUsedId)) {
+ while (idToInterface.contains(nextId)) {
// (wrap back when when we reach UINT_MAX - 1)
// -1 because on Android -1 is taken for the "View" so just avoid it completely for consistency
- if (lastUsedId == UINT_MAX - 1)
- lastUsedId = FirstId;
+ if (nextId == UINT_MAX - 1)
+ nextId = FirstId;
else
- ++lastUsedId;
+ ++nextId;
}
- return lastUsedId;
+ return nextId++;
}
QAccessibleInterface *QAccessibleCache::interfaceForId(QAccessible::Id id) const
@@ -166,7 +130,7 @@ void QAccessibleCache::objectDestroyed(QObject* obj)
/*
In some cases we might add a not fully-constructed object to the cache. This might happen with
for instance QWidget subclasses that are in the construction phase. If updateAccessibility() is
- called in the constructor of QWidget (directly or indirectly), it it will end up asking for the
+ called in the constructor of QWidget (directly or indirectly), it will end up asking for the
classname of that widget in order to know which accessibility interface subclass the
accessibility factory should instantiate and return. However, since that requires a virtual
call to metaObject(), it will return the metaObject() of QWidget (not for the subclass), and so
@@ -215,4 +179,6 @@ void QAccessibleCache::deleteInterface(QAccessible::Id id, QObject *obj)
QT_END_NAMESPACE
+#include "moc_qaccessiblecache_p.cpp"
+
#endif