Qt 4.8
Public Functions | Private Functions | Static Private Functions | Properties | Friends | List of all members
QAccessibleItemRow Class Reference

#include <complexwidgets.h>

Inheritance diagram for QAccessibleItemRow:
QAccessibleInterface QAccessible

Public Functions

QString actionText (int action, Text t, int child) const
 Returns the text property t of the action action supported by the object, or of the object's child if child is not 0. More...
 
int childAt (int x, int y) const
 Returns the 1-based index of the child that contains the screen coordinates (x, y). More...
 
int childCount () const
 Returns the number of children that belong to this object. More...
 
QModelIndex childIndex (int child) const
 
QList< QModelIndexchildren () const
 
bool doAction (int action, int child, const QVariantList &params=QVariantList())
 Asks the object, or the object's child if child is not 0, to execute action using the parameters, params. More...
 
QHeaderViewhorizontalHeader () const
 
int indexOfChild (const QAccessibleInterface *) const
 Returns the 1-based index of the object child in this object's children list, or -1 if child is not a child of this object. More...
 
bool isValid () const
 Returns true if all the data necessary to use this interface implementation is valid (e. More...
 
int navigate (RelationFlag relation, int index, QAccessibleInterface **iface) const
 Navigates from this object to an object that has a relationship relation to this object, and returns the respective object in target. More...
 
QObjectobject () const
 Returns a pointer to the QObject this interface implementation provides information for. More...
 
 QAccessibleItemRow (QAbstractItemView *view, const QModelIndex &index=QModelIndex(), bool isHeader=false)
 
QRect rect (int child) const
 Returns the geometry of the object, or of the object's child if child is not 0. More...
 
Relation relationTo (int child, const QAccessibleInterface *other, int otherChild) const
 
Returns the relationship between this object's \a child and the \a
other object's \a otherChild.
More...
 
Role role (int child) const
 Returns the role of the object, or of the object's child if child is not 0. More...
 
void setText (Text t, int child, const QString &text)
 Sets the text property t of the object, or of the object's child if child is not 0, to text. More...
 
State state (int child) const
 Returns the current state of the object, or of the object's child if child is not 0. More...
 
QString text (Text t, int child) const
 Returns the value of the text property t of the object, or of the object's child if child is not 0. More...
 
int userActionCount (int child) const
 Returns the number of custom actions of the object, or of the object's child if child is not 0. More...
 
- Public Functions inherited from QAccessibleInterface
QAccessibleActionInterfaceactionInterface ()
 
QColor backgroundColor ()
 
QAccessibleEditableTextInterfaceeditableTextInterface ()
 
QColor foregroundColor ()
 
QAccessibleImageInterfaceimageInterface ()
 
QVariant invokeMethod (Method method, int child=0, const QVariantList &params=QVariantList())
 Invokes a method on child with the given parameters params and returns the result of the operation as QVariant. More...
 
QSet< MethodsupportedMethods ()
 Returns a QSet of QAccessible::Method that are supported by this accessible interface. More...
 
QAccessibleTable2Interfacetable2Interface ()
 
QAccessibleTableInterfacetableInterface ()
 
QAccessibleTextInterfacetextInterface ()
 
QAccessibleValueInterfacevalueInterface ()
 
virtual ~QAccessibleInterface ()
 Destroys the object. More...
 

Private Functions

int logicalFromChild (QHeaderView *header, int child) const
 
QString text_helper (int child) const
 
int treeLevel () const
 
QHeaderViewverticalHeader () const
 

Static Private Functions

static QAbstractItemView::CursorAction toCursorAction (Relation rel)
 

Properties

bool m_header
 
QPersistentModelIndex row
 
QPointer< QAbstractItemViewview
 

Friends

class QAccessibleItemView
 

Additional Inherited Members

- Public Types inherited from QAccessible
enum  Action {
  DefaultAction = 0, Press = -1, FirstStandardAction = Press, SetFocus = -2,
  Increase = -3, Decrease = -4, Accept = -5, Cancel = -6,
  Select = -7, ClearSelection = -8, RemoveSelection = -9, ExtendSelection = -10,
  AddToSelection = -11, LastStandardAction = AddToSelection
}
 This enum describes the possible types of action that can occur. More...
 
enum  Event {
  SoundPlayed = 0x0001, Alert = 0x0002, ForegroundChanged = 0x0003, MenuStart = 0x0004,
  MenuEnd = 0x0005, PopupMenuStart = 0x0006, PopupMenuEnd = 0x0007, ContextHelpStart = 0x000C,
  ContextHelpEnd = 0x000D, DragDropStart = 0x000E, DragDropEnd = 0x000F, DialogStart = 0x0010,
  DialogEnd = 0x0011, ScrollingStart = 0x0012, ScrollingEnd = 0x0013, MenuCommand = 0x0018,
  ActionChanged = 0x0101, ActiveDescendantChanged = 0x0102, AttributeChanged = 0x0103, DocumentContentChanged = 0x0104,
  DocumentLoadComplete = 0x0105, DocumentLoadStopped = 0x0106, DocumentReload = 0x0107, HyperlinkEndIndexChanged = 0x0108,
  HyperlinkNumberOfAnchorsChanged = 0x0109, HyperlinkSelectedLinkChanged = 0x010A, HypertextLinkActivated = 0x010B, HypertextLinkSelected = 0x010C,
  HyperlinkStartIndexChanged = 0x010D, HypertextChanged = 0x010E, HypertextNLinksChanged = 0x010F, ObjectAttributeChanged = 0x0110,
  PageChanged = 0x0111, SectionChanged = 0x0112, TableCaptionChanged = 0x0113, TableColumnDescriptionChanged = 0x0114,
  TableColumnHeaderChanged = 0x0115, TableModelChanged = 0x0116, TableRowDescriptionChanged = 0x0117, TableRowHeaderChanged = 0x0118,
  TableSummaryChanged = 0x0119, TextAttributeChanged = 0x011A, TextCaretMoved = 0x011B, TextColumnChanged = 0x011D,
  TextInserted = 0x011E, TextRemoved = 0x011F, TextUpdated = 0x0120, TextSelectionChanged = 0x0121,
  VisibleDataChanged = 0x0122, ObjectCreated = 0x8000, ObjectDestroyed = 0x8001, ObjectShow = 0x8002,
  ObjectHide = 0x8003, ObjectReorder = 0x8004, Focus = 0x8005, Selection = 0x8006,
  SelectionAdd = 0x8007, SelectionRemove = 0x8008, SelectionWithin = 0x8009, StateChanged = 0x800A,
  LocationChanged = 0x800B, NameChanged = 0x800C, DescriptionChanged = 0x800D, ValueChanged = 0x800E,
  ParentChanged = 0x800F, HelpChanged = 0x80A0, DefaultActionChanged = 0x80B0, AcceleratorChanged = 0x80C0
}
 This enum type defines accessible event types. More...
 
typedef QAccessibleInterface *(* InterfaceFactory) (const QString &key, QObject *)
 This is a typedef for a pointer to a function with the following signature: More...
 
enum  Method {
  ListSupportedMethods = 0, SetCursorPosition = 1, GetCursorPosition = 2, ForegroundColor = 3,
  BackgroundColor = 4
}
 This enum describes the possible types of methods that can be invoked on an accessible object. More...
 
enum  RelationFlag {
  Unrelated = 0x00000000, Self = 0x00000001, Ancestor = 0x00000002, Child = 0x00000004,
  Descendent = 0x00000008, Sibling = 0x00000010, HierarchyMask = 0x000000ff, Up = 0x00000100,
  Down = 0x00000200, Left = 0x00000400, Right = 0x00000800, Covers = 0x00001000,
  Covered = 0x00002000, GeometryMask = 0x0000ff00, FocusChild = 0x00010000, Label = 0x00020000,
  Labelled = 0x00040000, Controller = 0x00080000, Controlled = 0x00100000, LogicalMask = 0x00ff0000
}
 This enum type defines bit flags that can be combined to indicate the relationship between two accessible objects. More...
 
enum  Role {
  NoRole = 0x00000000, TitleBar = 0x00000001, MenuBar = 0x00000002, ScrollBar = 0x00000003,
  Grip = 0x00000004, Sound = 0x00000005, Cursor = 0x00000006, Caret = 0x00000007,
  AlertMessage = 0x00000008, Window = 0x00000009, Client = 0x0000000A, PopupMenu = 0x0000000B,
  MenuItem = 0x0000000C, ToolTip = 0x0000000D, Application = 0x0000000E, Document = 0x0000000F,
  Pane = 0x00000010, Chart = 0x00000011, Dialog = 0x00000012, Border = 0x00000013,
  Grouping = 0x00000014, Separator = 0x00000015, ToolBar = 0x00000016, StatusBar = 0x00000017,
  Table = 0x00000018, ColumnHeader = 0x00000019, RowHeader = 0x0000001A, Column = 0x0000001B,
  Row = 0x0000001C, Cell = 0x0000001D, Link = 0x0000001E, HelpBalloon = 0x0000001F,
  Assistant = 0x00000020, List = 0x00000021, ListItem = 0x00000022, Tree = 0x00000023,
  TreeItem = 0x00000024, PageTab = 0x00000025, PropertyPage = 0x00000026, Indicator = 0x00000027,
  Graphic = 0x00000028, StaticText = 0x00000029, EditableText = 0x0000002A, PushButton = 0x0000002B,
  CheckBox = 0x0000002C, RadioButton = 0x0000002D, ComboBox = 0x0000002E, ProgressBar = 0x00000030,
  Dial = 0x00000031, HotkeyField = 0x00000032, Slider = 0x00000033, SpinBox = 0x00000034,
  Canvas = 0x00000035, Animation = 0x00000036, Equation = 0x00000037, ButtonDropDown = 0x00000038,
  ButtonMenu = 0x00000039, ButtonDropGrid = 0x0000003A, Whitespace = 0x0000003B, PageTabList = 0x0000003C,
  Clock = 0x0000003D, Splitter = 0x0000003E, LayeredPane = 0x0000003F, Terminal = 0x00000040,
  Desktop = 0x00000041, UserRole = 0x0000ffff
}
 This enum defines the role of an accessible object. More...
 
typedef void(* RootObjectHandler) (QObject *)
 A function pointer type. More...
 
enum  StateFlag {
  Normal = 0x00000000, Unavailable = 0x00000001, Selected = 0x00000002, Focused = 0x00000004,
  Pressed = 0x00000008, Checked = 0x00000010, Mixed = 0x00000020, ReadOnly = 0x00000040,
  HotTracked = 0x00000080, DefaultButton = 0x00000100, Expanded = 0x00000200, Collapsed = 0x00000400,
  Busy = 0x00000800, Marqueed = 0x00002000, Animated = 0x00004000, Invisible = 0x00008000,
  Offscreen = 0x00010000, Sizeable = 0x00020000, Movable = 0x00040000, SelfVoicing = 0x00080000,
  Focusable = 0x00100000, Selectable = 0x00200000, Linked = 0x00400000, Traversed = 0x00800000,
  MultiSelectable = 0x01000000, ExtSelectable = 0x02000000, Protected = 0x20000000, HasPopup = 0x40000000,
  Modal = 0x80000000, HasInvokeExtension = 0x10000000
}
 This enum type defines bit flags that can be combined to indicate the state of an accessible object. More...
 
enum  Text {
  Name = 0, Description, Value, Help,
  Accelerator, UserText = 0x0000ffff
}
 This enum specifies string information that an accessible object returns. More...
 
typedef void(* UpdateHandler) (QObject *, int who, Event reason)
 A function pointer type. More...
 
- Static Public Functions inherited from QAccessible
static void cleanup ()
 
static void initialize ()
 
static void installFactory (InterfaceFactory)
 Installs the InterfaceFactory factory. More...
 
static RootObjectHandler installRootObjectHandler (RootObjectHandler)
 Installs the given handler as the function to be used by setRootObject(), and returns the previously installed handler. More...
 
static UpdateHandler installUpdateHandler (UpdateHandler)
 Installs the given handler as the function to be used by updateAccessibility(), and returns the previously installed handler. More...
 
static bool isActive ()
 Returns true if an accessibility implementation has been requested during the runtime of the application; otherwise returns false. More...
 
static QAccessibleInterfacequeryAccessibleInterface (QObject *)
 If a QAccessibleInterface implementation exists for the given object, this function returns a pointer to the implementation; otherwise it returns 0. More...
 
static void removeFactory (InterfaceFactory)
 Removes factory from the list of installed InterfaceFactories. More...
 
static void setRootObject (QObject *)
 Sets the root accessible object of this application to object. More...
 
static void updateAccessibility (QObject *, int who, Event reason)
 Notifies accessibility clients about a change in object's accessibility information. More...
 

Detailed Description

Definition at line 123 of file complexwidgets.h.

Constructors and Destructors

◆ QAccessibleItemRow()

QAccessibleItemRow::QAccessibleItemRow ( QAbstractItemView view,
const QModelIndex index = QModelIndex(),
bool  isHeader = false 
)

Definition at line 99 of file complexwidgets.cpp.

Referenced by navigate().

100  : row(index), view(aView), m_header(isHeader)
101 {
102 }
QPointer< QAbstractItemView > view
QPersistentModelIndex row

Functions

◆ actionText()

QString QAccessibleItemRow::actionText ( int  action,
Text  t,
int  child 
) const
virtual

Returns the text property t of the action action supported by the object, or of the object's child if child is not 0.

See also
text(), userActionCount()

Implements QAccessibleInterface.

Definition at line 652 of file complexwidgets.cpp.

653 {
654  return QString();
655 }
The QString class provides a Unicode character string.
Definition: qstring.h:83

◆ childAt()

int QAccessibleItemRow::childAt ( int  x,
int  y 
) const
virtual

Returns the 1-based index of the child that contains the screen coordinates (x, y).

This function returns 0 if the point is positioned on the object itself. If the tested point is outside the boundaries of the object this function returns -1.

This function is only relyable for visible objects (invisible object might not be laid out correctly).

All visual objects provide this information.

See also
rect()

Implements QAccessibleInterface.

Definition at line 452 of file complexwidgets.cpp.

453 {
454  if (!view || !view->isVisible())
455  return -1;
456 
457  for (int i = childCount(); i >= 0; --i) {
458  if (rect(i).contains(x, y))
459  return i;
460  }
461  return -1;
462 }
bool isVisible() const
Definition: qwidget.h:1005
QRect rect(int child) const
Returns the geometry of the object, or of the object&#39;s child if child is not 0.
QPointer< QAbstractItemView > view
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
Definition: qrect.cpp:1101
int childCount() const
Returns the number of children that belong to this object.

◆ childCount()

int QAccessibleItemRow::childCount ( ) const
virtual

Returns the number of children that belong to this object.

A child can provide accessibility information on its own (e.g. a child widget), or be a sub-element of this accessible object.

All objects provide this information.

See also
indexOfChild()

Implements QAccessibleInterface.

Definition at line 408 of file complexwidgets.cpp.

Referenced by childAt(), and navigate().

409 {
410  int count = 0;
411  if (QHeaderView *header = horizontalHeader()) {
412  count = header->count() - header->hiddenSectionCount();
413  } else {
414  count = children().count();
415  }
416 #ifndef QT_NO_TABLEVIEW
417  if (qobject_cast<const QTableView*>(view)) {
418  if (verticalHeader())
419  ++count;
420  }
421 #endif
422  return count;
423 }
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
QList< QModelIndex > children() const
QPointer< QAbstractItemView > view
QHeaderView * verticalHeader() const
QHeaderView * horizontalHeader() const
The QHeaderView class provides a header row or header column for item views.
Definition: qheaderview.h:58

◆ childIndex()

QModelIndex QAccessibleItemRow::childIndex ( int  child) const

Definition at line 379 of file complexwidgets.cpp.

Referenced by doAction(), rect(), setText(), state(), text(), and text_helper().

380 {
381  QList<QModelIndex> kids = children();
382  Q_ASSERT(child >= 1 && child <= kids.count());
383  return kids.at(child - 1);
384 }
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QList< QModelIndex > children() const
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468

◆ children()

QList< QModelIndex > QAccessibleItemRow::children ( ) const

Definition at line 386 of file complexwidgets.cpp.

Referenced by childCount(), childIndex(), indexOfChild(), navigate(), setText(), text(), and text_helper().

387 {
388  QList<QModelIndex> kids;
389  for (int i = 0; i < row.model()->columnCount(row.parent()); ++i) {
390  QModelIndex idx = row.model()->index(row.row(), i, row.parent());
391  if (!view->isIndexHidden(idx)) {
392  kids << idx;
393  }
394  }
395  return kids;
396 }
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of columns for the children of the given parent.
int row() const
Returns the row this persistent model index refers to.
virtual bool isIndexHidden(const QModelIndex &index) const =0
Returns true if the item referred to by the given index is hidden in the view, otherwise returns fals...
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const =0
Returns the index of the item in the model specified by the given row, column and parent index...
const QAbstractItemModel * model() const
Returns the model that the index belongs to.
QModelIndex parent() const
Returns the parent QModelIndex for this persistent index, or an invalid QModelIndex if it has no pare...
QPointer< QAbstractItemView > view
The QModelIndex class is used to locate data in a data model.
QPersistentModelIndex row

◆ doAction()

bool QAccessibleItemRow::doAction ( int  action,
int  child,
const QVariantList params = QVariantList() 
)
virtual

Asks the object, or the object's child if child is not 0, to execute action using the parameters, params.

Returns true if the action could be executed; otherwise returns false.

action can be a predefined or a custom action.

See also
userActionCount(), actionText()

Implements QAccessibleInterface.

Definition at line 663 of file complexwidgets.cpp.

664 {
665  if (!view)
666  return false;
667 
668  if (verticalHeader())
669  --child;
670 
671  QModelIndex idx = child ? childIndex(child) : QModelIndex(row);
672  if (!idx.isValid())
673  return false;
674 
675  QItemSelectionModel::SelectionFlags command = QItemSelectionModel::NoUpdate;
676 
677  switch (action) {
678  case SetFocus:
679  view->setCurrentIndex(idx);
680  return true;
681  case ExtendSelection:
682  if (!child)
683  return false;
686  return true;
687  case Select:
689  break;
690  case ClearSelection:
691  command = QItemSelectionModel::Clear;
692  break;
693  case RemoveSelection:
695  break;
696  case AddToSelection:
698  break;
699  }
700  if (command == QItemSelectionModel::NoUpdate)
701  return false;
702 
703  if (child)
704  view->selectionModel()->select(idx, command);
705  else
706  view->selectionModel()->select(rowAt(row), command);
707  return true;
708 }
static QItemSelection rowAt(const QModelIndex &idx)
QModelIndex childIndex(int child) const
QItemSelectionModel * selectionModel() const
Returns the current selection model.
void setCurrentIndex(const QModelIndex &index)
Sets the current item to be the item at index.
QPointer< QAbstractItemView > view
QModelIndex currentIndex() const
Returns the model index of the current item.
QHeaderView * verticalHeader() const
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
The QItemSelection class manages information about selected items in a model.
virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
Selects the model item index using the specified command, and emits selectionChanged().
The QModelIndex class is used to locate data in a data model.
QPersistentModelIndex row

◆ horizontalHeader()

QHeaderView * QAccessibleItemRow::horizontalHeader ( ) const

Definition at line 104 of file complexwidgets.cpp.

Referenced by childCount(), QAccessibleItemView::indexOfChild(), rect(), role(), state(), and text_helper().

105 {
106  QHeaderView *header = 0;
107  if (m_header) {
108  if (false) {
109 #ifndef QT_NO_TABLEVIEW
110  } else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
111  header = tv->horizontalHeader();
112 #endif
113 #ifndef QT_NO_TREEVIEW
114  } else if (const QTreeView *tv = qobject_cast<const QTreeView*>(view)) {
115  header = tv->header();
116 #endif
117  }
118  }
119  return header;
120 }
The QTreeView class provides a default model/view implementation of a tree view.
Definition: qtreeview.h:58
QPointer< QAbstractItemView > view
The QTableView class provides a default model/view implementation of a table view.
Definition: qtableview.h:58
The QHeaderView class provides a header row or header column for item views.
Definition: qheaderview.h:58

