Use name for combobox on Unix.
authorFrederik Gladhorn <frederik.gladhorn@nokia.com>
Thu, 30 Jun 2011 15:31:36 +0000 (17:31 +0200)
committerQt by Nokia <qt-info@nokia.com>
Thu, 18 Aug 2011 18:12:15 +0000 (20:12 +0200)
This is more conforming to the AT-SPI specs.
Also we have working relations for the label when a buddy is set.

Reviewed-by: Gabi
(cherry picked from commit 8be3168aa2f300f9a93a53b417704f3f10b1dc8b)

Change-Id: I1831d5063b003df2d209aba99d54558b6493a3e9
Reviewed-on: http://codereview.qt.nokia.com/3027
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
src/gui/widgets/qcombobox.cpp
src/plugins/accessible/widgets/complexwidgets.cpp

index bf6730e..6502272 100644 (file)
@@ -80,6 +80,9 @@
 #if defined(Q_WS_S60)
 #include "private/qt_s60_p.h"
 #endif
+#ifndef QT_NO_ACCESSIBILITY
+#include "qaccessible.h"
+#endif
 
 QT_BEGIN_NAMESPACE
 
@@ -1018,6 +1021,9 @@ void QComboBoxPrivate::_q_dataChanged(const QModelIndex &topLeft, const QModelIn
         }
         q->update();
     }
+#ifndef QT_NO_ACCESSIBILITY
+        QAccessible::updateAccessibility(q, 0, QAccessible::NameChanged);
+#endif
 }
 
 void QComboBoxPrivate::_q_rowsInserted(const QModelIndex &parent, int start, int end)
@@ -1271,6 +1277,9 @@ void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index)
     Q_Q(QComboBox);
     emit q->currentIndexChanged(index.row());
     emit q->currentIndexChanged(itemText(index));
+#ifndef QT_NO_ACCESSIBILITY
+        QAccessible::updateAccessibility(q, 0, QAccessible::NameChanged);
+#endif
 }
 
 QString QComboBoxPrivate::itemText(const QModelIndex &index) const
@@ -2635,6 +2644,9 @@ void QComboBox::clear()
 {
     Q_D(QComboBox);
     d->model->removeRows(0, d->model->rowCount(d->root), d->root);
+#ifndef QT_NO_ACCESSIBILITY
+        QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
+#endif
 }
 
 /*!
@@ -2651,6 +2663,9 @@ void QComboBox::clearEditText()
     Q_D(QComboBox);
     if (d->lineEdit)
         d->lineEdit->clear();
+#ifndef QT_NO_ACCESSIBILITY
+        QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
+#endif
 }
 
 /*!
@@ -2661,6 +2676,9 @@ void QComboBox::setEditText(const QString &text)
     Q_D(QComboBox);
     if (d->lineEdit)
         d->lineEdit->setText(text);
+#ifndef QT_NO_ACCESSIBILITY
+        QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
+#endif
 }
 
 /*!
index 8843d3e..563d3b9 100644 (file)
@@ -1776,16 +1776,12 @@ QString QAccessibleComboBox::text(Text t, int child) const
 
     switch (t) {
     case Name:
+#ifndef Q_WS_X11 // on Linux we use relations for this, name is text (fall through to Value)
         if (child == OpenList)
             str = QComboBox::tr("Open");
         else
             str = QAccessibleWidgetEx::text(t, 0);
         break;
-#ifndef QT_NO_SHORTCUT
-    case Accelerator:
-        if (child == OpenList)
-            str = (QString)QKeySequence(Qt::Key_Down);
-        // missing break?
 #endif
     case Value:
         if (comboBox()->isEditable())
@@ -1793,6 +1789,12 @@ QString QAccessibleComboBox::text(Text t, int child) const
         else
             str = comboBox()->currentText();
         break;
+#ifndef QT_NO_SHORTCUT
+    case Accelerator:
+        if (child == OpenList)
+            str = (QString)QKeySequence(Qt::Key_Down);
+        break;
+#endif
     default:
         break;
     }