Check for valid model and view in isValid for TableCells.

Change-Id: Iadca5503ed2a1d6411d46ed6fe9d5b9a56461a3a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
Frederik Gladhorn 2012-09-28 19:22:13 +02:00 committed by The Qt Project
parent 2e99f6c48f
commit 26022a4eee

View File

@ -713,7 +713,7 @@ void QAccessibleTableCell::setText(QAccessible::Text /*t*/, const QString &text)
bool QAccessibleTableCell::isValid() const
{
return m_index.isValid();
return view && view->model() && m_index.isValid();
}
QAccessibleInterface *QAccessibleTableCell::parent() const
@ -799,7 +799,8 @@ void QAccessibleTableHeaderCell::setText(QAccessible::Text, const QString &)
bool QAccessibleTableHeaderCell::isValid() const
{
return true;
return view && view->model() && (index > 0)
&& ((orientation == Qt::Horizontal) ? (index < view->model()->columnCount()) : (index < view->model()->rowCount()));
}
QAccessibleInterface *QAccessibleTableHeaderCell::parent() const