◆ indexOfChild()

int QAccessibleItemRow::indexOfChild ( const QAccessibleInterface child) const
virtual

Returns the 1-based index of the object child in this object's children list, or -1 if child is not a child of this object.

0 is not a possible return value.

All objects provide this information about their children.

See also
childCount()

Implements QAccessibleInterface.

Definition at line 425 of file complexwidgets.cpp.

426 {
427  if (!iface || iface->role(0) != Row)
428  return -1;
429 
430  //### meaningless code?
431  QList<QModelIndex> kids = children();
432  QModelIndex idx = static_cast<const QAccessibleItemRow *>(iface)->row;
433  if (!idx.isValid())
434  return -1;
435  return kids.indexOf(idx) + 1;
436 }
QList< QModelIndex > children() const
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
Definition: qlist.h:847
The QModelIndex class is used to locate data in a data model.
QPersistentModelIndex row

◆ isValid()

bool QAccessibleItemRow::isValid ( ) const
virtual

Returns true if all the data necessary to use this interface implementation is valid (e.

g. all pointers are non-null); otherwise returns false.

See also
object()

Implements QAccessibleInterface.

Definition at line 398 of file complexwidgets.cpp.

Referenced by QAccessibleItemView::text().

399 {
400  return m_header ? true : row.isValid();
401 }
QPersistentModelIndex row
bool isValid() const
Returns true if this persistent model index is valid; otherwise returns false.

