7#if QT_CONFIG(tableview)
10#if QT_CONFIG(listview)
13#if QT_CONFIG(treeview)
15#include <private/qtreeview_p.h>
17#include <private/qwidget_p.h>
19#if QT_CONFIG(accessibility)
37 return qobject_cast<QAbstractItemView*>(
object());
44 if (!theModel || !
index.isValid())
48 const int vHeader = verticalHeader() ? 1 : 0;
49 const int hHeader = horizontalHeader() ? 1 : 0;
50 return (
index.row() + hHeader) * (theModel->columnCount(rootIndex) + vHeader)
51 + (
index.column() + vHeader);
54QAccessibleTable::QAccessibleTable(
QWidget *
w)
55 : QAccessibleObject(
w)
59#if QT_CONFIG(tableview)
60 if (qobject_cast<const QTableView*>(
view())) {
61 m_role = QAccessible::Table;
64#if QT_CONFIG(treeview)
65 if (qobject_cast<const QTreeView*>(
view())) {
66 m_role = QAccessible::Tree;
69#if QT_CONFIG(listview)
70 if (qobject_cast<const QListView*>(
view())) {
71 m_role = QAccessible::List;
76 m_role = QAccessible::Table;
80bool QAccessibleTable::isValid()
const
85QAccessibleTable::~QAccessibleTable()
87 for (QAccessible::Id
id :
std::as_const(childToId))
91QHeaderView *QAccessibleTable::horizontalHeader()
const
95#if QT_CONFIG(tableview)
96 }
else if (
const QTableView *tv = qobject_cast<const QTableView*>(
view())) {
97 header = tv->horizontalHeader();
99#if QT_CONFIG(treeview)
100 }
else if (
const QTreeView *tv = qobject_cast<const QTreeView*>(
view())) {
107QHeaderView *QAccessibleTable::verticalHeader()
const
111#if QT_CONFIG(tableview)
112 }
else if (
const QTableView *tv = qobject_cast<const QTableView*>(
view())) {
113 header = tv->verticalHeader();
119QAccessibleInterface *QAccessibleTable::cellAt(
int row,
int column)
const
125 Q_ASSERT(role() != QAccessible::Tree);
128 qWarning() <<
"QAccessibleTable::cellAt: invalid index: " <<
index <<
" for " << theView;
134QAccessibleInterface *QAccessibleTable::caption()
const
148int QAccessibleTable::columnCount()
const
154 return theModel->
columnCount(theView->rootIndex());
157int QAccessibleTable::rowCount()
const
163 return theModel->
rowCount(theView->rootIndex());
166int QAccessibleTable::selectedCellCount()
const
168 if (!
view()->selectionModel())
170 return view()->selectionModel()->selectedIndexes().size();
173int QAccessibleTable::selectedColumnCount()
const
175 if (!
view()->selectionModel())
177 return view()->selectionModel()->selectedColumns().size();
180int QAccessibleTable::selectedRowCount()
const
182 if (!
view()->selectionModel())
184 return view()->selectionModel()->selectedRows().size();
187QString QAccessibleTable::rowDescription(
int row)
const
196QList<QAccessibleInterface *> QAccessibleTable::selectedCells()
const
198 QList<QAccessibleInterface*> cells;
199 if (!
view()->selectionModel())
202 cells.reserve(selectedIndexes.
size());
208QList<int> QAccessibleTable::selectedColumns()
const
210 if (!
view()->selectionModel())
214 columns.reserve(selectedColumns.
size());
221QList<int> QAccessibleTable::selectedRows()
const
223 if (!
view()->selectionModel())
227 rows.reserve(selectedRows.
size());
234QAccessibleInterface *QAccessibleTable::summary()
const
239bool QAccessibleTable::isColumnSelected(
int column)
const
241 if (!
view()->selectionModel())
246bool QAccessibleTable::isRowSelected(
int row)
const
248 if (!
view()->selectionModel())
253bool QAccessibleTable::selectRow(
int row)
257 if (!theModel || !
view()->selectionModel())
260 const QModelIndex rootIndex = theView->rootIndex();
266 switch (
view()->selectionMode()) {
272 view()->clearSelection();
275 if ((!
row || !theView->selectionModel()->isRowSelected(
row - 1, rootIndex))
276 && !theView->selectionModel()->isRowSelected(
row + 1, rootIndex)) {
277 theView->clearSelection();
288bool QAccessibleTable::selectColumn(
int column)
292 auto *selectionModel = theView->selectionModel();
293 if (!theModel || !selectionModel)
296 const QModelIndex rootIndex = theView->rootIndex();
302 switch (theView->selectionMode()) {
310 if ((!
column || !selectionModel->isColumnSelected(
column - 1, rootIndex))
311 && !selectionModel->isColumnSelected(
column + 1, rootIndex)) {
312 theView->clearSelection();
323bool QAccessibleTable::unselectRow(
int row)
327 auto *selectionModel = theView->selectionModel();
328 if (!theModel || !selectionModel)
331 const QModelIndex rootIndex = theView->rootIndex();
333 if (!
index.isValid())
338 switch (theView->selectionMode()) {
342 if (selectedRowCount() == 1)
346 if (selectedRowCount() == 1)
349 if ((!
row || selectionModel->isRowSelected(
row - 1, rootIndex))
350 && selectionModel->isRowSelected(
row + 1, rootIndex)) {
364bool QAccessibleTable::unselectColumn(
int column)
368 auto *selectionModel = theView->selectionModel();
369 if (!theModel || !selectionModel)
372 const QModelIndex rootIndex = theView->rootIndex();
374 if (!
index.isValid())
379 switch (
view()->selectionMode()) {
383 if (selectedColumnCount() == 1)
387 if (selectedColumnCount() == 1)
390 if ((!
column || selectionModel->isColumnSelected(
column - 1, rootIndex))
391 && selectionModel->isColumnSelected(
column + 1, rootIndex)) {
405int QAccessibleTable::selectedItemCount()
const
407 return selectedCellCount();
410QList<QAccessibleInterface*> QAccessibleTable::selectedItems()
const
412 return selectedCells();
415bool QAccessibleTable::isSelected(QAccessibleInterface *childCell)
const
417 if (!childCell || childCell->parent() !=
this) {
418 qWarning() <<
"QAccessibleTable::isSelected: Accessible interface must be a direct child of the table interface.";
422 const QAccessibleTableCellInterface *cell = childCell->tableCellInterface();
424 return cell->isSelected();
429bool QAccessibleTable::select(QAccessibleInterface *childCell)
431 if (!childCell || childCell->parent() !=
this) {
432 qWarning() <<
"QAccessibleTable::select: Accessible interface must be a direct child of the table interface.";
436 if (!childCell->tableCellInterface()) {
437 qWarning() <<
"QAccessibleTable::select: Accessible interface doesn't implement table cell interface.";
441 if (childCell->role() == QAccessible::Cell || childCell->role() == QAccessible::ListItem || childCell->role() == QAccessible::TreeItem) {
442 QAccessibleTableCell* cell =
static_cast<QAccessibleTableCell*
>(childCell);
450bool QAccessibleTable::unselect(QAccessibleInterface *childCell)
452 if (!childCell || childCell->parent() !=
this) {
453 qWarning() <<
"QAccessibleTable::select: Accessible interface must be a direct child of the table interface.";
457 if (!childCell->tableCellInterface()) {
458 qWarning() <<
"QAccessibleTable::unselect: Accessible interface doesn't implement table cell interface.";
462 if (childCell->role() == QAccessible::Cell || childCell->role() == QAccessible::ListItem || childCell->role() == QAccessible::TreeItem) {
463 QAccessibleTableCell* cell =
static_cast<QAccessibleTableCell*
>(childCell);
464 cell->unselectCell();
471bool QAccessibleTable::selectAll()
477bool QAccessibleTable::clear()
479 view()->selectionModel()->clearSelection();
484QAccessible::Role QAccessibleTable::role()
const
492 const auto *
w =
view();
495 state.invisible =
true;
497 state.focusable =
true;
499 state.focused =
true;
501 state.disabled =
true;
504 state.movable =
true;
505 if (
w->minimumSize() !=
w->maximumSize())
506 state.sizeable =
true;
507 if (
w->isActiveWindow())
514QAccessibleInterface *QAccessibleTable::childAt(
int x,
int y)
const
526QAccessibleInterface *QAccessibleTable::focusChild()
const
529 if (!
index.isValid())
535int QAccessibleTable::childCount()
const
541 const QModelIndex rootIndex = theView->rootIndex();
542 int vHeader = verticalHeader() ? 1 : 0;
543 int hHeader = horizontalHeader() ? 1 : 0;
544 return (theModel->rowCount(rootIndex) + hHeader) * (theModel->columnCount(rootIndex) + vHeader);
547int QAccessibleTable::indexOfChild(
const QAccessibleInterface *iface)
const
553 QAccessibleInterface *parent =
iface->parent();
554 if (parent->object() != theView)
557 const QModelIndex rootIndex = theView->rootIndex();
559 if (
iface->role() == QAccessible::Cell ||
iface->role() == QAccessible::ListItem) {
560 const QAccessibleTableCell* cell =
static_cast<const QAccessibleTableCell*
>(
iface);
561 return logicalIndex(cell->m_index);
562 }
else if (
iface->role() == QAccessible::ColumnHeader){
563 const QAccessibleTableHeaderCell* cell =
static_cast<const QAccessibleTableHeaderCell*
>(
iface);
564 return cell->index + (verticalHeader() ? 1 : 0);
565 }
else if (
iface->role() == QAccessible::RowHeader){
566 const QAccessibleTableHeaderCell* cell =
static_cast<const QAccessibleTableHeaderCell*
>(
iface);
567 return (cell->index + 1) * (theModel->columnCount(rootIndex) + 1);
568 }
else if (
iface->role() == QAccessible::Pane) {
571 qWarning() <<
"WARNING QAccessibleTable::indexOfChild Fix my children..."
572 <<
iface->role() <<
iface->text(QAccessible::Name);
578QString QAccessibleTable::text(QAccessible::Text
t)
const
580 if (
t == QAccessible::Description)
581 return view()->accessibleDescription();
582 return view()->accessibleName();
585QRect QAccessibleTable::rect()
const
593QAccessibleInterface *QAccessibleTable::parent()
const
597 return QAccessible::queryAccessibleInterface(
view()->parent()->parent());
599 return QAccessible::queryAccessibleInterface(
view()->parent());
601 return QAccessible::queryAccessibleInterface(
qApp);
604QAccessibleInterface *QAccessibleTable::child(
int logicalIndex)
const
611 const QModelIndex rootIndex = theView->rootIndex();
612 auto id = childToId.constFind(logicalIndex);
613 if (
id != childToId.constEnd())
614 return QAccessible::accessibleInterface(
id.
value());
616 int vHeader = verticalHeader() ? 1 : 0;
617 int hHeader = horizontalHeader() ? 1 : 0;
619 int columns = theModel->columnCount(rootIndex) + vHeader;
621 int row = logicalIndex / columns;
622 int column = logicalIndex % columns;
624 QAccessibleInterface *
iface =
nullptr;
628 if (hHeader &&
row == 0) {
629 iface =
new QAccessibleTableCornerButton(theView);
636 if (!iface && hHeader) {
649 iface =
new QAccessibleTableCell(theView,
index, cellRole());
652 QAccessible::registerAccessibleInterface(iface);
653 childToId.insert(logicalIndex, QAccessible::uniqueId(iface));
657void *QAccessibleTable::interface_cast(QAccessible::InterfaceType
t)
659 if (
t == QAccessible::SelectionInterface)
660 return static_cast<QAccessibleSelectionInterface*
>(
this);
661 if (
t == QAccessible::TableInterface)
662 return static_cast<QAccessibleTableInterface*
>(
this);
666void QAccessibleTable::modelChange(QAccessibleTableModelChangeEvent *
event)
669 if (childToId.isEmpty())
672 switch (
event->modelChangeType()) {
673 case QAccessibleTableModelChangeEvent::ModelReset:
674 for (QAccessible::Id
id :
std::as_const(childToId))
680 case QAccessibleTableModelChangeEvent::RowsInserted:
681 case QAccessibleTableModelChangeEvent::ColumnsInserted: {
682 int newRows =
event->lastRow() -
event->firstRow() + 1;
683 int newColumns =
event->lastColumn() -
event->firstColumn() + 1;
686 ChildCache::ConstIterator
iter = childToId.constBegin();
688 while (
iter != childToId.constEnd()) {
689 QAccessible::Id
id =
iter.value();
690 QAccessibleInterface *
iface = QAccessible::accessibleInterface(
id);
692 if (
event->modelChangeType() == QAccessibleTableModelChangeEvent::RowsInserted
693 &&
iface->role() == QAccessible::RowHeader) {
694 QAccessibleTableHeaderCell *cell =
static_cast<QAccessibleTableHeaderCell*
>(
iface);
695 if (cell->index >=
event->firstRow()) {
696 cell->index += newRows;
698 }
else if (
event->modelChangeType() == QAccessibleTableModelChangeEvent::ColumnsInserted
699 &&
iface->role() == QAccessible::ColumnHeader) {
700 QAccessibleTableHeaderCell *cell =
static_cast<QAccessibleTableHeaderCell*
>(
iface);
701 if (cell->index >=
event->firstColumn()) {
702 cell->index += newColumns;
705 if (indexOfChild(iface) >= 0) {
706 newCache.insert(indexOfChild(iface),
id);
711 QAccessible::deleteAccessibleInterface(
id);
715 childToId = newCache;
719 case QAccessibleTableModelChangeEvent::ColumnsRemoved:
720 case QAccessibleTableModelChangeEvent::RowsRemoved: {
721 int deletedColumns =
event->lastColumn() -
event->firstColumn() + 1;
722 int deletedRows =
event->lastRow() -
event->firstRow() + 1;
724 ChildCache::ConstIterator
iter = childToId.constBegin();
725 while (
iter != childToId.constEnd()) {
726 QAccessible::Id
id =
iter.value();
727 QAccessibleInterface *
iface = QAccessible::accessibleInterface(
id);
729 if (
iface->role() == QAccessible::Cell ||
iface->role() == QAccessible::ListItem) {
731 QAccessibleTableCell *cell =
static_cast<QAccessibleTableCell*
>(
iface->tableCellInterface());
733 if (cell->m_index.isValid())
734 newCache.insert(indexOfChild(cell),
id);
736 QAccessible::deleteAccessibleInterface(
id);
737 }
else if (
event->modelChangeType() == QAccessibleTableModelChangeEvent::RowsRemoved
738 &&
iface->role() == QAccessible::RowHeader) {
739 QAccessibleTableHeaderCell *cell =
static_cast<QAccessibleTableHeaderCell*
>(
iface);
740 if (cell->index <
event->firstRow()) {
741 newCache.insert(indexOfChild(cell),
id);
742 }
else if (cell->index >
event->lastRow()) {
743 cell->index -= deletedRows;
744 newCache.insert(indexOfChild(cell),
id);
746 QAccessible::deleteAccessibleInterface(
id);
748 }
else if (
event->modelChangeType() == QAccessibleTableModelChangeEvent::ColumnsRemoved
749 &&
iface->role() == QAccessible::ColumnHeader) {
750 QAccessibleTableHeaderCell *cell =
static_cast<QAccessibleTableHeaderCell*
>(
iface);
751 if (cell->index <
event->firstColumn()) {
752 newCache.insert(indexOfChild(cell),
id);
753 }
else if (cell->index >
event->lastColumn()) {
754 cell->index -= deletedColumns;
755 newCache.insert(indexOfChild(cell),
id);
757 QAccessible::deleteAccessibleInterface(
id);
762 childToId = newCache;
766 case QAccessibleTableModelChangeEvent::DataChanged:
772#if QT_CONFIG(treeview)
781 const QTreeView *treeView = qobject_cast<const QTreeView*>(
view());
782 if (
Q_UNLIKELY(
row < 0 || column < 0 || treeView->d_func()->viewItems.size() <=
row)) {
783 qWarning() <<
"QAccessibleTree::indexFromLogical: invalid index: " <<
row <<
column <<
" for " << treeView;
786 QModelIndex modelIndex = treeView->d_func()->viewItems.at(
row).index;
794QAccessibleInterface *QAccessibleTree::childAt(
int x,
int y)
const
801 const QPoint viewportOffset = theView->viewport()->mapTo(
view(),
QPoint(0, 0));
802 const QPoint indexPosition = theView->mapFromGlobal(
QPoint(
x,
y) - viewportOffset);
805 if (!
index.isValid())
808 const QTreeView *treeView = qobject_cast<const QTreeView *>(theView);
809 int row = treeView->d_func()->viewIndex(
index) + (horizontalHeader() ? 1 : 0);
812 int i =
row * theModel->columnCount(theView->rootIndex()) +
column;
816QAccessibleInterface *QAccessibleTree::focusChild()
const
821 if (!
index.isValid())
824 const QTreeView *treeView = qobject_cast<const QTreeView *>(theView);
825 const int row = treeView->d_func()->viewIndex(
index) + (horizontalHeader() ? 1 : 0);
828 int i =
row * theModel->columnCount(theView->rootIndex()) +
column;
832int QAccessibleTree::childCount()
const
834 const QTreeView *treeView = qobject_cast<const QTreeView*>(
view());
840 int hHeader = horizontalHeader() ? 1 : 0;
841 return (treeView->d_func()->viewItems.size() + hHeader)
845QAccessibleInterface *QAccessibleTree::child(
int logicalIndex)
const
849 const QModelIndex rootIndex = theView->rootIndex();
850 if (logicalIndex < 0 || !theModel || !theModel->columnCount(rootIndex))
853 QAccessibleInterface *
iface =
nullptr;
854 int index = logicalIndex;
856 if (horizontalHeader()) {
857 if (index < theModel->columnCount(rootIndex))
860 index -= theModel->columnCount(rootIndex);
864 const int row =
index / theModel->columnCount(rootIndex);
865 const int column =
index % theModel->columnCount(rootIndex);
869 iface =
new QAccessibleTableCell(
view(), modelIndex, cellRole());
871 QAccessible::registerAccessibleInterface(iface);
876int QAccessibleTree::rowCount()
const
878 const QTreeView *treeView = qobject_cast<const QTreeView*>(
view());
880 return treeView->d_func()->viewItems.size();
883int QAccessibleTree::indexOfChild(
const QAccessibleInterface *iface)
const
889 QAccessibleInterface *parent =
iface->parent();
890 if (parent->object() !=
view())
893 if (
iface->role() == QAccessible::TreeItem) {
894 const QAccessibleTableCell* cell =
static_cast<const QAccessibleTableCell*
>(
iface);
895 const QTreeView *treeView = qobject_cast<const QTreeView *>(theView);
897 int row = treeView->d_func()->viewIndex(cell->m_index) + (horizontalHeader() ? 1 : 0);
898 int column = cell->m_index.column();
900 int index =
row * theModel->columnCount(theView->rootIndex()) +
column;
902 }
else if (
iface->role() == QAccessible::ColumnHeader){
903 const QAccessibleTableHeaderCell* cell =
static_cast<const QAccessibleTableHeaderCell*
>(
iface);
906 qWarning() <<
"WARNING QAccessibleTable::indexOfChild invalid child"
907 <<
iface->role() <<
iface->text(QAccessible::Name);
913QAccessibleInterface *QAccessibleTree::cellAt(
int row,
int column)
const
920 const QTreeView *treeView = qobject_cast<const QTreeView*>(
view());
922 int logicalIndex = treeView->d_func()->accessibleTable2Index(
index);
924 return child(logicalIndex);
927QString QAccessibleTree::rowDescription(
int)
const
932bool QAccessibleTree::isRowSelected(
int row)
const
934 if (!
view()->selectionModel())
937 return view()->selectionModel()->isRowSelected(
index.row(),
index.parent());
940bool QAccessibleTree::selectRow(
int row)
942 if (!
view()->selectionModel())
949 switch (
view()->selectionMode()) {
955 view()->clearSelection();
958 if ((!
row || !
view()->selectionModel()->isRowSelected(
row - 1,
view()->rootIndex()))
959 && !
view()->selectionModel()->isRowSelected(
row + 1,
view()->rootIndex()))
960 view()->clearSelection();
975 :
view(view_), m_index(index_), m_role(role_)
978 qWarning() <<
"QAccessibleTableCell::QAccessibleTableCell with invalid index: " << index_;
981void *QAccessibleTableCell::interface_cast(QAccessible::InterfaceType
t)
983 if (
t == QAccessible::TableCellInterface)
984 return static_cast<QAccessibleTableCellInterface*
>(
this);
985 if (
t == QAccessible::ActionInterface)
986 return static_cast<QAccessibleActionInterface*
>(
this);
990int QAccessibleTableCell::columnExtent()
const {
return 1; }
991int QAccessibleTableCell::rowExtent()
const {
return 1; }
993QList<QAccessibleInterface*> QAccessibleTableCell::rowHeaderCells()
const
995 QList<QAccessibleInterface*> headerCell;
996 if (verticalHeader()) {
998 headerCell.append(
new QAccessibleTableHeaderCell(
view, m_index.row(),
Qt::Vertical));
1003QList<QAccessibleInterface*> QAccessibleTableCell::columnHeaderCells()
const
1005 QList<QAccessibleInterface*> headerCell;
1006 if (horizontalHeader()) {
1008 headerCell.append(
new QAccessibleTableHeaderCell(
view, m_index.column(),
Qt::Horizontal));
1013QHeaderView *QAccessibleTableCell::horizontalHeader()
const
1018#if QT_CONFIG(tableview)
1019 }
else if (
const QTableView *tv = qobject_cast<const QTableView*>(
view)) {
1020 header = tv->horizontalHeader();
1022#if QT_CONFIG(treeview)
1023 }
else if (
const QTreeView *tv = qobject_cast<const QTreeView*>(
view)) {
1031QHeaderView *QAccessibleTableCell::verticalHeader()
const
1034#if QT_CONFIG(tableview)
1035 if (
const QTableView *tv = qobject_cast<const QTableView*>(
view))
1036 header = tv->verticalHeader();
1041int QAccessibleTableCell::columnIndex()
const
1045 return m_index.column();
1048int QAccessibleTableCell::rowIndex()
const
1052#if QT_CONFIG(treeview)
1053 if (role() == QAccessible::TreeItem) {
1054 const QTreeView *treeView = qobject_cast<const QTreeView*>(
view);
1056 int row = treeView->d_func()->viewIndex(m_index);
1060 return m_index.row();
1063bool QAccessibleTableCell::isSelected()
const
1067 return view->selectionModel()->isSelected(m_index);
1070QStringList QAccessibleTableCell::actionNames()
const
1073 names << toggleAction();
1077void QAccessibleTableCell::doAction(
const QString& actionName)
1079 if (actionName == toggleAction()) {
1080#if defined(Q_OS_ANDROID)
1081 QAccessibleInterface *parentInterface = parent();
1082 while (parentInterface){
1083 if (parentInterface->role() == QAccessible::ComboBox) {
1085 parentInterface->actionInterface()->doAction(pressAction());
1088 parentInterface = parentInterface->parent();
1106void QAccessibleTableCell::selectCell()
1114 QAccessibleTableInterface *cellTable =
table()->tableInterface();
1116 switch (
view->selectionBehavior()) {
1121 cellTable->selectColumn(m_index.column());
1125 cellTable->selectRow(m_index.row());
1130 view->clearSelection();
1136void QAccessibleTableCell::unselectCell()
1144 QAccessibleTableInterface *cellTable =
table()->tableInterface();
1146 switch (
view->selectionBehavior()) {
1151 cellTable->unselectColumn(m_index.column());
1155 cellTable->unselectRow(m_index.row());
1163 && (
view->selectionModel()->selectedIndexes().size() <= 1))
1169QAccessibleInterface *QAccessibleTableCell::table()
const
1171 return QAccessible::queryAccessibleInterface(
view);
1174QAccessible::Role QAccessibleTableCell::role()
const
1186 globalRect.translate(
view->mapToGlobal(
QPoint(0,0)));
1187 if (!globalRect.intersects(
rect()))
1188 st.invisible =
true;
1190 if (
view->selectionModel()->isSelected(m_index))
1192 if (
view->selectionModel()->currentIndex() == m_index)
1199 Qt::ItemFlags
flags = m_index.flags();
1201 st.checkable =
true;
1203 st.selectable =
true;
1204 st.focusable =
true;
1206 st.multiSelectable =
true;
1208 st.extSelectable =
true;
1210#if QT_CONFIG(treeview)
1211 if (m_role == QAccessible::TreeItem) {
1212 const QTreeView *treeView = qobject_cast<const QTreeView*>(
view);
1214 st.expandable =
true;
1223QRect QAccessibleTableCell::rect()
const
1228 r =
view->visualRect(m_index);
1237QString QAccessibleTableCell::text(QAccessible::Text
t)
const
1244 case QAccessible::Name:
1246 if (
value.isEmpty())
1249 case QAccessible::Description:
1258void QAccessibleTableCell::setText(QAccessible::Text ,
const QString &
text)
1262 view->model()->setData(m_index,
text);
1265bool QAccessibleTableCell::isValid()
const
1268 &&
view->model() && m_index.isValid();
1271QAccessibleInterface *QAccessibleTableCell::parent()
const
1273 return QAccessible::queryAccessibleInterface(
view);
1276QAccessibleInterface *QAccessibleTableCell::child(
int)
const
1282 :
view(view_),
index(index_), orientation(orientation_)
1287QAccessible::Role QAccessibleTableHeaderCell::role()
const
1290 return QAccessible::ColumnHeader;
1291 return QAccessible::RowHeader;
1299 s.disabled = !
h->isEnabled();
1304QRect QAccessibleTableHeaderCell::rect()
const
1308#if QT_CONFIG(tableview)
1309 }
else if (
const QTableView *tv = qobject_cast<const QTableView*>(
view)) {
1311 header = tv->horizontalHeader();
1313 header = tv->verticalHeader();
1316#if QT_CONFIG(treeview)
1317 }
else if (
const QTreeView *tv = qobject_cast<const QTreeView*>(
view)) {
1331QString QAccessibleTableHeaderCell::text(QAccessible::Text
t)
const
1336 case QAccessible::Name:
1338 if (
value.isEmpty())
1341 case QAccessible::Description:
1350void QAccessibleTableHeaderCell::setText(QAccessible::Text,
const QString &)
1355bool QAccessibleTableHeaderCell::isValid()
const
1358 ?
view->model() :
nullptr;
1363 ? (index < theModel->columnCount(rootIndex))
1364 : (
index < theModel->rowCount(rootIndex)));
1367QAccessibleInterface *QAccessibleTableHeaderCell::parent()
const
1369 return QAccessible::queryAccessibleInterface(
view);
1372QAccessibleInterface *QAccessibleTableHeaderCell::child(
int)
const
1377QHeaderView *QAccessibleTableHeaderCell::headerView()
const
1381#if QT_CONFIG(tableview)
1382 }
else if (
const QTableView *tv = qobject_cast<const QTableView*>(
view)) {
1384 header = tv->horizontalHeader();
1386 header = tv->verticalHeader();
1389#if QT_CONFIG(treeview)
1390 }
else if (
const QTreeView *tv = qobject_cast<const QTreeView*>(
view)) {
virtual Q_INVOKABLE bool hasChildren(const QModelIndex &parent=QModelIndex()) const
Returns {true} if parent has any children; otherwise returns {false}.
virtual Q_INVOKABLE int rowCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of rows under the given parent.
virtual Q_INVOKABLE int columnCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of columns for the children of the given parent.
The QAbstractItemView class provides the basic functionality for item view classes.
SelectionMode
This enum indicates how the view responds to user selections:
QAbstractItemModel * model() const
Returns the model that this view is presenting.
QModelIndex rootIndex() const
Returns the model index of the model's root item.
The QAccessible class provides enums and static functions related to accessibility.
qsizetype size() const noexcept
constexpr int row() const noexcept
Returns the row this model index refers to.
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
constexpr bool isValid() const noexcept
Returns {true} if this model index is valid; otherwise returns {false}.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
QVariant data(const QModelIndex &item, int role=Qt::DisplayRole) const override
Returns the value for the specified item and role.
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Returns the header data for the given role in the section of the header with the specified orientatio...
\macro QT_RESTRICTED_CAST_FROM_ASCII
The QTableView class provides a default model/view implementation of a table view.
The QTreeView class provides a default model/view implementation of a tree view.
bool isExpanded(const QModelIndex &index) const
Returns true if the model item index is expanded; otherwise returns false.
void * data()
Returns a pointer to the contained object as a generic void* that can be written to.
bool isValid() const
Returns true if the storage type of this variant is not QMetaType::UnknownType; otherwise returns fal...
int toInt(bool *ok=nullptr) const
Returns the variant as an int if the variant has userType() \l QMetaType::Int, \l QMetaType::Bool,...
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
list append(new Employee("Blackpool", "Stephen"))
Combined button and popup list for selecting options.
constexpr QBindableInterface iface
@ AccessibleDescriptionRole
Q_CORE_EXPORT int qstrcmp(const char *str1, const char *str2)
QList< QString > QStringList
Constructs a string list that contains the given string, str.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter * iter
static QString header(const QString &name)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLfloat GLfloat GLfloat GLfloat h
GLenum GLenum GLsizei void GLsizei void * column
GLenum GLenum GLsizei void * row
GLenum GLenum GLsizei void * table
const char className[16]
[1]
QSqlQueryModel * model
[16]
obj metaObject() -> className()
QItemSelection * selection
[0]