Qt 4.8
Public Functions | Protected Functions | Properties | Friends | List of all members
QAccessibleWidget Class Reference

The QAccessibleWidget class implements the QAccessibleInterface for QWidgets. More...

#include <qaccessiblewidget.h>

Inheritance diagram for QAccessibleWidget:
QAccessibleObject QAccessibleInterface QAccessible Q3AccessibleScrollView QAccessibleWidgetStack Q3AccessibleTextEdit QAccessibleIconView QAccessibleListBox QAccessibleListView

Public Functions

QString actionText (int action, Text t, int child) const
 Reimplemented Function More...
 
int childAt (int x, int y) const
 Reimplemented Function More...
 
int childCount () const
 Reimplemented Function More...
 
bool doAction (int action, int child, const QVariantList &params)
 Reimplemented Function More...
 
int indexOfChild (const QAccessibleInterface *child) const
 Reimplemented Function More...
 
int navigate (RelationFlag rel, int entry, QAccessibleInterface **target) const
 Reimplemented Function More...
 
 QAccessibleWidget (QWidget *o, Role r=Client, const QString &name=QString())
 Creates a QAccessibleWidget object for widget w. More...
 
QRect rect (int child) const
 Reimplemented Function More...
 
Relation relationTo (int child, const QAccessibleInterface *other, int otherChild) const
 Reimplemented Function More...
 
Role role (int child) const
 Reimplemented Function More...
 
State state (int child) const
 Reimplemented Function More...
 
QString text (Text t, int child) const
 Reimplemented Function More...
 
int userActionCount (int child) const
 Reimplemented Function More...
 
- Public Functions inherited from QAccessibleObject
bool isValid () const
 Reimplemented Function More...
 
QObjectobject () const
 Reimplemented Function More...
 
 QAccessibleObject (QObject *object)
 Creates a QAccessibleObject for object. More...
 
void setText (Text t, int child, const QString &text)
 Reimplemented Function 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...
 

Protected Functions

void addControllingSignal (const QString &signal)
 Registers signal as a controlling signal. More...
 
QObjectparentObject () const
 Returns the associated widget's parent object, which is either the parent widget, or qApp for top-level widgets. More...
 
void setAccelerator (const QString &accel)
 Sets the accelerator of this interface implementation to accel. More...
 
void setDescription (const QString &desc)
 Sets the description of this interface implementation to desc. More...
 
void setHelp (const QString &help)
 Sets the help of this interface implementation to help. More...
 
void setValue (const QString &value)
 Sets the value of this interface implementation to value. More...
 
QWidgetwidget () const
 Returns the associated widget. More...
 
 ~QAccessibleWidget ()
 Destroys this object. More...
 
- Protected Functions inherited from QAccessibleObject
virtual ~QAccessibleObject ()
 Destroys the QAccessibleObject. More...
 

Properties

QAccessibleWidgetPrivated
 

Friends

class QAccessibleWidgetEx
 

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

The QAccessibleWidget class implements the QAccessibleInterface for QWidgets.

This class is convenient to use as a base class for custom implementations of QAccessibleInterfaces that provide information about widget objects.