◆ logicalFromChild()

int QAccessibleItemRow::logicalFromChild ( QHeaderView header,
int  child 
) const
private

Definition at line 132 of file complexwidgets.cpp.

Referenced by rect(), and text_helper().

133 {
134  int logical = -1;
135  if (header->sectionsHidden()) {
136  int kid = 0;
137  for (int i = 0; i < header->count(); ++i) {
138  if (!header->isSectionHidden(i))
139  ++kid;
140  if (kid == child) {
141  logical = i;
142  break;
143  }
144  }
145  } else {
146  logical = child - 1;
147  }
148  return logical;
149 }
bool isSectionHidden(int logicalIndex) const
Returns true if the section specified by logicalIndex is explicitly hidden from the user; otherwise r...
bool sectionsHidden() const
int count() const
Returns the number of sections in the header.

◆ navigate()

int QAccessibleItemRow::navigate ( RelationFlag  relation,
int  index,
QAccessibleInterface **  iface 
) const
virtual

Navigates from this object to an object that has a relationship relation to this object, and returns the respective object in target.

It is the caller's responsibility to delete *target after use.

If an object is found, target is set to point to the object, and the index of the child of target is returned. The return value is 0 if target itself is the requested object. target is set to null if this object is the target object (i.e. the requested object is a handled by this object).

