diff options
Diffstat (limited to 'src/widgets/accessible')
| -rw-r--r-- | src/widgets/accessible/itemviews.cpp | 31 | ||||
| -rw-r--r-- | src/widgets/accessible/qaccessiblecolorwell.cpp | 5 |
2 files changed, 35 insertions, 1 deletions
diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp index cc3a230f9b4..ba941012dd7 100644 --- a/src/widgets/accessible/itemviews.cpp +++ b/src/widgets/accessible/itemviews.cpp @@ -99,6 +99,21 @@ QHeaderView *QAccessibleTable::verticalHeader() const return header; } +// Normally cellAt takes row/column in the range +// [0 .. rowCount()) +// [0 .. columnCount()) +// +// As an extension we allow clients to ask for headers +// +// * Has both vertical and horizontal headers: +// (-1,-1) -> corner button +// * Has column headers: +// (-1, column) -> column header for column \a column +// * has row headers +// (row, -1) -> row header for row \a row +// +// If asking for a header that does not exist, The invalid +// index warning is logged, and nullptr is returned. QAccessibleInterface *QAccessibleTable::cellAt(int row, int column) const { const QAbstractItemView *theView = view(); @@ -107,6 +122,22 @@ QAccessibleInterface *QAccessibleTable::cellAt(int row, int column) const return nullptr; Q_ASSERT(role() != QAccessible::List); Q_ASSERT(role() != QAccessible::Tree); + + const int vHeader = verticalHeader() ? 1 : 0; + const int hHeader = horizontalHeader() ? 1 : 0; + + const int doHHeader = ((row == -1) && hHeader); + const int doVHeader = ((column == -1) && vHeader); + + if (doVHeader && doHHeader) + return child(0); + + if (doVHeader) + return child((row + hHeader) * (columnCount() + vHeader) + (column + vHeader)); + + if (doHHeader) + return child((row + hHeader) * (columnCount() + vHeader) + (column + vHeader)); + QModelIndex index = theModel->index(row, column, theView->rootIndex()); if (Q_UNLIKELY(!index.isValid())) { qWarning() << "QAccessibleTable::cellAt: invalid index: " << index << " for " << theView; diff --git a/src/widgets/accessible/qaccessiblecolorwell.cpp b/src/widgets/accessible/qaccessiblecolorwell.cpp index ca08e511e9a..64fcd2a7fd1 100644 --- a/src/widgets/accessible/qaccessiblecolorwell.cpp +++ b/src/widgets/accessible/qaccessiblecolorwell.cpp @@ -3,6 +3,8 @@ #include "private/qaccessiblecolorwell_p.h" +#include <QtCore/qcoreapplication.h> + QT_REQUIRE_CONFIG(accessibility); #if QT_CONFIG(colordialog) @@ -14,6 +16,7 @@ class QAccessibleColorWellItem : public QAccessibleInterface { QAccessibleColorWell *m_parent; + Q_DECLARE_TR_FUNCTIONS(QAccessibleColorWellItem) public: QAccessibleColorWellItem(QAccessibleColorWell *parent); @@ -79,7 +82,7 @@ QString QAccessibleColorWellItem::text(QAccessible::Text t) const if (t == QAccessible::Name) { QRgb color = m_parent->colorWell()->rgbValues()[m_parent->indexOfChild(this)]; //: Color specified via its 3 RGB components (red, green, blue) - return QObject::tr("RGB %1, %2, %3") + return tr("RGB %1, %2, %3") .arg(QString::number(qRed(color)), QString::number(qGreen(color)), QString::number(qBlue(color))); } |
