summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-02-11 08:24:34 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-02-11 08:25:04 +0100
commitd456f87ece0323982b7601047712545ab95426ad (patch)
tree46b90468b01144615f280620d73763fc189d25ac /src/plugins/platforms/cocoa/qcocoaaccessibility.mm
parentcc2938b5b6aa07210b04bd48ad8a2830701a06e5 (diff)
parent4fc070a4192d5b914b6f814a8dcab3f552d9abac (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts: src/corelib/io/qfilesystemwatcher_win.cpp src/corelib/plugin/plugin.pri src/plugins/platforms/cocoa/qcocoaaccessibility.mm tests/auto/corelib/tools/qlocale/tst_qlocale.cpp Change-Id: Id6824631252609a75eff8b68792e4d10095c8fc1
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaaccessibility.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibility.mm29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
index 49cf9968cc..7028b4d9ec 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
@@ -41,6 +41,8 @@
#include <QtGui/qaccessible.h>
#include <private/qcore_mac_p.h>
+#include <Carbon/Carbon.h>
+
QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
@@ -201,6 +203,8 @@ NSString *macSubrole(QAccessibleInterface *interface)
QAccessible::State s = interface->state();
if (s.searchEdit)
return NSAccessibilitySearchFieldSubrole;
+ if (s.passwordEdit)
+ return NSAccessibilitySecureTextFieldSubrole;
return nil;
}
@@ -359,18 +363,23 @@ id getValueAttribute(QAccessibleInterface *interface)
}
if (qtrole == QAccessible::EditableText) {
if (QAccessibleTextInterface *textInterface = interface->textInterface()) {
- // VoiceOver will read out the entire text string at once when returning
- // text as a value. For large text edits the size of the returned string
- // needs to be limited and text range attributes need to be used instead.
- // NSTextEdit returns the first sentence as the value, Do the same here:
+
int begin = 0;
int end = textInterface->characterCount();
- // ### call to textAfterOffset hangs. Booo!
- //if (textInterface->characterCount() > 0)
- // textInterface->textAfterOffset(0, QAccessible2::SentenceBoundary, &begin, &end);
-
- QString text = textInterface->text(begin, end);
- //qDebug() << "text" << begin << end << text;
+ QString text;
+ if (interface->state().passwordEdit) {
+ // return round password replacement chars
+ text = QString(end, QChar(kBulletUnicode));
+ } else {
+ // VoiceOver will read out the entire text string at once when returning
+ // text as a value. For large text edits the size of the returned string
+ // needs to be limited and text range attributes need to be used instead.
+ // NSTextEdit returns the first sentence as the value, Do the same here:
+ // ### call to textAfterOffset hangs. Booo!
+ //if (textInterface->characterCount() > 0)
+ // textInterface->textAfterOffset(0, QAccessible2::SentenceBoundary, &begin, &end);
+ text = textInterface->text(begin, end);
+ }
return QCFString::toNSString(text);
}
}