If no object is found target is set to null, and the return value is -1.

The entry parameter has two different meanings:

  • Hierarchical and Logical relationships – if multiple objects with the requested relationship exist entry specifies which one to return. entry is 1-based, e.g. use 1 to get the first (and possibly only) object with the requested relationship.

    The following code demonstrates how to use this function to navigate to the first child of an object:

    int targetChild = object->navigate(Accessible::Child, 1, &child);
    if (child) {
    // ...
    delete child;
    }
  • Geometric relationships – the index of the child from which to start navigating in the specified direction. entry can be 0 to navigate to a sibling of this object, or non-null to navigate within contained children that don't provide their own accessible information.

Note that the Descendent value for relation is not supported.

All objects support navigation.

See also
relationTo(), childCount()

Implements QAccessibleInterface.

Definition at line 483 of file complexwidgets.cpp.

Referenced by state().

485 {
486  *iface = 0;
487  if (!view)
488  return -1;
489 
490  switch (relation) {
491  case Ancestor: {
492  if (!index)
493  return -1;
495  if (index == 1) {
496  *iface = ancestor;
497  return 0;
498  } else if (index > 1) {
499  int ret = ancestor->navigate(Ancestor, index - 1, iface);
500  delete ancestor;
501  return ret;
502  }
503  }
504  case Child: {
505  if (!index)
506  return -1;
507  if (index < 1 && index > childCount())
508  return -1;
509 
510  return index;}
511  case Sibling:
512  if (index) {
513  QAccessibleInterface *ifaceParent = 0;
514  navigate(Ancestor, 1, &ifaceParent);
515  if (ifaceParent) {
516  int entry = ifaceParent->navigate(Child, index, iface);
517  delete ifaceParent;
518  return entry;
519  }
520  }
521  return -1;
522  case Up:
523  case Down:
524  case Left:
525  case Right: {
526  // This is in the "not so nice" category. In order to find out which item
527  // is geometrically around, we have to set the current index, navigate
528  // and restore the index as well as the old selection
529  view->setUpdatesEnabled(false);
530  const QModelIndex oldIdx = view->currentIndex();
531  QList<QModelIndex> kids = children();
532  const QModelIndex currentIndex = index ? kids.at(index - 1) : QModelIndex(row);
533  const QItemSelection oldSelection = view->selectionModel()->selection();
534  view->setCurrentIndex(currentIndex);
535  const QModelIndex idx = view->moveCursor(toCursorAction(relation), Qt::NoModifier);
536  view->setCurrentIndex(oldIdx);
538  view->setUpdatesEnabled(true);
539  if (!idx.isValid())
540  return -1;
541 
542  if (idx.parent() != row.parent() || idx.row() != row.row())
543  *iface = new QAccessibleItemRow(view, idx);
544  return index ? kids.indexOf(idx) + 1 : 0; }
545  default:
546  break;
547  }
548 
549  return -1;
550 }
int row() const
Returns the row this persistent model index refers to.
const QItemSelection selection() const
Returns the selection ranges stored in the selection model.
void setUpdatesEnabled(bool enable)
Definition: qwidget.cpp:7670
virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers)=0
Returns a QModelIndex object pointing to the next object in the view, based on the given cursorAction...
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
QList< QModelIndex > children() const
QWidget * viewport() const
Returns the viewport widget.
static QAbstractItemView::CursorAction toCursorAction(Relation rel)
friend class QAccessibleItemView
virtual int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const =0
Navigates from this object to an object that has a relationship relation to this object, and returns the respective object in target.
QItemSelectionModel * selectionModel() const
Returns the current selection model.
int row() const
Returns the row this model index refers to.
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
Navigates from this object to an object that has a relationship relation to this object, and returns the respective object in target.
QModelIndex parent() const
Returns the parent QModelIndex for this persistent index, or an invalid QModelIndex if it has no pare...
void setCurrentIndex(const QModelIndex &index)
Sets the current item to be the item at index.
QPointer< QAbstractItemView > view
int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
Navigates from this object to an object that has a relationship relation to this object, and returns the respective object in target.
QModelIndex currentIndex() const
Returns the model index of the current item.
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
The QItemSelection class manages information about selected items in a model.
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
Definition: qlist.h:847
The QAccessibleInterface class defines an interface that exposes information about accessible objects...
Definition: qaccessible.h:370
virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
Selects the model item index using the specified command, and emits selectionChanged().
int childCount() const
Returns the number of children that belong to this object.
The QModelIndex class is used to locate data in a data model.
quint16 index
QAccessibleItemRow(QAbstractItemView *view, const QModelIndex &index=QModelIndex(), bool isHeader=false)
QPersistentModelIndex row

