| 430 | } |
| 431 | |
| 432 | QAccessibleInterface* AccessibleInstanceView::child(int logicalIndex) const |
| 433 | { |
| 434 | if (!view()->model()) |
| 435 | return 0; |
| 436 | |
| 437 | auto id = childToId.constFind(logicalIndex); |
| 438 | if (id != childToId.constEnd()) |
| 439 | return QAccessible::accessibleInterface(id.value()); |
| 440 | |
| 441 | int columns = view()->model()->columnCount(); |
| 442 | |
| 443 | int row = logicalIndex / columns; |
| 444 | int column = logicalIndex % columns; |
| 445 | |
| 446 | QAccessibleInterface* iface = 0; |
| 447 | |
| 448 | QModelIndex index = view()->model()->index(row, column, view()->rootIndex()); |
| 449 | if (Q_UNLIKELY(!index.isValid())) { |
| 450 | qWarning("AccessibleInstanceView::child: Invalid index at: %d %d", row, column); |
| 451 | return 0; |
| 452 | } |
| 453 | iface = new AccessibleInstanceViewItem(view(), index); |
| 454 | |
| 455 | QAccessible::registerAccessibleInterface(iface); |
| 456 | childToId.insert(logicalIndex, QAccessible::uniqueId(iface)); |
| 457 | return iface; |
| 458 | } |
| 459 | |
| 460 | void* AccessibleInstanceView::interface_cast(QAccessible::InterfaceType t) |
| 461 | { |