Add "checkable" state to QAccessibleTableCell

The information about whether a table/tree item may be checked is necessary
to allow the platform code (in particular, Windows UI Automation layer)
to make this information available to screen readers.

Task-number: QTBUG-81919
Change-Id: Id68eea4a004788751404d70567222a2c531578aa
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Andre de la Rocha 2020-03-25 02:24:32 +01:00
parent fc49325c80
commit c91b7f15ce

View File

@ -1035,10 +1035,14 @@ QAccessible::State QAccessibleTableCell::state() const
st.selected = true;
if (view->selectionModel()->currentIndex() == m_index)
st.focused = true;
if (m_index.model()->data(m_index, Qt::CheckStateRole).toInt() == Qt::Checked)
QVariant checkState = m_index.model()->data(m_index, Qt::CheckStateRole);
if (checkState.toInt() == Qt::Checked)
st.checked = true;
Qt::ItemFlags flags = m_index.flags();
if ((flags & Qt::ItemIsUserCheckable) && checkState.isValid())
st.checkable = true;
if (flags & Qt::ItemIsSelectable) {
st.selectable = true;
st.focusable = true;