◆ object()

QObject * QAccessibleItemRow::object ( ) const
virtual

Returns a pointer to the QObject this interface implementation provides information for.

See also
isValid()

Implements QAccessibleInterface.

Definition at line 403 of file complexwidgets.cpp.

404 {
405  return 0;
406 }

◆ rect()

QRect QAccessibleItemRow::rect ( int  child) const
virtual

Returns the geometry of the object, or of the object's child if child is not 0.

The geometry is in screen coordinates.

This function is only reliable for visible objects (invisible objects might not be laid out correctly).

All visual objects provide this information.

See also
childAt()

Implements QAccessibleInterface.

Definition at line 151 of file complexwidgets.cpp.

Referenced by childAt(), and state().

152 {
153  QRect r;
154  if (view && view->isVisible()) {
155  if (QHeaderView *header = horizontalHeader()) {
156  if (!child) {
157  r = header->rect();
158  } else {
159  if (QHeaderView *vheader = verticalHeader()) {
160  if (child == 1) {
161  int w = vheader->width();
162  int h = header->height();
163  r.setRect(0, 0, w, h);
164  }
165  --child;
166  }
167  if (child) {
168  int logical = logicalFromChild(header, child);
169  int w = header->sectionSize(logical);
170  r.setRect(header->sectionViewportPosition(logical), 0, w, header->height());
171  r.translate(header->mapTo(view, QPoint(0, 0)));
172  }
173  }
174  } else if (row.isValid()) {
175  if (!child) {
176  QModelIndex parent = row.parent();
177  const int colCount = row.model()->columnCount(parent);
178  for (int i = 0; i < colCount; ++i)
179  r |= view->visualRect(row.model()->index(row.row(), i, parent));
180  r.translate(view->viewport()->mapTo(view, QPoint(0,0)));
181 
182  if (const QHeaderView *vheader = verticalHeader()) { // include the section of the vertical header
183  QRect re;
184  int logicalRow = row.row();
185  int h = vheader->sectionSize(logicalRow);
186  re.setRect(0, vheader->sectionViewportPosition(logicalRow), vheader->width(), h);
187  re.translate(vheader->mapTo(view, QPoint(0, 0)));
188  r |= re;
189  }
190  } else {
191  if (QHeaderView *vheader = verticalHeader()) {
192  if (child == 1) {
193  int logicalRow = row.row();
194  int h = vheader->sectionSize(logicalRow);
195  r.setRect(0, vheader->sectionViewportPosition(logicalRow), vheader->width(), h);
196  r.translate(vheader->mapTo(view, QPoint(0, 0)));
197  }
198  --child;
199  }
200  if (child) {
201  r = view->visualRect(childIndex(child));
202  r.translate(view->viewport()->mapTo(view, QPoint(0,0)));
203  }
204  }
205  }
206  }
207  if (!r.isNull())
208  r.translate(view->mapToGlobal(QPoint(0, 0)));
209 
210  return r;
211 }
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of columns for the children of the given parent.
int row() const
Returns the row this persistent model index refers to.
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
Definition: qrect.h:231
QPoint mapTo(QWidget *, const QPoint &) const
Translates the widget coordinate pos to the coordinate system of parent.
Definition: qwidget.cpp:4409
virtual QRect visualRect(const QModelIndex &index) const =0
Returns the rectangle on the viewport occupied by the item at index.
bool isVisible() const
Definition: qwidget.h:1005
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
QModelIndex childIndex(int child) const
int logicalFromChild(QHeaderView *header, int child) const
QWidget * viewport() const
Returns the viewport widget.
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const =0
Returns the index of the item in the model specified by the given row, column and parent index...
const QAbstractItemModel * model() const
Returns the model that the index belongs to.
QModelIndex parent() const
Returns the parent QModelIndex for this persistent index, or an invalid QModelIndex if it has no pare...
QPointer< QAbstractItemView > view
QHeaderView * verticalHeader() const
void setRect(int x, int y, int w, int h)
Sets the coordinates of the rectangle&#39;s top-left corner to ({x}, {y}), and its size to the given widt...
Definition: qrect.h:400
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QModelIndex class is used to locate data in a data model.
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QHeaderView * horizontalHeader() const
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
Definition: qrect.h:312
QPersistentModelIndex row
QPoint mapToGlobal(const QPoint &) const
Translates the widget coordinate pos to global screen coordinates.
The QHeaderView class provides a header row or header column for item views.
Definition: qheaderview.h:58
bool isValid() const
Returns true if this persistent model index is valid; otherwise returns false.

