diff options
Diffstat (limited to 'src/gui/accessible/qaccessiblecache.cpp')
-rw-r--r-- | src/gui/accessible/qaccessiblecache.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/gui/accessible/qaccessiblecache.cpp b/src/gui/accessible/qaccessiblecache.cpp index 487d79a1f5..b41a2481f9 100644 --- a/src/gui/accessible/qaccessiblecache.cpp +++ b/src/gui/accessible/qaccessiblecache.cpp @@ -5,7 +5,7 @@ #include <QtCore/qdebug.h> #include <QtCore/qloggingcategory.h> -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) QT_BEGIN_NAMESPACE @@ -48,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 @@ -130,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 |