diff options
Diffstat (limited to 'src/plugins/accessible/widgets')
-rw-r--r-- | src/plugins/accessible/widgets/complexwidgets.cpp | 6 | ||||
-rw-r--r-- | src/plugins/accessible/widgets/qaccessiblewidgets.cpp | 17 | ||||
-rw-r--r-- | src/plugins/accessible/widgets/simplewidgets.cpp | 33 |
3 files changed, 35 insertions, 21 deletions
diff --git a/src/plugins/accessible/widgets/complexwidgets.cpp b/src/plugins/accessible/widgets/complexwidgets.cpp index e638413..85be0b0 100644 --- a/src/plugins/accessible/widgets/complexwidgets.cpp +++ b/src/plugins/accessible/widgets/complexwidgets.cpp @@ -971,7 +971,11 @@ QString QAccessibleItemView::text(Text t, int child) const return QAccessibleAbstractScrollArea::text(t, child); QAccessibleItemRow item(itemView(), childIndex(child)); - return item.text(t, 1); + if (item.isValid()) { + return item.text(t, 1); + } else { + return QString(); + } } else { return QAccessibleAbstractScrollArea::text(t, child); } diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp index 09b5015..4402932 100644 --- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp +++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp @@ -401,9 +401,14 @@ int QAccessibleStackedWidget::childCount() const int QAccessibleStackedWidget::indexOfChild(const QAccessibleInterface *child) const { - if (!child || (stackedWidget()->currentWidget() != child->object())) + if (!child) return -1; - return 1; + + QWidget* widget = qobject_cast<QWidget*>(child->object()); + int index = stackedWidget()->indexOf(widget); + if (index >= 0) // one based counting of children + return index + 1; + return -1; } int QAccessibleStackedWidget::navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const @@ -413,9 +418,9 @@ int QAccessibleStackedWidget::navigate(RelationFlag relation, int entry, QAccess QObject *targetObject = 0; switch (relation) { case Child: - if (entry != 1) + if (entry < 1 || entry > stackedWidget()->count()) return -1; - targetObject = stackedWidget()->currentWidget(); + targetObject = stackedWidget()->widget(entry-1); break; default: return QAccessibleWidgetEx::navigate(relation, entry, target); @@ -1334,7 +1339,7 @@ QRect QAccessibleTextEdit::characterRect(int offset, CoordinateType coordType) QRect r = edit->cursorRect(cursor); if (cursor.movePosition(QTextCursor::NextCharacter)) { - r.setWidth(edit->cursorRect(cursor).y() - r.y()); + r.setWidth(edit->cursorRect(cursor).x() - r.x()); } else { // we don't know the width of the character - maybe because we're at document end // in that case, IAccessible2 tells us to return the width of a default character @@ -1603,7 +1608,7 @@ void QAccessibleTextEdit::setAttributes(int startOffset, int endOffset, const QS #ifndef QT_NO_MAINWINDOW QAccessibleMainWindow::QAccessibleMainWindow(QWidget *widget) - : QAccessibleWidgetEx(widget, Application) { } + : QAccessibleWidgetEx(widget, Window) { } QVariant QAccessibleMainWindow::invokeMethodEx(QAccessible::Method /*method*/, int /*child*/, const QVariantList & /*params*/) { diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index 21d2d67..aa64630 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -131,7 +131,7 @@ QString QAccessibleButton::actionText(int action, Text text, int child) const /*! \reimp */ bool QAccessibleButton::doAction(int action, int child, const QVariantList ¶ms) { - if (child || !widget()->isEnabled() || !widget()->isVisible()) + if (child || !widget()->isEnabled()) return false; switch (action) { @@ -155,9 +155,6 @@ bool QAccessibleButton::doAction(int action, int child, const QVariantList ¶ QString QAccessibleButton::text(Text t, int child) const { QString str; - if (!widget()->isVisible()) - return str; - switch (t) { case Accelerator: { @@ -227,6 +224,9 @@ QString QAccessibleButton::description(int actionIndex) { switch (actionIndex) { case 0: + if (button()->isCheckable()) { + return QLatin1String("Toggles the button."); + } return QLatin1String("Clicks the button."); default: return QString(); @@ -237,6 +237,13 @@ QString QAccessibleButton::name(int actionIndex) { switch (actionIndex) { case 0: + if (button()->isCheckable()) { + if (button()->isChecked()) { + return QLatin1String("Uncheck"); + } else { + return QLatin1String("Check"); + } + } return QLatin1String("Press"); default: return QString(); @@ -247,6 +254,13 @@ QString QAccessibleButton::localizedName(int actionIndex) { switch (actionIndex) { case 0: + if (button()->isCheckable()) { + if (button()->isChecked()) { + return tr("Uncheck"); + } else { + return tr("Check"); + } + } return tr("Press"); default: return QString(); @@ -380,9 +394,6 @@ QRect QAccessibleToolButton::rect(int child) const QString QAccessibleToolButton::text(Text t, int child) const { QString str; - if (!toolButton()->isVisible()) - return str; - switch (t) { case Name: str = toolButton()->text(); @@ -454,7 +465,7 @@ QString QAccessibleToolButton::actionText(int action, Text text, int child) cons */ bool QAccessibleToolButton::doAction(int action, int child, const QVariantList ¶ms) { - if (!widget()->isEnabled() || !widget()->isVisible()) + if (!widget()->isEnabled()) return false; if (action == 1 || child == ButtonDropMenu) { if(!child) @@ -513,8 +524,6 @@ QAccessible::Role QAccessibleDisplay::role(int child) const QString QAccessibleDisplay::text(Text t, int child) const { QString str; - if (!widget()->isVisible()) - return str; switch (t) { case Name: str = widget()->accessibleName(); @@ -674,8 +683,6 @@ QLineEdit *QAccessibleLineEdit::lineEdit() const QString QAccessibleLineEdit::text(Text t, int child) const { QString str; - if (!lineEdit()->isVisible()) - return str; switch (t) { case Value: if (lineEdit()->echoMode() == QLineEdit::Normal) @@ -692,8 +699,6 @@ QString QAccessibleLineEdit::text(Text t, int child) const /*! \reimp */ void QAccessibleLineEdit::setText(Text t, int control, const QString &text) { - if (!lineEdit()->isVisible()) - return; if (t != Value || control) { QAccessibleWidgetEx::setText(t, control, text); return; |