◆ relationTo()

QAccessible::Relation QAccessibleItemRow::relationTo ( int  child,
const QAccessibleInterface other,
int  otherChild 
) const
virtual

Returns the relationship between this object's \a child and the \a
other object's \a otherChild.

If child is 0 the object's own relation is returned.

The returned value indicates the relation of the called object to the other object, e.g. if this object is a child of other the return value will be Child.

The return value is a combination of the bit flags in the QAccessible::Relation enumeration.

All objects provide this information.

See also
indexOfChild(), navigate()

Implements QAccessibleInterface.

Definition at line 438 of file complexwidgets.cpp.

440 {
441  if (!child && !otherChild && other->object() == view)
442  return Child;
443  if (!child && !otherChild && other == this)
444  return Self;
445  if (!child && otherChild && other == this)
446  return Ancestor;
447  if (child && otherChild && other == this)
448  return Sibling;
449  return Unrelated;
450 }
virtual QObject * object() const =0
Returns a pointer to the QObject this interface implementation provides information for...
QPointer< QAbstractItemView > view

◆ role()

QAccessible::Role QAccessibleItemRow::role ( int  child) const
virtual

Returns the role of the object, or of the object's child if child is not 0.

The role of an object is usually static.

All accessible objects have a role.

See also
text(), state()

Implements QAccessibleInterface.

Definition at line 552 of file complexwidgets.cpp.

553 {
554  if (false) {
555 #ifndef QT_NO_TREEVIEW
556  } else if (qobject_cast<const QTreeView*>(view)) {
557  if (horizontalHeader()) {
558  if (!child)
559  return Row;
560  return ColumnHeader;
561  }
562  return TreeItem;
563 #endif
564 #ifndef QT_NO_LISTVIEW
565  } else if (qobject_cast<const QListView*>(view)) {
566  return ListItem;
567 #endif
568 #ifndef QT_NO_TABLEVIEW
569  } else if (qobject_cast<const QTableView *>(view)) {
570  if (!child)
571  return Row;
572  if (child == 1) {
573  if (verticalHeader())
574  return RowHeader;
575  }
576  if (m_header)
577  return ColumnHeader;
578 #endif
579  }
580  return Cell;
581 }
QPointer< QAbstractItemView > view
QHeaderView * verticalHeader() const
QHeaderView * horizontalHeader() const

◆ setText()

void QAccessibleItemRow::setText ( Text  t,
int  child,
const QString text 
)
virtual

Sets the text property t of the object, or of the object's child if child is not 0, to text.

Note that the text properties of most objects are read-only.

See also
text()

Implements QAccessibleInterface.

Definition at line 340 of file complexwidgets.cpp.

Referenced by QAccessibleItemView::setText().

341 {
342  if (m_header) {
343  if (child)
344  view->model()->setHeaderData(child - 1, Qt::Horizontal, text);
345  // child == 0 means the cell to the left of the horizontal header, which is empty!?
346  } else {
347  if (!child) {
348  if (children().count() == 1)
349  child = 1;
350  else
351  return;
352  }
353 
354  if (verticalHeader()) {
355  if (child == 1) {
357  return;
358  }
359  --child;
360  }
361  QModelIndex idx = childIndex(child);
362  if (!idx.isValid())
363  return;
364 
365  switch (t) {
366  case Description:
367  const_cast<QAbstractItemModel *>(idx.model())->setData(idx, text,
369  break;
370  case Value:
371  const_cast<QAbstractItemModel *>(idx.model())->setData(idx, text, Qt::EditRole);
372  break;
373  default:
374  break;
375  }
376  }
377 }
int row() const
Returns the row this persistent model index refers to.
QModelIndex childIndex(int child) const
QList< QModelIndex > children() const
static bool setData(const QByteArray &data, STGMEDIUM *pmedium)
Definition: qmime_win.cpp:141
const QAbstractItemModel * model() const
Returns a pointer to the model containing the item that this index refers to.
QPointer< QAbstractItemView > view
QHeaderView * verticalHeader() const
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
The QAbstractItemModel class provides the abstract interface for item model classes.
virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role=Qt::EditRole)
Sets the data for the given role and section in the header with the specified orientation to the valu...
The QModelIndex class is used to locate data in a data model.
QString text(Text t, int child) const
Returns the value of the text property t of the object, or of the object&#39;s child if child is not 0...
QAbstractItemModel * model() const
Returns the model that this view is presenting.
QPersistentModelIndex row

◆ state()

QAccessible::State QAccessibleItemRow::state ( int  child) const
virtual

Returns the current state of the object, or of the object's child if child is not 0.

The returned value is a combination of the flags in the QAccessible::StateFlag enumeration.

All accessible objects have a state.

See also
text(), role()

Implements QAccessibleInterface.

Definition at line 583 of file complexwidgets.cpp.

Referenced by QAccessibleItemView::state().

