TableInterface,
ActionInterface,
ImageInterface,
- Table2Interface
+ Table2Interface,
+ Table2CellInterface
};
typedef QAccessibleInterface*(*InterfaceFactory)(const QString &key, QObject*);
class QAccessibleActionInterface;
class QAccessibleImageInterface;
class QAccessibleTable2Interface;
+class QAccessibleTable2CellInterface;
class Q_GUI_EXPORT QAccessibleInterface : public QAccessible
{
inline QAccessibleTable2Interface *table2Interface()
{ return reinterpret_cast<QAccessibleTable2Interface *>(interface_cast(QAccessible::Table2Interface)); }
+ inline QAccessibleTable2CellInterface *table2CellInterface()
+ { return reinterpret_cast<QAccessibleTable2CellInterface *>(interface_cast(QAccessible::Table2CellInterface)); }
+
// FIXME
virtual QVariant virtual_hook(const QVariant &data);
virtual void *interface_cast(QAccessible::InterfaceType)
class Q_GUI_EXPORT QAccessibleTableInterface
{
public:
-
-
virtual QAccessibleInterface *accessibleAt(int row, int column) = 0;
virtual QAccessibleInterface *caption() = 0;
virtual int childIndex(int rowIndex, int columnIndex) = 0;
int *columnSpan, bool *isSelected) = 0;
};
-class Q_GUI_EXPORT QAccessibleTable2CellInterface: public QAccessibleInterface
+class Q_GUI_EXPORT QAccessibleTable2CellInterface
{
public:
// Returns the number of columns occupied by this cell accessible.
// Gets the row and column indexes and extents of this cell accessible and whether or not it is selected.
virtual void rowColumnExtents(int *row, int *column, int *rowExtents, int *columnExtents, bool *selected) const = 0;
// Returns a reference to the accessbile of the containing table.
- virtual QAccessibleTable2Interface* table() const = 0;
+ virtual QAccessibleInterface* table() const = 0;
// #### Qt5 this should not be here but part of the state
virtual bool isExpandable() const = 0;
public:
// Returns the cell at the specified row and column in the table.
- virtual QAccessibleTable2CellInterface *cellAt (int row, int column) const = 0;
+ virtual QAccessibleInterface *cellAt (int row, int column) const = 0;
// Returns the caption for the table.
virtual QAccessibleInterface *caption() const = 0;
// Returns the description text of the specified column in the table.
// Returns the description text of the specified row in the table.
virtual QString rowDescription(int row) const = 0;
// Returns a list of accessibles currently selected.
- virtual QList<QAccessibleTable2CellInterface*> selectedCells() const = 0;
+ virtual QList<QAccessibleInterface*> selectedCells() const = 0;
// Returns a list of column indexes currently selected (0 based).
virtual QList<int> selectedColumns() const = 0;
// Returns a list of row indexes currently selected (0 based).
return 0;
}
-QAccessibleTable2CellInterface *QAccessibleTable2::cellAt(int row, int column) const
+QAccessibleInterface *QAccessibleTable2::cellAt(int row, int column) const
{
Q_ASSERT(role() != QAccessible::Tree);
QModelIndex index = view->model()->index(row, column);
return view->model()->headerData(row, Qt::Vertical).toString();
}
-QList<QAccessibleTable2CellInterface*> QAccessibleTable2::selectedCells() const
+QList<QAccessibleInterface *> QAccessibleTable2::selectedCells() const
{
- QList<QAccessibleTable2CellInterface*> cells;
+ QList<QAccessibleInterface*> cells;
Q_FOREACH (const QModelIndex &index, view->selectionModel()->selectedIndexes()) {
cells.append(cell(index));
}
return QAccessible::Unrelated;
}
-QAccessibleTable2CellInterface *QAccessibleTree::cellAt(int row, int column) const
+QAccessibleInterface *QAccessibleTree::cellAt(int row, int column) const
{
QModelIndex index = indexFromLogical(row, column);
if (!index.isValid()) {
Q_ASSERT(index_.isValid());
}
+void *QAccessibleTable2Cell::interface_cast(QAccessible::InterfaceType t)
+{
+ if (t == QAccessible::Table2CellInterface)
+ return static_cast<QAccessibleTable2CellInterface*>(this);
+ return 0;
+}
+
int QAccessibleTable2Cell::columnExtent() const { return 1; }
int QAccessibleTable2Cell::rowExtent() const { return 1; }
*selected = isSelected();
}
-QAccessibleTable2Interface* QAccessibleTable2Cell::table() const
+QAccessibleInterface *QAccessibleTable2Cell::table() const
{
- return QAccessible::queryAccessibleInterface(view)->table2Interface();
+ return QAccessible::queryAccessibleInterface(view);
}
QAccessible::Role QAccessibleTable2Cell::role() const
void *interface_cast(QAccessible::InterfaceType t);
// table2 interface
- virtual QAccessibleTable2CellInterface *cellAt(int row, int column) const;
+ virtual QAccessibleInterface *cellAt(int row, int column) const;
virtual QAccessibleInterface *caption() const;
virtual QAccessibleInterface *summary() const;
virtual QString columnDescription(int column) const;
virtual int selectedCellCount() const;
virtual int selectedColumnCount() const;
virtual int selectedRowCount() const;
- virtual QList<QAccessibleTable2CellInterface*> selectedCells() const;
+ virtual QList<QAccessibleInterface*> selectedCells() const;
virtual QList<int> selectedColumns() const;
virtual QList<int> selectedRows() const;
virtual bool isColumnSelected(int column) const;
Relation relationTo(const QAccessibleInterface *other) const;
// table2 interface
- QAccessibleTable2CellInterface *cellAt(int row, int column) const;
+ QAccessibleInterface *cellAt(int row, int column) const;
QString rowDescription(int row) const;
bool isRowSelected(int row) const;
bool selectRow(int row);
QModelIndex indexFromLogical(int row, int column = 0) const;
};
-class QAccessibleTable2Cell: public QAccessibleTable2CellInterface /*), public QAccessibleTextInterface, public QAccessibleSimpleEditableTextInterface*/
+class QAccessibleTable2Cell: public QAccessibleInterface, public QAccessibleTable2CellInterface
{
public:
QAccessibleTable2Cell(QAbstractItemView *view, const QModelIndex &m_index, QAccessible::Role role);
+ void *interface_cast(QAccessible::InterfaceType t);
QObject *object() const { return 0; }
Role role() const;
State state() const;
virtual int rowIndex() const;
virtual bool isSelected() const;
virtual void rowColumnExtents(int *row, int *column, int *rowExtents, int *columnExtents, bool *selected) const;
- virtual QAccessibleTable2Interface* table() const;
+ virtual QAccessibleInterface* table() const;
private:
QHeaderView *verticalHeader() const;
};
-class QAccessibleTable2HeaderCell: public QAccessibleInterface /*), public QAccessibleTextInterface, public QAccessibleSimpleEditableTextInterface*/
+class QAccessibleTable2HeaderCell: public QAccessibleInterface
{
public:
// For header cells, pass the header view in addition
QVERIFY(table2);
QCOMPARE(table2->columnCount(), 1);
QCOMPARE(table2->rowCount(), 4);
- QAccessibleTable2CellInterface *cell1;
+ QAccessibleInterface *cell1;
QVERIFY(cell1 = table2->cellAt(0,0));
QCOMPARE(cell1->text(QAccessible::Name), QString("Oslo"));
- QAccessibleTable2CellInterface *cell4;
+ QAccessibleInterface *cell4;
QVERIFY(cell4 = table2->cellAt(3,0));
QCOMPARE(cell4->text(QAccessible::Name), QString("Munich"));
QCOMPARE(cell4->role(), QAccessible::ListItem);
- QCOMPARE(cell4->rowIndex(), 3);
- QCOMPARE(cell4->columnIndex(), 0);
- QVERIFY(!cell4->isExpandable());
+
+ QAccessibleTable2CellInterface *cellInterface = cell4->table2CellInterface();
+ QVERIFY(cellInterface);
+ QCOMPARE(cellInterface->rowIndex(), 3);
+ QCOMPARE(cellInterface->columnIndex(), 0);
+ QVERIFY(!cellInterface->isExpandable());
delete cell4;
delete cell1;
QVERIFY(table2);
QCOMPARE(table2->columnCount(), 2);
QCOMPARE(table2->rowCount(), 2);
- QAccessibleTable2CellInterface *cell1;
+ QAccessibleInterface *cell1;
QVERIFY(cell1 = table2->cellAt(0,0));
QCOMPARE(cell1->text(QAccessible::Name), QString("Spain"));
- QAccessibleTable2CellInterface *cell2;
+ QAccessibleInterface *cell2;
QVERIFY(cell2 = table2->cellAt(1,0));
QCOMPARE(cell2->text(QAccessible::Name), QString("Austria"));
QCOMPARE(cell2->role(), QAccessible::TreeItem);
- QCOMPARE(cell2->rowIndex(), 1);
- QCOMPARE(cell2->columnIndex(), 0);
- QVERIFY(cell2->isExpandable());
+ QCOMPARE(cell2->table2CellInterface()->rowIndex(), 1);
+ QCOMPARE(cell2->table2CellInterface()->columnIndex(), 0);
+ QVERIFY(cell2->table2CellInterface()->isExpandable());
QCOMPARE(iface->indexOfChild(cell2), 5);
QVERIFY(!(cell2->state() & QAccessible::Expanded));
QCOMPARE(table2->columnDescription(1), QString("Work"));
cell2 = table2->cellAt(4,0);
QCOMPARE(cell2->text(QAccessible::Name), QString("Klimt"));
QCOMPARE(cell2->role(), QAccessible::TreeItem);
- QCOMPARE(cell2->rowIndex(), 4);
- QCOMPARE(cell2->columnIndex(), 0);
- QVERIFY(!cell2->isExpandable());
+ QCOMPARE(cell2->table2CellInterface()->rowIndex(), 4);
+ QCOMPARE(cell2->table2CellInterface()->columnIndex(), 0);
+ QVERIFY(!cell2->table2CellInterface()->isExpandable());
QCOMPARE(iface->indexOfChild(cell2), 11);
QCOMPARE(table2->columnDescription(0), QString("Artist"));
QVERIFY(child2);
QCOMPARE(iface->indexOfChild(child2), 11);
QCOMPARE(child2->text(QAccessible::Name), QString("1.1"));
- QAccessibleTable2CellInterface *cell2Iface = static_cast<QAccessibleTable2CellInterface*>(child2);
+ QAccessibleTable2CellInterface *cell2Iface = child2->table2CellInterface();
QCOMPARE(cell2Iface->rowIndex(), 1);
QCOMPARE(cell2Iface->columnIndex(), 1);
delete child2;
QVERIFY(table2);
QCOMPARE(table2->columnCount(), 3);
QCOMPARE(table2->rowCount(), 3);
- QAccessibleTable2CellInterface *cell1;
+ QAccessibleInterface *cell1;
QVERIFY(cell1 = table2->cellAt(0,0));
QCOMPARE(cell1->text(QAccessible::Name), QString("0.0"));
QCOMPARE(iface->indexOfChild(cell1), 6);
- QAccessibleTable2CellInterface *cell2;
+ QAccessibleInterface *cell2;
QVERIFY(cell2 = table2->cellAt(0,1));
QCOMPARE(cell2->text(QAccessible::Name), QString("0.1"));
QCOMPARE(cell2->role(), QAccessible::Cell);
- QCOMPARE(cell2->rowIndex(), 0);
- QCOMPARE(cell2->columnIndex(), 1);
+ QCOMPARE(cell2->table2CellInterface()->rowIndex(), 0);
+ QCOMPARE(cell2->table2CellInterface()->columnIndex(), 1);
QCOMPARE(iface->indexOfChild(cell2), 7);
delete cell2;
- QAccessibleTable2CellInterface *cell3;
+ QAccessibleInterface *cell3;
QVERIFY(cell3 = table2->cellAt(1,2));
QCOMPARE(cell3->text(QAccessible::Name), QString("1.2"));
QCOMPARE(cell3->role(), QAccessible::Cell);
- QCOMPARE(cell3->rowIndex(), 1);
- QCOMPARE(cell3->columnIndex(), 2);
+ QCOMPARE(cell3->table2CellInterface()->rowIndex(), 1);
+ QCOMPARE(cell3->table2CellInterface()->columnIndex(), 2);
QCOMPARE(iface->indexOfChild(cell3), 12);
delete cell3;