Accessibility: Improve handling current value

Value interfaces on OS X and iOS can be strings, so can the value
property of MSAA. Before we'd always only send doubles, instead
change it to use strings as well.

Change-Id: I1b4410c68238ba7a69a5507d87c251f2ac61c568
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
This commit is contained in:
Frederik Gladhorn 2014-06-27 15:07:21 +02:00
parent 3e91d06a39
commit 4f9427977c
3 changed files with 3 additions and 11 deletions

View File

@ -343,7 +343,7 @@ id getValueAttribute(QAccessibleInterface *interface)
} }
if (QAccessibleValueInterface *valueInterface = interface->valueInterface()) { if (QAccessibleValueInterface *valueInterface = interface->valueInterface()) {
return QCFString::toNSString(QString::number(valueInterface->currentValue().toDouble())); return QCFString::toNSString(valueInterface->currentValue().toString());
} }
if (interface->state().checkable) { if (interface->state().checkable) {

View File

@ -1039,7 +1039,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accValue(VARIANT varID, BS
QString value; QString value;
if (accessible->valueInterface()) { if (accessible->valueInterface()) {
value = QString::number(accessible->valueInterface()->currentValue().toDouble()); value = accessible->valueInterface()->currentValue().toString();
} else { } else {
value = accessible->text(QAccessible::Value); value = accessible->text(QAccessible::Value);
} }

View File

@ -89,15 +89,7 @@ void *QAccessibleAbstractSpinBox::interface_cast(QAccessible::InterfaceType t)
QVariant QAccessibleAbstractSpinBox::currentValue() const QVariant QAccessibleAbstractSpinBox::currentValue() const
{ {
QVariant result = abstractSpinBox()->property("value"); return abstractSpinBox()->property("value");
QVariant::Type type = result.type();
// IA2 only allows numeric types
if (type == QVariant::Int || type == QVariant::UInt || type == QVariant::LongLong
|| type == QVariant::ULongLong || type == QVariant::Double)
return result;
return QVariant();
} }
void QAccessibleAbstractSpinBox::setCurrentValue(const QVariant &value) void QAccessibleAbstractSpinBox::setCurrentValue(const QVariant &value)