584 {
585  State st = Normal;
586 
587  if (!view)
588  return st;
589 
590  QAccessibleInterface *parent = 0;
591  QRect globalRect;
592  if (navigate(Ancestor, 1, &parent) == 0) {
593  globalRect = parent->rect(0);
594  delete parent;
595  }
596  if (!globalRect.intersects(rect(child)))
597  st |= Invisible;
598 
599  if (!horizontalHeader()) {
600  if (!(st & Invisible)) {
601  if (child) {
602  if (QHeaderView *vheader = verticalHeader() ) {
603  if (child == 1) {
604  if (!vheader->isVisible())
605  st |= Invisible;
606  }
607  --child;
608  }
609  if (child) {
610  QModelIndex idx = childIndex(child);
611  if (!idx.isValid())
612  return st;
613 
614  if (view->selectionModel()->isSelected(idx))
615  st |= Selected;
616  if (view->selectionModel()->currentIndex() == idx)
617  st |= Focused;
618  if (idx.model()->data(idx, Qt::CheckStateRole).toInt() == Qt::Checked)
619  st |= Checked;
620 
621  Qt::ItemFlags flags = idx.flags();
622  if (flags & Qt::ItemIsSelectable) {
623  st |= Selectable;
625  st |= MultiSelectable;
627  st |= ExtSelectable;
628  }
629  }
630  } else {
631  Qt::ItemFlags flags = row.flags();
632  if (flags & Qt::ItemIsSelectable) {
633  st |= Selectable;
634  st |= Focusable;
635  }
637  st |= Selected;
638  if (view->selectionModel()->currentIndex().row() == row.row())
639  st |= Focused;
640  }
641  }
642  }
643 
644  return st;
645 }
int row() const
Returns the row this persistent model index refers to.
QModelIndex childIndex(int child) const
SelectionMode selectionMode
which selection mode the view operates in
int toInt(bool *ok=0) const
Returns the variant as an int if the variant has type() Int , Bool , ByteArray , Char ...
Definition: qvariant.cpp:2625
QRect rect(int child) const
Returns the geometry of the object, or of the object&#39;s child if child is not 0.
QItemSelectionModel * selectionModel() const
Returns the current selection model.
bool isSelected(const QModelIndex &index) const
Returns true if the given model item index is selected.
int row() const
Returns the row this model index refers to.
const QAbstractItemModel * model() const
Returns a pointer to the model containing the item that this index refers to.
QModelIndex parent() const
Returns the parent QModelIndex for this persistent index, or an invalid QModelIndex if it has no pare...
QPointer< QAbstractItemView > view
int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
Navigates from this object to an object that has a relationship relation to this object, and returns the respective object in target.
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const =0
Returns the data stored under the given role for the item referred to by the index.
QModelIndex currentIndex() const
Returns the model item index for the current item, or an invalid index if there is no current item...
The State element defines configurations of objects and properties.
QHeaderView * verticalHeader() const
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
Qt::ItemFlags flags() const
Returns the flags for the item referred to by the index.
The QAccessibleInterface class defines an interface that exposes information about accessible objects...
Definition: qaccessible.h:370
#define st(var, type, card)
The QModelIndex class is used to locate data in a data model.
Qt::ItemFlags flags() const
Returns the flags for the item referred to by the index.
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
virtual QRect rect(int child) const =0
Returns the geometry of the object, or of the object&#39;s child if child is not 0.
QHeaderView * horizontalHeader() const
bool intersects(const QRect &r) const
Returns true if this rectangle intersects with the given rectangle (i.
Definition: qrect.cpp:1429
QPersistentModelIndex row
bool isRowSelected(int row, const QModelIndex &parent) const
Returns true if all items are selected in the row with the given parent.
The QHeaderView class provides a header row or header column for item views.
Definition: qheaderview.h:58

◆ text()

QString QAccessibleItemRow::text ( Text  t,
int  child 
) const
virtual

Returns the value of the text property t of the object, or of the object's child if child is not 0.

The Name is a string used by clients to identify, find, or announce an accessible object for the user. All objects must have a name that is unique within their container. The name can be used differently by clients, so the name should both give a short description of the object and be unique.

An accessible object's Description provides textual information about an object's visual appearance. The description is primarily used to provide greater context for vision-impaired users, but is also used for context searching or other applications. Not all objects have a description. An "OK" button would not need a description, but a tool button that shows a picture of a smiley would.

The Value of an accessible object represents visual information contained by the object, e.g. the text in a line edit. Usually, the value can be modified by the user. Not all objects have a value, e.g. static text labels don't, and some objects have a state that already is the value, e.g. toggle buttons.

The Help text provides information about the function and usage of an accessible object. Not all objects provide this information.

The Accelerator is a keyboard shortcut that activates the object's default action. A keyboard shortcut is the underlined character in the text of a menu, menu item or widget, and is either the character itself, or a combination of this character and a modifier key like Alt, Ctrl or Shift. Command controls like tool buttons also have shortcut keys and usually display them in their tooltip.

All objects provide a string for Name .

See also
role(), state()

Implements QAccessibleInterface.

Definition at line 271 of file complexwidgets.cpp.

Referenced by setText(), and QAccessibleItemView::text().

272 {
273  QString value;
274  if (t == Name) {
275  value = text_helper(child);
276  } else if (t == Value) {
277 #ifndef QT_NO_TREEVIEW
278  if (qobject_cast<const QTreeView*>(view)) {
279  if (child == 0)
280  value = QString::number(treeLevel());
281  } else
282 #endif
283  {
284  value = text_helper(child);
285  }
286  } else if (t == Description) {
287 #ifndef QT_NO_TREEVIEW
288  if (child == 0 && qobject_cast<const QTreeView*>(view)) {
289  // We store the tree coordinates of the current item in the description.
290  // This enables some screen readers to report where the focus is
291  // in a tree view. (works in JAWS). Also, Firefox does the same thing.
292  // For instance the description "L2, 4 of 25 with 24" means
293  // "L2": Tree Level 2
294  // "4 of 25": We are item 4 out of in total 25 other siblings
295  // "with 24": We have 24 children. (JAWS does not read this number)
296 
297  // level
298  int level = treeLevel();
299 
300  QAbstractItemModel *m = view->model();
301  // totalSiblings and itemIndex
302  QModelIndex parent = row.parent();
303  int rowCount = m->rowCount(parent);
304  int itemIndex = -1;
305  int totalSiblings = 0;
306  for (int i = 0 ; i < rowCount; ++i) {
307  QModelIndex sibling = row.sibling(i, 0);
308  if (!view->isIndexHidden(sibling))
309  ++totalSiblings;
310  if (row == sibling)
311  itemIndex = totalSiblings;
312  }
313  int totalChildren = m->rowCount(row); // JAWS does not report child count, so we do
314  // this simple and efficient.
315  // (don't check if they are all visible).
316  value = QString::fromAscii("L%1, %2 of %3 with %4").arg(level).arg(itemIndex).arg(totalSiblings).arg(totalChildren);
317  } else
318 #endif // QT_NO_TREEVIEW
319  {
320  if (!m_header) {
321  if (child == 0 && children().count() >= 1)
322  child = 1;
323  if (verticalHeader()) {
324  if (child == 1) {
325  value = view->model()->headerData(row.row(), Qt::Vertical).toString();
326  }
327  --child;
328  }
329  if (child) {
330  QModelIndex idx = childIndex(child);
331  value = idx.model()->data(idx, Qt::AccessibleDescriptionRole).toString();
332  }
333 
334  }
335  }
336  }
337  return value;
338 }
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qstring.cpp:6448
int row() const
Returns the row this persistent model index refers to.
QString text_helper(int child) const
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
Definition: qstring.cpp:4276
virtual bool isIndexHidden(const QModelIndex &index) const =0
Returns true if the item referred to by the given index is hidden in the view, otherwise returns fals...
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of rows under the given parent.
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
Definition: qvariant.cpp:2270
QModelIndex sibling(int row, int column) const
Returns the sibling at row and column or an invalid QModelIndex if there is no sibling at this positi...
The QString class provides a Unicode character string.
Definition: qstring.h:83
QModelIndex childIndex(int child) const
virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Returns the data for the given role and section in the header with the specified orientation.
QList< QModelIndex > children() const
static QString toString(Register *reg, int type, bool *ok=0)
const QAbstractItemModel * model() const
Returns a pointer to the model containing the item that this index refers to.
QModelIndex parent() const
Returns the parent QModelIndex for this persistent index, or an invalid QModelIndex if it has no pare...
QPointer< QAbstractItemView > view
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const =0
Returns the data stored under the given role for the item referred to by the index.
QHeaderView * verticalHeader() const
The QAbstractItemModel class provides the abstract interface for item model classes.
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
The QModelIndex class is used to locate data in a data model.
QAbstractItemModel * model() const
Returns the model that this view is presenting.
QPersistentModelIndex row

◆ text_helper()

QString QAccessibleItemRow::text_helper ( int  child) const
private

Definition at line 224 of file complexwidgets.cpp.

Referenced by text().

225 {
226  QString value;
227  if (m_header) {
228  if (!child)
229  return QString();
230  if (verticalHeader()) {
231  if (child == 1)
232  return QString();
233  --child;
234  }
235  QHeaderView *header = horizontalHeader();
236  int logical = logicalFromChild(header, child);
238  if (value.isEmpty())
239  value = view->model()->headerData(logical, Qt::Horizontal).toString();
240  return value;
241  } else {
242  if (!child) { // for one-column views (i.e. QListView)
243  if (children().count() >= 1)
244  child = 1;
245  else
246  return QString();
247  }
248  if (verticalHeader()) {
249  if (child == 1) {
250  int logical = row.row();
252  if (value.isEmpty())
253  value = view->model()->headerData(logical, Qt::Vertical).toString();
254  return value;
255  } else {
256  --child;
257  }
258  }
259  }
260  if (value.isEmpty()) {
261  QModelIndex idx = childIndex(child);
262  if (idx.isValid()) {
263  value = idx.model()->data(idx, Qt::AccessibleTextRole).toString();
264  if (value.isEmpty())
265  value = idx.model()->data(idx, Qt::DisplayRole).toString();
266  }
267  }
268  return value;
269 }
int row() const
Returns the row this persistent model index refers to.
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
Definition: qvariant.cpp:2270
The QString class provides a Unicode character string.
Definition: qstring.h:83
QModelIndex childIndex(int child) const
virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Returns the data for the given role and section in the header with the specified orientation.
QList< QModelIndex > children() const
int logicalFromChild(QHeaderView *header, int child) const
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
const QAbstractItemModel * model() const
Returns a pointer to the model containing the item that this index refers to.
QPointer< QAbstractItemView > view
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const =0
Returns the data stored under the given role for the item referred to by the index.
QHeaderView * verticalHeader() const
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
The QModelIndex class is used to locate data in a data model.
QHeaderView * horizontalHeader() const
QAbstractItemModel * model() const
Returns the model that this view is presenting.
QPersistentModelIndex row
The QHeaderView class provides a header row or header column for item views.
Definition: qheaderview.h:58

◆ toCursorAction()

QAbstractItemView::CursorAction QAccessibleItemRow::toCursorAction ( Relation  rel)
staticprivate

Definition at line 464 of file complexwidgets.cpp.

Referenced by navigate().

◆ treeLevel()

int QAccessibleItemRow::treeLevel ( ) const
private

Definition at line 213 of file complexwidgets.cpp.

Referenced by text().

214 {
215  int level = 0;
216  QModelIndex idx = row;
217  while (idx.isValid()) {
218  idx = idx.parent();
219  ++level;
220  }
221  return level;
222 }
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
The QModelIndex class is used to locate data in a data model.
QPersistentModelIndex row

◆ userActionCount()

int QAccessibleItemRow::userActionCount ( int  child) const
virtual

Returns the number of custom actions of the object, or of the object's child if child is not 0.

The Action type enumerates predefined actions: these are not included in the returned value.

See also
actionText(), doAction()

Implements QAccessibleInterface.

Definition at line 647 of file complexwidgets.cpp.

648 {
649  return 0;
650 }

◆ verticalHeader()

QHeaderView * QAccessibleItemRow::verticalHeader ( ) const
private

Definition at line 122 of file complexwidgets.cpp.

Referenced by childCount(), doAction(), rect(), role(), setText(), state(), text(), and text_helper().

123 {
124  QHeaderView *header = 0;
125 #ifndef QT_NO_TABLEVIEW
126  if (const QTableView *tv = qobject_cast<const QTableView*>(view))
127  header = tv->verticalHeader();
128 #endif
129  return header;
130 }
QPointer< QAbstractItemView > view
The QTableView class provides a default model/view implementation of a table view.
Definition: qtableview.h:58
The QHeaderView class provides a header row or header column for item views.
Definition: qheaderview.h:58

Friends and Related Functions

◆ QAccessibleItemView

friend class QAccessibleItemView
friend

Definition at line 125 of file complexwidgets.h.

Referenced by navigate().

Properties

◆ m_header

bool QAccessibleItemRow::m_header
private

Definition at line 160 of file complexwidgets.h.

Referenced by horizontalHeader(), isValid(), role(), setText(), text(), and text_helper().

◆ row

QPersistentModelIndex QAccessibleItemRow::row
private

◆ view

QPointer<QAbstractItemView> QAccessibleItemRow::view
private

The documentation for this class was generated from the following files: