summaryrefslogtreecommitdiffstats
path: root/src/gui/accessible
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/accessible')
-rw-r--r--src/gui/accessible/accessible.pri3
-rw-r--r--src/gui/accessible/qaccessible.cpp4
-rw-r--r--src/gui/accessible/qaccessible.h1
-rw-r--r--src/gui/accessible/qaccessible_mac.mm14
-rw-r--r--src/gui/accessible/qaccessible_mac_cocoa.mm194
-rw-r--r--src/gui/accessible/qaccessible_win.cpp46
-rw-r--r--src/gui/accessible/qaccessibleobject.cpp14
-rw-r--r--src/gui/accessible/qaccessiblewidget.cpp19
8 files changed, 230 insertions, 65 deletions
diff --git a/src/gui/accessible/accessible.pri b/src/gui/accessible/accessible.pri
index 76b6687..ad2fb4c 100644
--- a/src/gui/accessible/accessible.pri
+++ b/src/gui/accessible/accessible.pri
@@ -14,7 +14,8 @@ contains(QT_CONFIG, accessibility) {
mac:!embedded {
HEADERS += accessible/qaccessible_mac_p.h
- OBJECTIVE_SOURCES += accessible/qaccessible_mac.mm
+ OBJECTIVE_SOURCES += accessible/qaccessible_mac.mm \
+ accessible/qaccessible_mac_cocoa.mm
} else:win32 {
SOURCES += accessible/qaccessible_win.cpp
} else {
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index f911b72..30e1f46 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE
relating to accessibility.
\ingroup accessibility
- \mainclass
+
Accessible applications can be used by people who are not able to
use applications by conventional means.
@@ -394,7 +394,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QAccessibleFactoryInterface_iid, QLatin1String("/accessible")))
#endif
-Q_GLOBAL_STATIC(QList<QAccessible::InterfaceFactory>, qAccessibleFactories);
+Q_GLOBAL_STATIC(QList<QAccessible::InterfaceFactory>, qAccessibleFactories)
QAccessible::UpdateHandler QAccessible::updateHandler = 0;
QAccessible::RootObjectHandler QAccessible::rootObjectHandler = 0;
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index 75d5443..7c1793f 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -210,6 +210,7 @@ public:
PageTabList = 0x0000003C,
Clock = 0x0000003D,
Splitter = 0x0000003E,
+ // Additional Qt roles where enum value does not map directly to MSAA:
LayeredPane = 0x0000003F,
UserRole = 0x0000ffff
};
diff --git a/src/gui/accessible/qaccessible_mac.mm b/src/gui/accessible/qaccessible_mac.mm
index 3580e4e..31a20bf 100644
--- a/src/gui/accessible/qaccessible_mac.mm
+++ b/src/gui/accessible/qaccessible_mac.mm
@@ -1232,10 +1232,8 @@ static int textForRoleAndAttribute(QAccessible::Role role, CFStringRef attribute
return QAccessible::Value;
else if (CFStringCompare(attribute, CFStringRef(QAXHelpAttribute), 0) == kCFCompareEqualTo)
return QAccessible::Help;
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
else if (CFStringCompare(attribute, CFStringRef(QAXDescriptionAttribute), 0) == kCFCompareEqualTo)
return QAccessible::Description;
-#endif
else
return -1;
}
@@ -1442,17 +1440,13 @@ static OSStatus getAllAttributeNames(EventRef event, const QAInterface &interfac
qt_mac_append_cf_uniq(attrs, CFStringRef(QAXRoleAttribute));
qt_mac_append_cf_uniq(attrs, CFStringRef(QAXEnabledAttribute));
qt_mac_append_cf_uniq(attrs, CFStringRef(QAXWindowAttribute));
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
qt_mac_append_cf_uniq(attrs, CFStringRef(QAXTopLevelUIElementAttribute));
-#endif
// Append these names if the QInterafceItem returns any data for them.
appendIfSupported(attrs, CFStringRef(QAXTitleAttribute), interface);
appendIfSupported(attrs, CFStringRef(QAXValueAttribute), interface);
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
appendIfSupported(attrs, CFStringRef(QAXDescriptionAttribute), interface);
appendIfSupported(attrs, CFStringRef(QAXLinkedUIElementsAttribute), interface);
-#endif
appendIfSupported(attrs, CFStringRef(QAXHelpAttribute), interface);
appendIfSupported(attrs, CFStringRef(QAXTitleUIElementAttribute), interface);
appendIfSupported(attrs, CFStringRef(QAXChildrenAttribute), interface);
@@ -1705,12 +1699,10 @@ static OSStatus handleWindowAttribute(EventHandlerCallRef next_ref, EventRef eve
Returns the top-level window for an interface, which is the closest ancestor interface that
has the Window role. (Can also be a sheet or a drawer)
*/
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
static OSStatus handleTopLevelUIElementAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
{
return navigateAncestors<IsWindowTest>(next_ref, event, interface, CFStringRef(QAXTopLevelUIElementAttribute));
}
-#endif
/*
Returns the tab buttons for an interface.
@@ -1888,10 +1880,8 @@ static OSStatus getNamedAttribute(EventHandlerCallRef next_ref, EventRef event,
if (CFStringCompare(var, CFStringRef(QAXChildrenAttribute), 0) == kCFCompareEqualTo) {
return handleChildrenAttribute(next_ref, event, interface);
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
} else if(CFStringCompare(var, CFStringRef(QAXTopLevelUIElementAttribute), 0) == kCFCompareEqualTo) {
return handleTopLevelUIElementAttribute(next_ref, event, interface);
-#endif
} else if(CFStringCompare(var, CFStringRef(QAXWindowAttribute), 0) == kCFCompareEqualTo) {
return handleWindowAttribute(next_ref, event, interface);
} else if(CFStringCompare(var, CFStringRef(QAXParentAttribute), 0) == kCFCompareEqualTo) {
@@ -1981,7 +1971,7 @@ static OSStatus getNamedAttribute(EventHandlerCallRef next_ref, EventRef event,
} else if (CFStringCompare(var, CFStringRef(QAXSubroleAttribute), 0) == kCFCompareEqualTo) {
return handleSubroleAttribute(next_ref, event, interface);
} else if (CFStringCompare(var, CFStringRef(QAXRoleDescriptionAttribute), 0) == kCFCompareEqualTo) {
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) && !defined(QT_MAC_USE_COCOA)
+#if !defined(QT_MAC_USE_COCOA)
if (HICopyAccessibilityRoleDescription) {
const CFStringRef roleDescription = HICopyAccessibilityRoleDescription(macRole(interface), 0);
SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFStringRef,
@@ -2005,14 +1995,12 @@ static OSStatus getNamedAttribute(EventHandlerCallRef next_ref, EventRef event,
} else {
handleStringAttribute(event, text, interface);
}
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
} else if (CFStringCompare(var, CFStringRef(QAXDescriptionAttribute), 0) == kCFCompareEqualTo) {
const QAccessible::Role role = interface.role();
const QAccessible::Text text = (QAccessible::Text)textForRoleAndAttribute(role, var);
handleStringAttribute(event, text, interface);
} else if (CFStringCompare(var, CFStringRef(QAXLinkedUIElementsAttribute), 0) == kCFCompareEqualTo) {
return CallNextEventHandler(next_ref, event);
-#endif
} else if (CFStringCompare(var, CFStringRef(QAXHelpAttribute), 0) == kCFCompareEqualTo) {
const QAccessible::Role role = interface.role();
const QAccessible::Text text = (QAccessible::Text)textForRoleAndAttribute(role, var);
diff --git a/src/gui/accessible/qaccessible_mac_cocoa.mm b/src/gui/accessible/qaccessible_mac_cocoa.mm
index c41b1a8..9a50036 100644
--- a/src/gui/accessible/qaccessible_mac_cocoa.mm
+++ b/src/gui/accessible/qaccessible_mac_cocoa.mm
@@ -39,3 +39,197 @@
**
****************************************************************************/
+
+#include "qaccessible.h"
+#include "qaccessible_mac_p.h"
+#include "qdebug.h"
+#include "qtabwidget.h"
+
+#include <private/qt_mac_p.h>
+#include <private/qcocoaview_mac_p.h>
+#include <private/qwidget_p.h>
+
+
+#ifndef QT_NO_ACCESSIBILITY
+
+#ifdef QT_MAC_USE_COCOA
+
+QT_BEGIN_NAMESPACE
+
+//#define MAC_ACCESSIBILTY_DEVELOPER_MODE
+
+#ifdef MAC_ACCESSIBILTY_DEVELOPER_MODE
+#define MAC_ACCESSIBILTY_DEBUG QT_PREPEND_NAMESPACE(qDebug)
+#else
+#define MAC_ACCESSIBILTY_DEBUG if (0) QT_PREPEND_NAMESPACE(qDebug)
+#endif
+
+typedef QMap<QAccessible::Role, NSString *> QMacAccessibiltyRoleMap;
+Q_GLOBAL_STATIC(QMacAccessibiltyRoleMap, qMacAccessibiltyRoleMap);
+
+static QAInterface interfaceForView(QT_MANGLE_NAMESPACE(QCocoaView) *view)
+{
+ return QAInterface(QAccessible::queryAccessibleInterface([view qt_qwidget]));
+}
+
+/*
+ Set up mappings from Qt accessibilty roles to Mac accessibilty roles.
+*/
+static void populateRoleMap()
+{
+ QMacAccessibiltyRoleMap &roleMap = *qMacAccessibiltyRoleMap();
+ roleMap[QAccessible::MenuItem] = NSAccessibilityMenuItemRole;
+ roleMap[QAccessible::MenuBar] = NSAccessibilityMenuBarRole;
+ roleMap[QAccessible::ScrollBar] = NSAccessibilityScrollBarRole;
+ roleMap[QAccessible::Grip] = NSAccessibilityGrowAreaRole;
+ roleMap[QAccessible::Window] = NSAccessibilityWindowRole;
+ roleMap[QAccessible::Dialog] = NSAccessibilityWindowRole;
+ roleMap[QAccessible::AlertMessage] = NSAccessibilityWindowRole;
+ roleMap[QAccessible::ToolTip] = NSAccessibilityWindowRole;
+ roleMap[QAccessible::HelpBalloon] = NSAccessibilityWindowRole;
+ roleMap[QAccessible::PopupMenu] = NSAccessibilityMenuRole;
+ roleMap[QAccessible::Application] = NSAccessibilityApplicationRole;
+ roleMap[QAccessible::Pane] = NSAccessibilityGroupRole;
+ roleMap[QAccessible::Grouping] = NSAccessibilityGroupRole;
+ roleMap[QAccessible::Separator] = NSAccessibilitySplitterRole;
+ roleMap[QAccessible::ToolBar] = NSAccessibilityToolbarRole;
+ roleMap[QAccessible::PageTab] = NSAccessibilityRadioButtonRole;
+ roleMap[QAccessible::ButtonMenu] = NSAccessibilityMenuButtonRole;
+ roleMap[QAccessible::ButtonDropDown] = NSAccessibilityPopUpButtonRole;
+ roleMap[QAccessible::SpinBox] = NSAccessibilityIncrementorRole;
+ roleMap[QAccessible::Slider] = NSAccessibilitySliderRole;
+ roleMap[QAccessible::ProgressBar] = NSAccessibilityProgressIndicatorRole;
+ roleMap[QAccessible::ComboBox] = NSAccessibilityPopUpButtonRole;
+ roleMap[QAccessible::RadioButton] = NSAccessibilityRadioButtonRole;
+ roleMap[QAccessible::CheckBox] = NSAccessibilityCheckBoxRole;
+ roleMap[QAccessible::StaticText] = NSAccessibilityStaticTextRole;
+ roleMap[QAccessible::Table] = NSAccessibilityTableRole;
+ roleMap[QAccessible::StatusBar] = NSAccessibilityStaticTextRole;
+ roleMap[QAccessible::Column] = NSAccessibilityColumnRole;
+ roleMap[QAccessible::ColumnHeader] = NSAccessibilityColumnRole;
+ roleMap[QAccessible::Row] = NSAccessibilityRowRole;
+ roleMap[QAccessible::RowHeader] = NSAccessibilityRowRole;
+ roleMap[QAccessible::Cell] = NSAccessibilityTextFieldRole;
+ roleMap[QAccessible::PushButton] = NSAccessibilityButtonRole;
+ roleMap[QAccessible::EditableText] = NSAccessibilityTextFieldRole;
+ roleMap[QAccessible::Link] = NSAccessibilityTextFieldRole;
+ roleMap[QAccessible::Indicator] = NSAccessibilityValueIndicatorRole;
+ roleMap[QAccessible::Splitter] = NSAccessibilitySplitGroupRole;
+ roleMap[QAccessible::List] = NSAccessibilityListRole;
+ roleMap[QAccessible::ListItem] = NSAccessibilityStaticTextRole;
+ roleMap[QAccessible::Cell] = NSAccessibilityStaticTextRole;
+}
+
+/*
+ Returns a Mac accessibility role for the given interface, or
+ NSAccessibilityUnknownRole if no role mapping is found.
+*/
+static NSString *macRoleForInterface(QAInterface interface)
+{
+ const QAccessible::Role qtRole = interface.role();
+ QMacAccessibiltyRoleMap &roleMap = *qMacAccessibiltyRoleMap();
+
+ if (roleMap.isEmpty())
+ populateRoleMap();
+
+ MAC_ACCESSIBILTY_DEBUG() << "role for" << interface.object() << "interface role" << hex << qtRole;
+
+ if (roleMap.contains(qtRole)) {
+ MAC_ACCESSIBILTY_DEBUG() << "return" << roleMap[qtRole];
+ return roleMap[qtRole];
+ }
+
+ MAC_ACCESSIBILTY_DEBUG() << "return NSAccessibilityUnknownRole";
+ return NSAccessibilityUnknownRole;
+}
+
+/*
+ Is the interface a QTabBar embedded in a QTabWidget?
+ (as opposed to a stand-alone tab bar)
+*/
+static bool isEmbeddedTabBar(const QAInterface &interface)
+{
+ QObject *object = interface.object();
+ if (interface.role() == QAccessible::PageTabList && object)
+ return (qobject_cast<QTabWidget *>(object->parent()));
+
+ return false;
+}
+
+static bool isInterfaceIgnored(QAInterface interface)
+{
+ // Mac accessibility does not have an attribute that corresponds to the
+ // Invisible/Offscreen state. Use the ignore facility to disable them.
+ const QAccessible::State state = interface.state();
+ if (state & QAccessible::Invisible ||
+ state & QAccessible::Offscreen )
+ return false;
+
+ // Hide QTabBars that has a QTabWidget parent (the QTabWidget handles the accessibility)
+ if (isEmbeddedTabBar(interface))
+ return false;
+
+ if (QObject * const object = interface.object()) {
+ const QString className = QLatin1String(object->metaObject()->className());
+
+ // Prevent VoiceOver from focusing on tool tips by ignoring those
+ // interfaces. Shifting VoiceOver focus to the tool tip is confusing
+ // and the contents of the tool tip is avalible through the description
+ // attribute anyway.
+ if (className == QLatin1String("QTipLabel"))
+ return false;
+ }
+
+ // Hide interfaces with an unknown role. When developing it's often useful to disable
+ // this check to see all interfaces in the hierarchy.
+#ifndef MAC_ACCESSIBILTY_DEVELOPER_MODE
+ return [macRoleForInterface(interface) isEqualToString: NSAccessibilityUnknownRole];
+#else
+ return NO;
+#endif
+}
+
+QT_END_NAMESPACE
+
+@implementation QT_MANGLE_NAMESPACE(QCocoaView) (Accessibility)
+
+- (BOOL)accessibilityIsIgnored
+{
+ QT_PREPEND_NAMESPACE(QAInterface) interface = QT_PREPEND_NAMESPACE(interfaceForView)(self);
+ return isInterfaceIgnored(interface);
+}
+
+- (NSArray *)accessibilityAttributeNames
+{
+ QT_PREPEND_NAMESPACE(QAInterface) interface = QT_PREPEND_NAMESPACE(interfaceForView)(self);
+
+ static NSArray *attributes = nil;
+ if (attributes == nil) {
+ attributes = [super accessibilityAttributeNames];
+
+ }
+ return attributes;
+}
+
+- (id)accessibilityAttributeValue:(NSString *)attribute
+{
+ MAC_ACCESSIBILTY_DEBUG() << "accessibilityAttributeValue" << self <<
+ QT_PREPEND_NAMESPACE(QCFString)::toQString(reinterpret_cast<CFStringRef>(attribute));
+
+ QT_PREPEND_NAMESPACE(QAInterface) interface = QT_PREPEND_NAMESPACE(interfaceForView)(self);
+
+ // Switch on the attribute name and call the appropriate handler function.
+ // Pass the call on to the NSView class for attributes we don't handle.
+ if ([attribute isEqualToString:@"AXRole"]) {
+ return macRoleForInterface(interface);
+ } else {
+ return [super accessibilityAttributeValue:attribute];
+ }
+}
+
+@end
+
+#endif // QT_MAC_USE_COCOA
+
+#endif // QT_NO_ACCESSIBILITY
+
diff --git a/src/gui/accessible/qaccessible_win.cpp b/src/gui/accessible/qaccessible_win.cpp
index f88f8cb..9e7cf35 100644
--- a/src/gui/accessible/qaccessible_win.cpp
+++ b/src/gui/accessible/qaccessible_win.cpp
@@ -50,7 +50,7 @@
#include <winuser.h>
#if !defined(WINABLEAPI)
-# if defined(Q_OS_WINCE)
+# if defined(Q_WS_WINCE)
# include <bldver.h>
# endif
# include <winable.h>
@@ -61,7 +61,7 @@
#include <comdef.h>
#endif
-#ifdef Q_OS_WINCE
+#ifdef Q_WS_WINCE
#include "qguifunctions_wince.h"
#endif
@@ -177,14 +177,14 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
return;
}
- QByteArray soundName;
+ QString soundName;
switch (reason) {
case PopupMenuStart:
- soundName = "MenuPopup";
+ soundName = QLatin1String("MenuPopup");
break;
case MenuCommand:
- soundName = "MenuCommand";
+ soundName = QLatin1String("MenuCommand");
break;
case Alert:
@@ -194,13 +194,13 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
if (mb) {
switch (mb->icon()) {
case QMessageBox::Warning:
- soundName = "SystemExclamation";
+ soundName = QLatin1String("SystemExclamation");
break;
case QMessageBox::Critical:
- soundName = "SystemHand";
+ soundName = QLatin1String("SystemHand");
break;
case QMessageBox::Information:
- soundName = "SystemAsterisk";
+ soundName = QLatin1String("SystemAsterisk");
break;
default:
break;
@@ -208,7 +208,7 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
} else
#endif // QT_NO_MESSAGEBOX
{
- soundName = "SystemAsterisk";
+ soundName = QLatin1String("SystemAsterisk");
}
}
@@ -219,27 +219,23 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
if (soundName.size()) {
#ifndef QT_NO_SETTINGS
- QSettings settings(QLatin1String("HKEY_CURRENT_USER\\AppEvents\\Schemes\\Apps\\.Default\\") +
- QString::fromLatin1(soundName.constData()), QSettings::NativeFormat);
+ QSettings settings(QLatin1String("HKEY_CURRENT_USER\\AppEvents\\Schemes\\Apps\\.Default\\") + soundName,
+ QSettings::NativeFormat);
QString file = settings.value(QLatin1String(".Current/.")).toString();
#else
- QString file;
+ QString file;
#endif
- if (!file.isEmpty()) {
- QT_WA({
- PlaySoundW(reinterpret_cast<const wchar_t *> (QString::fromLatin1(soundName).utf16()), 0, SND_ALIAS | SND_ASYNC | SND_NODEFAULT | SND_NOWAIT );
- } , {
- PlaySoundA(soundName.constData(), 0, SND_ALIAS | SND_ASYNC | SND_NODEFAULT | SND_NOWAIT );
- });
- }
- }
+ if (!file.isEmpty()) {
+ PlaySound(reinterpret_cast<const wchar_t *>(soundName.utf16()), 0, SND_ALIAS | SND_ASYNC | SND_NODEFAULT | SND_NOWAIT);
+ }
+ }
if (!isActive())
return;
typedef void (WINAPI *PtrNotifyWinEvent)(DWORD, HWND, LONG, LONG);
-#if defined(Q_OS_WINCE) // ### TODO: check for NotifyWinEvent in CE 6.0
+#if defined(Q_WS_WINCE) // ### TODO: check for NotifyWinEvent in CE 6.0
// There is no user32.lib nor NotifyWinEvent for CE
return;
#else
@@ -270,9 +266,9 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
if (!w) {
if (reason != QAccessible::ContextHelpStart &&
reason != QAccessible::ContextHelpEnd)
- w = qApp->focusWidget();
+ w = QApplication::focusWidget();
if (!w) {
- w = qApp->activeWindow();
+ w = QApplication::activeWindow();
if (!w)
return;
@@ -289,7 +285,7 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
if (reason != MenuCommand) { // MenuCommand is faked
ptrNotifyWinEvent(reason, w->winId(), OBJID_CLIENT, who);
}
-#endif // Q_OS_WINCE
+#endif // Q_WS_WINCE
}
void QAccessible::setRootObject(QObject *o)
@@ -1055,6 +1051,8 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accRole(VARIANT varID, VARIANT
Role role = accessible->role(varID.lVal);
if (role != NoRole) {
+ if (role == LayeredPane)
+ role = QAccessible::Pane;
(*pvarRole).vt = VT_I4;
(*pvarRole).lVal = role;
} else {
diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp
index 133b216..aa10d17 100644
--- a/src/gui/accessible/qaccessibleobject.cpp
+++ b/src/gui/accessible/qaccessibleobject.cpp
@@ -212,7 +212,7 @@ QAccessibleApplication::QAccessibleApplication()
static QWidgetList topLevelWidgets()
{
QWidgetList list;
- const QWidgetList tlw(qApp->topLevelWidgets());
+ const QWidgetList tlw(QApplication::topLevelWidgets());
for (int i = 0; i < tlw.count(); ++i) {
QWidget *w = tlw.at(i);
if (!(w->windowType() == Qt::Popup) && !(w->windowType() == Qt::Desktop))
@@ -308,7 +308,7 @@ int QAccessibleApplication::navigate(RelationFlag relation, int entry,
}
break;
case FocusChild:
- targetObject = qApp->activeWindow();
+ targetObject = QApplication::activeWindow();
break;
default:
break;
@@ -322,11 +322,11 @@ QString QAccessibleApplication::text(Text t, int) const
{
switch (t) {
case Name:
- if (qApp->activeWindow())
- return qApp->activeWindow()->windowTitle();
+ if (QApplication::activeWindow())
+ return QApplication::activeWindow()->windowTitle();
break;
case Description:
- return qApp->applicationFilePath();
+ return QApplication::applicationFilePath();
default:
break;
}
@@ -342,7 +342,7 @@ QAccessible::Role QAccessibleApplication::role(int) const
/*! \reimp */
QAccessible::State QAccessibleApplication::state(int) const
{
- return qApp->activeWindow() ? Focused : Normal;
+ return QApplication::activeWindow() ? Focused : Normal;
}
/*! \reimp */
@@ -356,7 +356,7 @@ bool QAccessibleApplication::doAction(int action, int child, const QVariantList
{
if (action == 0 || action == 1) {
QWidget *w = 0;
- w = qApp->activeWindow();
+ w = QApplication::activeWindow();
if (!w)
w = topLevelWidgets().at(0);
if (!w)
diff --git a/src/gui/accessible/qaccessiblewidget.cpp b/src/gui/accessible/qaccessiblewidget.cpp
index 064fd4d..a934f69 100644
--- a/src/gui/accessible/qaccessiblewidget.cpp
+++ b/src/gui/accessible/qaccessiblewidget.cpp
@@ -102,24 +102,7 @@ static QString buddyString(const QWidget *widget)
QString Q_GUI_EXPORT qt_accStripAmp(const QString &text)
{
- if (text.isEmpty())
- return text;
-
- const QChar *ch = text.unicode();
- int length = text.length();
- QString str;
- while (length > 0) {
- if (*ch == QLatin1Char('&')) {
- ++ch;
- --length;
- if (!ch)
- --ch;
- }
- str += *ch;
- ++ch;
- --length;
- }
- return str;
+ return QString(text).remove(QLatin1Char('&'));
}
QString Q_GUI_EXPORT qt_accHotKey(const QString &text)