The class provides functions to retrieve the parentObject() (the widget's parent widget), and the associated widget(). Controlling signals can be added with addControllingSignal(), and setters are provided for various aspects of the interface implementation, for example setValue(), setDescription(), setAccelerator(), and setHelp().

See also
QAccessible, QAccessibleObject

Definition at line 57 of file qaccessiblewidget.h.

Constructors and Destructors

◆ QAccessibleWidget()

QAccessibleWidget::QAccessibleWidget ( QWidget w,
Role  role = Client,
const QString name = QString() 
)
explicit

Creates a QAccessibleWidget object for widget w.

role and name are optional parameters that set the object's role and name properties.

Definition at line 199 of file qaccessiblewidget.cpp.

201 {
202  Q_ASSERT(widget());
203  d = new QAccessibleWidgetPrivate();
204  d->role = role;
205  d->name = name;
206  d->asking = 0;
207 }
QAccessibleWidgetPrivate * d
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QWidget * widget() const
Returns the associated widget.
QAccessibleObject(QObject *object)
Creates a QAccessibleObject for object.
const QAccessibleInterface * asking
const char * name
Role role(int child) const
Reimplemented Function

◆ ~QAccessibleWidget()

QAccessibleWidget::~QAccessibleWidget ( )
protected

Destroys this object.

Definition at line 212 of file qaccessiblewidget.cpp.

213 {
214  delete d;
215 }
QAccessibleWidgetPrivate * d

Functions

◆ actionText()

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

Reimplemented Function

Reimplemented from QAccessibleObject.

Definition at line 878 of file qaccessiblewidget.cpp.

Referenced by QAccessibleWidgetEx::actionText().

879 {
880  if (action == DefaultAction)
881  action = SetFocus;
882 
883  if (action > 0 && !child) {
884  QAction *act = widget()->actions().value(action - 1);
885  if (act) {
886  switch (t) {
887  case Name:
888  return act->text();
889  case Description:
890  return act->toolTip();
891 #ifndef QT_NO_SHORTCUT
892  case Accelerator:
893  return act->shortcut().toString();
894 #endif
895  default:
896  break;
897  }
898  }
899  }
900 
901  return QAccessibleObject::actionText(action, t, child);
902 }
QKeySequence shortcut
the action&#39;s primary shortcut key
Definition: qaction.h:83
QString text
the action&#39;s descriptive text
Definition: qaction.h:76
QWidget * widget() const
Returns the associated widget.
QString toString(SequenceFormat format=PortableText) const
Return a string representation of the key sequence, based on format.
T value(int i) const
Returns the value at index position i in the list.
Definition: qlist.h:661
QString toolTip
the action&#39;s tooltip
Definition: qaction.h:78
QString actionText(int action, Text t, int child) const
Reimplemented Function
QList< QAction * > actions() const
Returns the (possibly empty) list of this widget&#39;s actions.
Definition: qwidget.cpp:3407
The QAction class provides an abstract user interface action that can be inserted into widgets...
Definition: qaction.h:64

◆ addControllingSignal()

void QAccessibleWidget::addControllingSignal ( const QString signal)
protected

Registers signal as a controlling signal.

An object is a Controller to any other object connected to a controlling signal.

Definition at line 307 of file qaccessiblewidget.cpp.

Referenced by QAccessibleWidgetEx::addControllingSignal().

308 {
310  if (object()->metaObject()->indexOfSignal(s) < 0)
311  qWarning("Signal %s unknown in %s", s.constData(), object()->metaObject()->className());
313 }
QAccessibleWidgetPrivate * d
static QByteArray normalizedSignature(const char *method)
Normalizes the signature of the given method.
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
Q_CORE_EXPORT void qWarning(const char *,...)
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
const char * className() const
Returns the class name.
Definition: qobjectdefs.h:491
QByteArray toAscii() const Q_REQUIRED_RESULT
Returns an 8-bit representation of the string as a QByteArray.
Definition: qstring.cpp:4014
QObject * object() const
Reimplemented Function
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.

◆ childAt()

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

Reimplemented Function

Implements QAccessibleInterface.

Reimplemented in QAccessibleWidgetStack.

Definition at line 238 of file qaccessiblewidget.cpp.

Referenced by QAccessibleWidgetEx::childAt().

239 {
240  QWidget *w = widget();
241  if (!w->isVisible())
242  return -1;
243  QPoint gp = w->mapToGlobal(QPoint(0, 0));
244  if (!QRect(gp.x(), gp.y(), w->width(), w->height()).contains(x, y))
245  return -1;
246 
247  QWidgetList list = childWidgets(w);
248  int ccount = childCount();
249 
250  // a complex child
251  if (list.size() < ccount) {
252  for (int i = 1; i <= ccount; ++i) {
253  if (rect(i).contains(x, y))
254  return i;
255  }
256  return 0;
257  }
258 
259  QPoint rp = w->mapFromGlobal(QPoint(x, y));
260  for (int i = 0; i<list.size(); ++i) {
261  QWidget *child = list.at(i);
262  if (!child->isWindow() && !child->isHidden() && child->geometry().contains(rp)) {
263  return i + 1;
264  }
265  }
266  return 0;
267 }
int width
the width of the widget excluding any window frame
Definition: qwidget.h:166
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
int childCount() const
Reimplemented Function
bool isVisible() const
Definition: qwidget.h:1005
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QWidget * widget() const
Returns the associated widget.
static QList< QWidget * > childWidgets(const QWidget *widget)
bool isHidden() const
Returns true if the widget is hidden, otherwise returns false.
Definition: qwidget.h:1008
QRect rect(int child) const
Reimplemented Function
int height
the height of the widget excluding any window frame
Definition: qwidget.h:167
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
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
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
QRect geometry
the geometry of the widget relative to its parent and excluding the window frame
Definition: qwidget.h:158
QPoint mapToGlobal(const QPoint &) const
Translates the widget coordinate pos to global screen coordinates.
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ childCount()

int QAccessibleWidget::childCount ( ) const
virtual

Reimplemented Function

Implements QAccessibleInterface.

Reimplemented in QAccessibleWidgetStack.

Definition at line 795 of file qaccessiblewidget.cpp.

Referenced by childAt(), QAccessibleWidgetEx::childCount(), and navigate().

796 {
798  return cl.size();
799 }
QWidget * widget() const
Returns the associated widget.
static QList< QWidget * > childWidgets(const QWidget *widget)
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ doAction()

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

Reimplemented Function

Reimplemented from QAccessibleObject.

Definition at line 905 of file qaccessiblewidget.cpp.

Referenced by QAccessibleWidgetEx::doAction().

906 {
907  if (action == SetFocus || action == DefaultAction) {
908  if (child || !widget()->isEnabled())
909  return false;
910 
911  if ((widget()->focusPolicy() == Qt::NoFocus) && (!widget()->isWindow()))
912  return false;
913 
914  if (!widget()->isWindow())
915  widget()->setFocus();
916 
917  widget()->activateWindow();
918 
919  return true;
920  } else if (action > 0) {
921  if (QAction *act = widget()->actions().value(action - 1)) {
922  act->trigger();
923  return true;
924  }
925  }
926  return QAccessibleObject::doAction(action, child, params);
927 }
QWidget * widget() const
Returns the associated widget.
bool doAction(int action, int child, const QVariantList &params)
Reimplemented Function
void setFocus()
Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its paren...
Definition: qwidget.h:432
void activateWindow()
Sets the top-level widget containing this widget to be the active window.
The QAction class provides an abstract user interface action that can be inserted into widgets...
Definition: qaction.h:64

◆ indexOfChild()

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

Reimplemented Function

Implements QAccessibleInterface.

Reimplemented in QAccessibleWidgetStack.

Definition at line 802 of file qaccessiblewidget.cpp.

Referenced by QAccessibleWidgetEx::indexOfChild().

803 {
805  int index = cl.indexOf(qobject_cast<QWidget *>(child->object()));
806  if (index != -1)
807  ++index;
808  return index;
809 }
virtual QObject * object() const =0
Returns a pointer to the QObject this interface implementation provides information for...
QWidget * widget() const
Returns the associated widget.
static QList< QWidget * > childWidgets(const QWidget *widget)
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
quint16 index
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ navigate()

int QAccessibleWidget::navigate ( RelationFlag  rel,
int  entry,
QAccessibleInterface **  target 
) const
virtual

Reimplemented Function

Implements QAccessibleInterface.

Reimplemented in QAccessibleWidgetStack.

Definition at line 470 of file qaccessiblewidget.cpp.

Referenced by QAccessibleWidgetEx::navigate(), and QAccessibleWidgetStack::navigate().

472 {
473  if (!target)
474  return -1;
475 
476  *target = 0;
477  QObject *targetObject = 0;
478 
479  QWidgetList childList = childWidgets(widget());
480  bool complexWidget = childList.size() < childCount();
481 
482  switch (relation) {
483  // Hierarchical
484  case Self:
485  targetObject = object();
486  break;
487  case Child:
488  if (complexWidget) {
489  if (entry > 0 && entry <= childCount())
490  return entry;
491  return -1;
492  }else {
493  if (entry > 0 && childList.size() >= entry)
494  targetObject = childList.at(entry - 1);
495  }
496  break;
497  case Ancestor:
498  {
499  if (entry <= 0)
500  return -1;
501  targetObject = widget()->parentWidget();
502  int i;
503  for (i = entry; i > 1 && targetObject; --i)
504  targetObject = targetObject->parent();
505  if (!targetObject && i == 1)
506  targetObject = qApp;
507  }
508  break;
509  case Sibling:
510  {
512  if (!iface)
513  return -1;
514 
515  iface->navigate(Child, entry, target);
516  delete iface;
517  if (*target)
518  return 0;
519  }
520  break;
521 
522  // Geometrical
523  case QAccessible::Left:
524  if (complexWidget && entry) {
525  if (entry < 2 || widget()->height() > widget()->width() + 20) // looks vertical
526  return -1;
527  return entry - 1;
528  }
529  // fall through
530  case QAccessible::Right:
531  if (complexWidget && entry) {
532  if (entry >= childCount() || widget()->height() > widget()->width() + 20) // looks vertical
533  return -1;
534  return entry + 1;
535  }
536  // fall through
537  case QAccessible::Up:
538  if (complexWidget && entry) {
539  if (entry < 2 || widget()->width() > widget()->height() + 20) // looks horizontal
540  return - 1;
541  return entry - 1;
542  }
543  // fall through
544  case QAccessible::Down:
545  if (complexWidget && entry) {
546  if (entry >= childCount() || widget()->width() > widget()->height() + 20) // looks horizontal
547  return - 1;
548  return entry + 1;
549  } else {
551  if (!pIface)
552  return -1;
553 
554  QRect startg = rect(0);
555  QPoint startc = startg.center();
556  QAccessibleInterface *candidate = 0;
557  int mindist = 100000;
558  int sibCount = pIface->childCount();
559  for (int i = 0; i < sibCount; ++i) {
560  QAccessibleInterface *sibling = 0;
561  pIface->navigate(Child, i+1, &sibling);
562  Q_ASSERT(sibling);
563  if ((relationTo(0, sibling, 0) & Self) || (sibling->state(0) & QAccessible::Invisible)) {
564  //ignore ourself and invisible siblings
565  delete sibling;
566  continue;
567  }
568 
569  QRect sibg = sibling->rect(0);
570  QPoint sibc = sibg.center();
571  QPoint sibp;
572  QPoint startp;
573  QPoint distp;
574  switch (relation) {
575  case QAccessible::Left:
576  startp = QPoint(startg.left(), startg.top() + startg.height() / 2);
577  sibp = QPoint(sibg.right(), sibg.top() + sibg.height() / 2);
578  if (QPoint(sibc - startc).x() >= 0) {
579  delete sibling;
580  continue;
581  }
582  distp = sibp - startp;
583  break;
584  case QAccessible::Right:
585  startp = QPoint(startg.right(), startg.top() + startg.height() / 2);
586  sibp = QPoint(sibg.left(), sibg.top() + sibg.height() / 2);
587  if (QPoint(sibc - startc).x() <= 0) {
588  delete sibling;
589  continue;
590  }
591  distp = sibp - startp;
592  break;
593  case QAccessible::Up:
594  startp = QPoint(startg.left() + startg.width() / 2, startg.top());
595  sibp = QPoint(sibg.left() + sibg.width() / 2, sibg.bottom());
596  if (QPoint(sibc - startc).y() >= 0) {
597  delete sibling;
598  continue;
599  }
600  distp = sibp - startp;
601  break;
602  case QAccessible::Down:
603  startp = QPoint(startg.left() + startg.width() / 2, startg.bottom());
604  sibp = QPoint(sibg.left() + sibg.width() / 2, sibg.top());
605  if (QPoint(sibc - startc).y() <= 0) {
606  delete sibling;
607  continue;
608  }
609  distp = sibp - startp;
610  break;
611  default:
612  break;
613  }
614 
615  int dist = (int)qSqrt((qreal)distp.x() * distp.x() + distp.y() * distp.y());
616  if (dist < mindist) {
617  delete candidate;
618  candidate = sibling;
619  mindist = dist;
620  } else {
621  delete sibling;
622  }
623  }
624  delete pIface;
625  *target = candidate;
626  if (*target)
627  return 0;
628  }
629  break;
630  case Covers:
631  if (entry > 0) {
633  if (!pIface)
634  return -1;
635 
636  QRect r = rect(0);
637  int sibCount = pIface->childCount();
638  QAccessibleInterface *sibling = 0;
639  for (int i = pIface->indexOfChild(this) + 1; i <= sibCount && entry; ++i) {
640  pIface->navigate(Child, i, &sibling);
641  if (!sibling || (sibling->state(0) & Invisible)) {
642  delete sibling;
643  sibling = 0;
644  continue;
645  }
646  if (sibling->rect(0).intersects(r))
647  --entry;
648  if (!entry)
649  break;
650  delete sibling;
651  sibling = 0;
652  }
653  delete pIface;
654  *target = sibling;
655  if (*target)
656  return 0;
657  }
658  break;
659  case Covered:
660  if (entry > 0) {
662  if (!pIface)
663  return -1;
664 
665  QRect r = rect(0);
666  int index = pIface->indexOfChild(this);
667  QAccessibleInterface *sibling = 0;
668  for (int i = 1; i < index && entry; ++i) {
669  pIface->navigate(Child, i, &sibling);
670  Q_ASSERT(sibling);
671  if (!sibling || (sibling->state(0) & Invisible)) {
672  delete sibling;
673  sibling = 0;
674  continue;
675  }
676  if (sibling->rect(0).intersects(r))
677  --entry;
678  if (!entry)
679  break;
680  delete sibling;
681  sibling = 0;
682  }
683  delete pIface;
684  *target = sibling;
685  if (*target)
686  return 0;
687  }
688  break;
689 
690  // Logical
691  case FocusChild:
692  {
693  if (widget()->hasFocus()) {
694  targetObject = object();
695  break;
696  }
697 
698  QWidget *fw = widget()->focusWidget();
699  if (!fw)
700  return -1;
701 
702  if (isAncestor(widget(), fw) || fw == widget())
703  targetObject = fw;
704  /* ###
705  QWidget *parent = fw;
706  while (parent && !targetObject) {
707  parent = parent->parentWidget();
708  if (parent == widget())
709  targetObject = fw;
710  }
711  */
712  }
713  break;
714  case Label:
715  if (entry > 0) {
717  if (!pIface)
718  return -1;
719 
720  // first check for all siblings that are labels to us
721  // ideally we would go through all objects and check, but that
722  // will be too expensive
723  int sibCount = pIface->childCount();
724  QAccessibleInterface *candidate = 0;
725  for (int i = 0; i < sibCount && entry; ++i) {
726  const int childId = pIface->navigate(Child, i+1, &candidate);
727  Q_ASSERT(childId >= 0);
728  if (childId > 0)
729  candidate = pIface;
730  if (candidate->relationTo(childId, this, 0) & Label)
731  --entry;
732  if (!entry)
733  break;
734  if (candidate != pIface)
735  delete candidate;
736  candidate = 0;
737  }
738  if (!candidate) {
739  if (pIface->relationTo(0, this, 0) & Label)
740  --entry;
741  if (!entry)
742  candidate = pIface;
743  }
744  if (pIface != candidate)
745  delete pIface;
746 
747  *target = candidate;
748  if (*target)
749  return 0;
750  }
751  break;
752  case Labelled: // only implemented in subclasses
753  break;
754  case Controller:
755  if (entry > 0) {
756  // check all senders we are connected to,
757  // and figure out which one are controllers to us
758  QACConnectionObject *connectionObject = (QACConnectionObject*)object();
759  QObjectList allSenders = connectionObject->senderList();
760  QObjectList senders;
761  for (int s = 0; s < allSenders.size(); ++s) {
762  QObject *sender = allSenders.at(s);
764  if (!candidate)
765  continue;
766  if (candidate->relationTo(0, this, 0)&Controller)
767  senders << sender;
768  delete candidate;
769  }
770  if (entry <= senders.size())
771  targetObject = senders.at(entry-1);
772  }
773  break;
774  case Controlled:
775  if (entry > 0) {
776  QObjectList allReceivers;
777  QACConnectionObject *connectionObject = (QACConnectionObject*)object();
778  for (int sig = 0; sig < d->primarySignals.count(); ++sig) {
779  QObjectList receivers = connectionObject->receiverList(d->primarySignals.at(sig).toAscii());
780  allReceivers += receivers;
781  }
782  if (entry <= allReceivers.size())
783  targetObject = allReceivers.at(entry-1);
784  }
785  break;
786  default:
787  break;
788  }
789 
790  *target = QAccessible::queryAccessibleInterface(targetObject);
791  return *target ? 0 : -1;
792 }
QAccessibleWidgetPrivate * d
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
virtual int indexOfChild(const QAccessibleInterface *) const =0
Returns the 1-based index of the object child in this object&#39;s children list, or -1 if child is not a...
QWidget * focusWidget() const
Returns the last child of this widget that setFocus had been called on.
Definition: qwidget.cpp:6863
double qreal
Definition: qglobal.h:1193
int childCount() const
Reimplemented Function
virtual State state(int child) const =0
Returns the current state of the object, or of the object&#39;s child if child is not 0...
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
virtual int childCount() const =0
Returns the number of children that belong to this object.
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
bool hasFocus() const
Definition: qwidget.cpp:6583
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
QWidget * widget() const
Returns the associated widget.
static QList< QWidget * > childWidgets(const QWidget *widget)
Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const
Reimplemented Function
QRect rect(int child) const
Reimplemented Function
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.
#define qApp
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static QAccessibleInterface * queryAccessibleInterface(QObject *)
If a QAccessibleInterface implementation exists for the given object, this function returns a pointer...
QPoint center() const
Returns the center point of the rectangle.
Definition: qrect.h:300
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
virtual Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const =0
Returns the relationship between this object&#39;s \a child and the \a other object&#39;s \a otherChild...
The QAccessibleInterface class defines an interface that exposes information about accessible objects...
Definition: qaccessible.h:370
QObjectList receiverList(const char *signal) const
QObject * parentObject() const
Returns the associated widget&#39;s parent object, which is either the parent widget, or qApp for top-lev...
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QByteArray toAscii() const Q_REQUIRED_RESULT
Returns an 8-bit representation of the string as a QByteArray.
Definition: qstring.cpp:4014
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QObject * object() const
Reimplemented Function
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
quint16 index
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.
bool intersects(const QRect &r) const
Returns true if this rectangle intersects with the given rectangle (i.
Definition: qrect.cpp:1429
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
QObjectList senderList() const
qreal qSqrt(qreal v)
Definition: qmath.h:205
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
static bool isAncestor(const QObject *obj, const QObject *child)

◆ parentObject()

QObject * QAccessibleWidget::parentObject ( ) const
protected

Returns the associated widget's parent object, which is either the parent widget, or qApp for top-level widgets.

Definition at line 229 of file qaccessiblewidget.cpp.

Referenced by navigate(), and QAccessibleWidgetEx::parentObject().

230 {
231  QObject *parent = object()->parent();
232  if (!parent)
233  parent = qApp;
234  return parent;
235 }
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
#define qApp
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
QObject * object() const
Reimplemented Function

◆ rect()

QRect QAccessibleWidget::rect ( int  child) const
virtual

Reimplemented Function

Reimplemented from QAccessibleObject.

Definition at line 270 of file qaccessiblewidget.cpp.

Referenced by childAt(), Q3AccessibleTextEdit::itemRect(), navigate(), QAccessibleWidgetEx::rect(), and relationTo().

271 {
272  if (child) {
273  qWarning("QAccessibleWidget::rect: This implementation does not support subelements! "
274  "(ID %d unknown for %s)", child, widget()->metaObject()->className());
275  }
276 
277  QWidget *w = widget();
278  if (!w->isVisible())
279  return QRect();
280  QPoint wpos = w->mapToGlobal(QPoint(0, 0));
281 
282  return QRect(wpos.x(), wpos.y(), w->width(), w->height());
283 }
int width
the width of the widget excluding any window frame
Definition: qwidget.h:166
bool isVisible() const
Definition: qwidget.h:1005
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QWidget * widget() const
Returns the associated widget.
const char * className
Definition: qwizard.cpp:137
int height
the height of the widget excluding any window frame
Definition: qwidget.h:167
Q_CORE_EXPORT void qWarning(const char *,...)
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
QPoint mapToGlobal(const QPoint &) const
Translates the widget coordinate pos to global screen coordinates.

◆ relationTo()

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

Reimplemented Function

Implements QAccessibleInterface.

Definition at line 379 of file qaccessiblewidget.cpp.

Referenced by navigate(), and QAccessibleWidgetEx::relationTo().

381 {
382  Relation relation = Unrelated;
383  if (d->asking == this) // recursive call
384  return relation;
385 
386  QObject *o = other ? other->object() : 0;
387  if (!o)
388  return relation;
389 
390  QWidget *focus = widget()->focusWidget();
391  if (object() == focus && isAncestor(o, focus))
392  relation |= FocusChild;
393 
394  QACConnectionObject *connectionObject = (QACConnectionObject*)object();
395  for (int sig = 0; sig < d->primarySignals.count(); ++sig) {
396  if (connectionObject->isSender(o, d->primarySignals.at(sig).toAscii())) {
397  relation |= Controller;
398  break;
399  }
400  }
401  // test for passive relationships.
402  // d->asking protects from endless recursion.
403  d->asking = this;
404  int inverse = other->relationTo(otherChild, this, child);
405  d->asking = 0;
406 
407  if (inverse & Controller)
408  relation |= Controlled;
409  if (inverse & Label)
410  relation |= Labelled;
411 
412  if(o == object()) {
413  if (child && !otherChild)
414  return relation | Child;
415  if (!child && otherChild)
416  return relation | Ancestor;
417  if (!child && !otherChild)
418  return relation | Self;
419  }
420 
421  QObject *parent = object()->parent();
422  if (o == parent)
423  return relation | Child;
424 
425  if (o->parent() == parent) {
426  relation |= Sibling;
428  Q_ASSERT(sibIface);
429  QRect wg = rect(0);
430  QRect sg = sibIface->rect(0);
431  if (wg.intersects(sg)) {
432  QAccessibleInterface *pIface = 0;
433  sibIface->navigate(Ancestor, 1, &pIface);
434  if (pIface && !((sibIface->state(0) | state(0)) & Invisible)) {
435  int wi = pIface->indexOfChild(this);
436  int si = pIface->indexOfChild(sibIface);
437 
438  if (wi > si)
439  relation |= QAccessible::Covers;
440  else
441  relation |= QAccessible::Covered;
442  }
443  delete pIface;
444  } else {
445  QPoint wc = wg.center();
446  QPoint sc = sg.center();
447  if (wc.x() < sc.x())
448  relation |= QAccessible::Left;
449  else if(wc.x() > sc.x())
450  relation |= QAccessible::Right;
451  if (wc.y() < sc.y())
452  relation |= QAccessible::Up;
453  else if (wc.y() > sc.y())
454  relation |= QAccessible::Down;
455  }
456  delete sibIface;
457 
458  return relation;
459  }
460 
461  if (isAncestor(o, object()))
462  return relation | Descendent;
463  if (isAncestor(object(), o))
464  return relation | Ancestor;
465 
466  return relation;
467 }
QAccessibleWidgetPrivate * d
virtual int indexOfChild(const QAccessibleInterface *) const =0
Returns the 1-based index of the object child in this object&#39;s children list, or -1 if child is not a...
QWidget * focusWidget() const
Returns the last child of this widget that setFocus had been called on.
Definition: qwidget.cpp:6863
virtual State state(int child) const =0
Returns the current state of the object, or of the object&#39;s child if child is not 0...
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
virtual QObject * object() const =0
Returns a pointer to the QObject this interface implementation provides information for...
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
QWidget * widget() const
Returns the associated widget.
const QAccessibleInterface * asking
QRect rect(int child) const
Reimplemented Function
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.
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static QAccessibleInterface * queryAccessibleInterface(QObject *)
If a QAccessibleInterface implementation exists for the given object, this function returns a pointer...
QPoint center() const
Returns the center point of the rectangle.
Definition: qrect.h:300
virtual Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const =0
Returns the relationship between this object&#39;s \a child and the \a other object&#39;s \a otherChild...
The QAccessibleInterface class defines an interface that exposes information about accessible objects...
Definition: qaccessible.h:370
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QByteArray toAscii() const Q_REQUIRED_RESULT
Returns an 8-bit representation of the string as a QByteArray.
Definition: qstring.cpp:4014
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QObject * object() const
Reimplemented Function
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
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.
bool intersects(const QRect &r) const
Returns true if this rectangle intersects with the given rectangle (i.
Definition: qrect.cpp:1429
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
bool isSender(const QObject *receiver, const char *signal) const
static bool isAncestor(const QObject *obj, const QObject *child)
State state(int child) const
Reimplemented Function

◆ role()

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

Reimplemented Function

Implements QAccessibleInterface.

Reimplemented in QAccessibleListBox, Q3AccessibleTextEdit, QAccessibleIconView, and QAccessibleListView.

Definition at line 932 of file qaccessiblewidget.cpp.

Referenced by QAccessibleWidget(), QAccessibleListView::role(), QAccessibleIconView::role(), QAccessibleWidgetEx::role(), Q3AccessibleTextEdit::role(), and QAccessibleListBox::role().

933 {
934  if (!child)
935  return d->role;
936 
937  QWidgetList childList = childWidgets(widget());
938  if (childList.count() > 0 && child <= childList.count()) {
939  QWidget *targetWidget = childList.at(child - 1);
941  if (iface) {
942  QAccessible::Role role = iface->role(0);
943  delete iface;
944  return role;
945  }
946  }
947 
948  return NoRole;
949 }
QAccessibleWidgetPrivate * d
Role
This enum defines the role of an accessible object.
Definition: qaccessible.h:188
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
QWidget * widget() const
Returns the associated widget.
static QList< QWidget * > childWidgets(const QWidget *widget)
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static QAccessibleInterface * queryAccessibleInterface(QObject *)
If a QAccessibleInterface implementation exists for the given object, this function returns a pointer...
virtual Role role(int child) const =0
Returns the role of the object, or of the object&#39;s child if child is not 0.
Role role(int child) const
Reimplemented Function
The QAccessibleInterface class defines an interface that exposes information about accessible objects...
Definition: qaccessible.h:370
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ setAccelerator()

void QAccessibleWidget::setAccelerator ( const QString accel)
protected

Sets the accelerator of this interface implementation to accel.

The default implementation of text() returns the set value for the Accelerator text.

Note that the object wrapped by this interface is not modified.

Definition at line 362 of file qaccessiblewidget.cpp.

Referenced by QAccessibleWidgetEx::setAccelerator().

363 {
364  d->accelerator = accel;
365 }
QAccessibleWidgetPrivate * d

◆ setDescription()

void QAccessibleWidget::setDescription ( const QString desc)
protected

Sets the description of this interface implementation to desc.

The default implementation of text() returns the set value for the Description text.

Note that the object wrapped by this interface is not modified.

Definition at line 336 of file qaccessiblewidget.cpp.

Referenced by QAccessibleWidgetStack::QAccessibleWidgetStack(), and QAccessibleWidgetEx::setDescription().

337 {
338  d->description = desc;
339 }
QAccessibleWidgetPrivate * d

◆ setHelp()

void QAccessibleWidget::setHelp ( const QString help)
protected

Sets the help of this interface implementation to help.

The default implementation of text() returns the set value for the Help text.

Note that the object wrapped by this interface is not modified.

Definition at line 349 of file qaccessiblewidget.cpp.

Referenced by QAccessibleWidgetEx::setHelp().

350 {
351  d->help = help;
352 }
QAccessibleWidgetPrivate * d

◆ setValue()

void QAccessibleWidget::setValue ( const QString value)
protected

Sets the value of this interface implementation to value.

The default implementation of text() returns the set value for the Value text.

Note that the object wrapped by this interface is not modified.

Definition at line 323 of file qaccessiblewidget.cpp.

Referenced by QAccessibleWidgetEx::setValue().

324 {
325  d->value = value;
326 }
QAccessibleWidgetPrivate * d

◆ state()

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

Reimplemented Function

Implements QAccessibleInterface.

Reimplemented in QAccessibleListBox, QAccessibleIconView, and QAccessibleListView.

Definition at line 952 of file qaccessiblewidget.cpp.

Referenced by relationTo(), QAccessibleListView::state(), QAccessibleIconView::state(), QAccessibleWidgetEx::state(), and QAccessibleListBox::state().

953 {
954  if (child)
955  return Normal;
956 
958 
959  QWidget *w = widget();
960  if (w->testAttribute(Qt::WA_WState_Visible) == false)
961  state |= Invisible;
962  if (w->focusPolicy() != Qt::NoFocus)
963  state |= Focusable;
964  if (w->hasFocus())
965  state |= Focused;
966  if (!w->isEnabled())
967  state |= Unavailable;
968  if (w->isWindow()) {
970  state |= Movable;
971  if (w->minimumSize() != w->maximumSize())
972  state |= Sizeable;
973  }
974 
975  return state;
976 }
QSize maximumSize
the widget&#39;s maximum size in pixels
Definition: qwidget.h:173
QSize minimumSize
the widget&#39;s minimum size
Definition: qwidget.h:172
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
Qt::FocusPolicy focusPolicy
the way the widget accepts keyboard focus
Definition: qwidget.h:187
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
bool hasFocus() const
Definition: qwidget.cpp:6583
QWidget * widget() const
Returns the associated widget.
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
bool isEnabled() const
Definition: qwidget.h:948
State
Definition: qaudio.h:59
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939
State state(int child) const
Reimplemented Function

◆ text()

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

Reimplemented Function

Implements QAccessibleInterface.

Reimplemented in QAccessibleListBox, Q3AccessibleTextEdit, QAccessibleIconView, and QAccessibleListView.

Definition at line 815 of file qaccessiblewidget.cpp.

Referenced by QAccessibleListView::text(), QAccessibleIconView::text(), QAccessibleWidgetEx::text(), Q3AccessibleTextEdit::text(), and QAccessibleListBox::text().

816 {
817  QString str;
818 
819  switch (t) {
820  case Name:
821  if (!d->name.isEmpty()) {
822  str = d->name;
823  } else if (!widget()->accessibleName().isEmpty()) {
824  str = widget()->accessibleName();
825  } else if (!child && widget()->isWindow()) {
826  if (widget()->isMinimized())
827  str = qt_setWindowTitle_helperHelper(widget()->windowIconText(), widget());
828  else
829  str = qt_setWindowTitle_helperHelper(widget()->windowTitle(), widget());
830  } else {
832  }
833  break;
834  case Description:
835  if (!d->description.isEmpty())
836  str = d->description;
837  else if (!widget()->accessibleDescription().isEmpty())
838  str = widget()->accessibleDescription();
839 #ifndef QT_NO_TOOLTIP
840  else
841  str = widget()->toolTip();
842 #endif
843  break;
844  case Help:
845  if (!d->help.isEmpty())
846  str = d->help;
847 #ifndef QT_NO_WHATSTHIS
848  else
849  str = widget()->whatsThis();
850 #endif
851  break;
852  case Accelerator:
853  if (!d->accelerator.isEmpty())
854  str = d->accelerator;
855  else
856  str = qt_accHotKey(buddyString(widget()));
857  break;
858  case Value:
859  str = d->value;
860  break;
861  default:
862  break;
863  }
864  return str;
865 }
QString accessibleName
the widget&#39;s name as seen by assistive technologies
Definition: qwidget.h:213
QAccessibleWidgetPrivate * d
QString whatsThis
the widget&#39;s What&#39;s This help text.
Definition: qwidget.h:210
QString Q_GUI_EXPORT qt_accHotKey(const QString &text)
The QString class provides a Unicode character string.
Definition: qstring.h:83
QWidget * widget() const
Returns the associated widget.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
#define QT_NO_WHATSTHIS
QString accessibleDescription
the widget&#39;s description as seen by assistive technologies
Definition: qwidget.h:214
if(void) toggleToolbarShown
QString qt_setWindowTitle_helperHelper(const QString &, const QWidget *)
Returns a modified window title with the [*] place holder replaced according to the rules described i...
Definition: qwidget.cpp:6240
QString Q_GUI_EXPORT qt_accStripAmp(const QString &text)
QString toolTip
the widget&#39;s tooltip
Definition: qwidget.h:204
static QString buddyString(const QWidget *widget)

◆ userActionCount()

int QAccessibleWidget::userActionCount ( int  child) const
virtual

Reimplemented Function

Reimplemented from QAccessibleObject.

Definition at line 870 of file qaccessiblewidget.cpp.

871 {
872  if (child)
873  return 0;
874  return widget()->actions().count();
875 }
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
QWidget * widget() const
Returns the associated widget.
QList< QAction * > actions() const
Returns the (possibly empty) list of this widget&#39;s actions.
Definition: qwidget.cpp:3407

◆ widget()

QWidget * QAccessibleWidget::widget ( ) const
protected

Friends and Related Functions

◆ QAccessibleWidgetEx

friend class QAccessibleWidgetEx
friend

Definition at line 92 of file qaccessiblewidget.h.

Properties

◆ d

QAccessibleWidgetPrivate* QAccessibleWidget::d
private

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