diff options
Diffstat (limited to 'src/gui/accessible/qaccessible.cpp')
-rw-r--r-- | src/gui/accessible/qaccessible.cpp | 105 |
1 files changed, 85 insertions, 20 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index a7053aa3da..7abe40d30c 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -455,14 +455,13 @@ QT_BEGIN_NAMESPACE Synonym for unsigned, used by the QAccessibleInterface cache. */ +#ifndef QT_NO_ACCESSIBILITY /* accessible widgets plugin discovery stuff */ -#ifndef QT_NO_ACCESSIBILITY #ifndef QT_NO_LIBRARY Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QAccessibleFactoryInterface_iid, QLatin1String("/accessible"))) #endif -#endif // FIXME turn this into one global static struct Q_GLOBAL_STATIC(QList<QAccessible::InterfaceFactory>, qAccessibleFactories) @@ -475,13 +474,11 @@ QAccessible::RootObjectHandler QAccessible::rootObjectHandler = 0; static bool cleanupAdded = false; -#ifndef QT_NO_ACCESSIBILITY static QPlatformAccessibility *platformAccessibility() { QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration(); return pfIntegration ? pfIntegration->accessibility() : 0; } -#endif /*! \fn QAccessible::QAccessible() @@ -497,10 +494,8 @@ static QPlatformAccessibility *platformAccessibility() */ void QAccessible::cleanup() { -#ifndef QT_NO_ACCESSIBILITY if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) pfAccessibility->cleanup(); -#endif } static void qAccessibleCleanup() @@ -684,7 +679,6 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object) return iface; } } -#ifndef QT_NO_ACCESSIBILITY #ifndef QT_NO_LIBRARY // Find a QAccessiblePlugin (factory) for the class name. If there's // no entry in the cache try to create it using the plugin loader. @@ -708,18 +702,15 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object) return result; } #endif -#endif mo = mo->superClass(); } -#ifndef QT_NO_ACCESSIBILITY if (object == qApp) { QAccessibleInterface *appInterface = new QAccessibleApplication; QAccessibleCache::instance()->insert(object, appInterface); Q_ASSERT(QAccessibleCache::instance()->objectToId.contains(qApp)); return appInterface; } -#endif return 0; } @@ -789,10 +780,8 @@ QAccessibleInterface *QAccessible::accessibleInterface(Id id) */ bool QAccessible::isActive() { -#ifndef QT_NO_ACCESSIBILITY if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) return pfAccessibility->isActive(); -#endif return false; } @@ -827,10 +816,8 @@ void QAccessible::setRootObject(QObject *object) return; } -#ifndef QT_NO_ACCESSIBILITY if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) pfAccessibility->setRootObject(object); -#endif } /*! @@ -863,7 +850,6 @@ void QAccessible::updateAccessibility(QAccessibleEvent *event) if (!isActive() || !event->accessibleInterface()) return; -#ifndef QT_NO_ACCESSIBILITY if (event->type() == QAccessible::TableModelChanged) { QAccessibleInterface *iface = event->accessibleInterface(); if (iface && iface->tableInterface()) @@ -877,7 +863,6 @@ void QAccessible::updateAccessibility(QAccessibleEvent *event) if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) pfAccessibility->notifyAccessibilityUpdate(event); -#endif } #if QT_DEPRECATED_SINCE(5, 0) @@ -1824,7 +1809,7 @@ QDebug operator<<(QDebug d, const QAccessibleEvent &ev) d.nospace() << ")"; return d.space(); } - +#endif // QT_NO_DEBUGSTREAM /*! \class QAccessibleTextInterface @@ -2626,7 +2611,14 @@ struct QAccessibleActionStrings decreaseAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Decrease"))), showMenuAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "ShowMenu"))), setFocusAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "SetFocus"))), - toggleAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Toggle"))) {} + toggleAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Toggle"))), + scrollLeftAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Scroll Left"))), + scrollRightAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Scroll Right"))), + scrollUpAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Scroll Up"))), + scrollDownAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Scroll Down"))), + previousPageAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Previous Page"))), + nextPageAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Next Page"))) + {} const QString pressAction; const QString increaseAction; @@ -2634,6 +2626,12 @@ struct QAccessibleActionStrings const QString showMenuAction; const QString setFocusAction; const QString toggleAction; + const QString scrollLeftAction; + const QString scrollRightAction; + const QString scrollUpAction; + const QString scrollDownAction; + const QString previousPageAction; + const QString nextPageAction; QString localizedDescription(const QString &actionName) { @@ -2649,6 +2647,20 @@ struct QAccessibleActionStrings return QAccessibleActionInterface::tr("Sets the focus"); else if (actionName == toggleAction) return QAccessibleActionInterface::tr("Toggles the state"); + else if (actionName == scrollLeftAction) + return QAccessibleActionInterface::tr("Scrolls to the left"); + else if (actionName == scrollRightAction) + return QAccessibleActionInterface::tr("Scrolls to the right"); + else if (actionName == scrollUpAction) + return QAccessibleActionInterface::tr("Scrolls up"); + else if (actionName == scrollDownAction) + return QAccessibleActionInterface::tr("Scrolls down"); + else if (actionName == previousPageAction) + return QAccessibleActionInterface::tr("Goes back a page"); + else if (actionName == nextPageAction) + return QAccessibleActionInterface::tr("Goes to the next page"); + + return QString(); } }; @@ -2719,14 +2731,67 @@ const QString &QAccessibleActionInterface::toggleAction() return accessibleActionStrings()->toggleAction; } +/*! + Returns the name of the scroll left default action. + \sa actionNames(), localizedActionName() + */ +const QString &QAccessibleActionInterface::scrollLeftAction() +{ + return accessibleActionStrings()->scrollLeftAction; +} + +/*! + Returns the name of the scroll right default action. + \sa actionNames(), localizedActionName() + */ +const QString &QAccessibleActionInterface::scrollRightAction() +{ + return accessibleActionStrings()->scrollRightAction; +} + +/*! + Returns the name of the scroll up default action. + \sa actionNames(), localizedActionName() + */ +const QString &QAccessibleActionInterface::scrollUpAction() +{ + return accessibleActionStrings()->scrollUpAction; +} + +/*! + Returns the name of the scroll down default action. + \sa actionNames(), localizedActionName() + */ +const QString &QAccessibleActionInterface::scrollDownAction() +{ + return accessibleActionStrings()->scrollDownAction; +} + +/*! + Returns the name of the previous page default action. + \sa actionNames(), localizedActionName() + */ +const QString &QAccessibleActionInterface::previousPageAction() +{ + return accessibleActionStrings()->previousPageAction; +} + +/*! + Returns the name of the next page default action. + \sa actionNames(), localizedActionName() + */ +const QString &QAccessibleActionInterface::nextPageAction() +{ + return accessibleActionStrings()->nextPageAction; +} + /*! \internal */ QString qAccessibleLocalizedActionDescription(const QString &actionName) { return accessibleActionStrings()->localizedDescription(actionName); } - -#endif +#endif // QT_NO_ACCESSIBILITY QT_END_NAMESPACE |