Qt 4.8
qaccessiblemenu.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the plugins of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qaccessiblemenu.h"
43 
44 #include <qmenu.h>
45 #include <qmenubar.h>
46 #include <QtGui/QAction>
47 #include <qstyle.h>
48 
49 #ifndef QT_NO_ACCESSIBILITY
50 
52 
53 #ifndef QT_NO_MENU
54 
57 
60 {
61  Q_ASSERT(menu());
62 }
63 
65 {
66  return qobject_cast<QMenu*>(object());
67 }
68 
70 {
71  return menu()->actions().count();
72 }
73 
74 QRect QAccessibleMenu::rect(int child) const
75 {
76  if (!child || child > childCount())
77  return QAccessibleWidgetEx::rect(child);
78 
79  QRect r = menu()->actionGeometry(menu()->actions()[child - 1]);
80  QPoint tlp = menu()->mapToGlobal(QPoint(0,0));
81 
82  return QRect(tlp.x() + r.x(), tlp.y() + r.y(), r.width(), r.height());
83 }
84 
85 int QAccessibleMenu::childAt(int x, int y) const
86 {
87  QAction *act = menu()->actionAt(menu()->mapFromGlobal(QPoint(x,y)));
88  if(act && act->isSeparator())
89  act = 0;
90  return menu()->actions().indexOf(act) + 1;
91 }
92 
93 QString QAccessibleMenu::text(Text t, int child) const
94 {
95  QString tx = QAccessibleWidgetEx::text(t, child);
96  if (!child && tx.size())
97  return tx;
98 
99  switch (t) {
100  case Name:
101  if (!child)
102  return menu()->windowTitle();
103  return qt_accStripAmp(menu()->actions().at(child-1)->text());
104  case Help:
105  return child ? menu()->actions().at(child-1)->whatsThis() : tx;
106 #ifndef QT_NO_SHORTCUT
107  case Accelerator:
108  return child ? static_cast<QString>(menu()->actions().at(child-1)->shortcut()) : tx;
109 #endif
110  default:
111  break;
112  }
113  return tx;
114 }
115 
117 {
118  if (!child)
119  return PopupMenu;
120 
121  QAction *action = menu()->actions()[child-1];
122  if (action && action->isSeparator())
123  return Separator;
124  return MenuItem;
125 }
126 
128 {
130  if (!child)
131  return s;
132 
133  QAction *action = menu()->actions()[child-1];
134  if (!action)
135  return s;
136 
138  s |= HotTracked;
139  if (action->isSeparator() || !action->isEnabled())
140  s |= Unavailable;
141  if (action->isChecked())
142  s |= Checked;
143  if (menu()->activeAction() == action)
144  s |= Focused;
145 
146  return s;
147 }
148 
150 {
151  if (action == QAccessible::DefaultAction && child && text == QAccessible::Name) {
152  QAction *a = menu()->actions().value(child-1, 0);
153  if (!a || a->isSeparator())
154  return QString();
155  if (a->menu()) {
156  if (a->menu()->isVisible())
157  return QMenu::tr("Close");
158  return QMenu::tr("Open");
159  }
160  return QMenu::tr("Execute");
161  }
162 
163  return QAccessibleWidgetEx::actionText(action, text, child);
164 }
165 
166 bool QAccessibleMenu::doAction(int act, int child, const QVariantList &)
167 {
168  if (!child || act != QAccessible::DefaultAction)
169  return false;
170 
171  QAction *action = menu()->actions().value(child-1, 0);
172  if (!action || !action->isEnabled())
173  return false;
174 
175  if (action->menu() && action->menu()->isVisible())
176  action->menu()->hide();
177  else
178  menu()->setActiveAction(action);
179  return true;
180 }
181 
182 int QAccessibleMenu::navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const
183 {
184  int ret = -1;
185  if (entry < 0) {
186  *target = 0;
187  return ret;
188  }
189 
190  if (relation == Self || entry == 0) {
191  *target = new QAccessibleMenu(menu());
192  return 0;
193  }
194 
195  switch (relation) {
196  case Child:
197  if (entry <= childCount()) {
198  *target = new QAccessibleMenuItem(menu(), menu()->actions().at( entry - 1 ));
199  ret = 0;
200  }
201  break;
202  case Ancestor: {
203  QAccessibleInterface *iface;
204  QWidget *parent = menu()->parentWidget();
205  if (qobject_cast<QMenu*>(parent) || qobject_cast<QMenuBar*>(parent)) {
206  iface = new QAccessibleMenuItem(parent, menu()->menuAction());
207  if (entry == 1) {
208  *target = iface;
209  ret = 0;
210  } else {
211  ret = iface->navigate(Ancestor, entry - 1, target);
212  delete iface;
213  }
214  } else {
215  return QAccessibleWidgetEx::navigate(relation, entry, target);
216  }
217  break;}
218  default:
219  return QAccessibleWidgetEx::navigate(relation, entry, target);
220  }
221 
222 
223  if (ret == -1)
224  *target = 0;
225 
226  return ret;
227 
228 }
229 
231 {
232  int index = -1;
233  Role r = child->role(0);
234  if ((r == MenuItem || r == Separator) && menu()) {
235  index = menu()->actions().indexOf(qobject_cast<QAction*>(child->object()));
236  if (index != -1)
237  ++index;
238  }
239  return index;
240 }
241 
242 #ifndef QT_NO_MENUBAR
245 {
246  Q_ASSERT(menuBar());
247 }
248 
250 {
251  return qobject_cast<QMenuBar*>(object());
252 }
253 
255 {
256  return menuBar()->actions().count();
257 }
258 
260 {
261  if (!child)
262  return QAccessibleWidgetEx::rect(child);
263 
264  QRect r = menuBar()->actionGeometry(menuBar()->actions()[child - 1]);
265  QPoint tlp = menuBar()->mapToGlobal(QPoint(0,0));
266  return QRect(tlp.x() + r.x(), tlp.y() + r.y(), r.width(), r.height());
267 }
268 
269 int QAccessibleMenuBar::childAt(int x, int y) const
270 {
271  for (int i = childCount(); i >= 0; --i) {
272  if (rect(i).contains(x,y))
273  return i;
274  }
275  return -1;
276 }
277 
278 int QAccessibleMenuBar::navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const
279 {
280  int ret = -1;
281  if (entry < 0) {
282  *target = 0;
283  return ret;
284  }
285 
286  if (relation == Self || entry == 0) {
287  *target = new QAccessibleMenuBar(menuBar());
288  return 0;
289  }
290 
291  switch (relation) {
292  case Child:
293  if (entry <= childCount()) {
294  *target = new QAccessibleMenuItem(menuBar(), menuBar()->actions().at( entry - 1 ));
295  ret = 0;
296  }
297  break;
298  default:
299  return QAccessibleWidgetEx::navigate(relation, entry, target);
300  }
301 
302 
303  if (ret == -1)
304  *target = 0;
305 
306  return ret;
307 }
308 
310 {
311  int index = -1;
312  Role r = child->role(0);
313  if ((r == MenuItem || r == Separator) && menuBar()) {
314  index = menuBar()->actions().indexOf(qobject_cast<QAction*>(child->object()));
315  if (index != -1)
316  ++index;
317  }
318  return index;
319 }
320 
322 {
323  QString str;
324 
325  if (child) {
326  if (QAction *action = menuBar()->actions().value(child - 1, 0)) {
327  switch (t) {
328  case Name:
329  return qt_accStripAmp(action->text());
330  case Accelerator:
331  str = qt_accHotKey(action->text());
332  break;
333  default:
334  break;
335  }
336  }
337  }
338  if (str.isEmpty())
339  str = QAccessibleWidgetEx::text(t, child);
340  return str;
341 }
342 
344 {
345  if (!child)
346  return MenuBar;
347 
348  QAction *action = menuBar()->actions()[child-1];
349  if (action && action->isSeparator())
350  return Separator;
351  return MenuItem;
352 }
353 
355 {
357  if (!child)
358  return s;
359 
360  QAction *action = menuBar()->actions().value(child-1, 0);
361  if (!action)
362  return s;
363 
365  s |= HotTracked;
366  if (action->isSeparator() || !action->isEnabled())
367  s |= Unavailable;
368  if (menuBar()->activeAction() == action)
369  s |= Focused;
370 
371  return s;
372 }
373 
375 {
376  if (action == QAccessible::DefaultAction && child && text == QAccessible::Name) {
377  QAction *a = menuBar()->actions().value(child-1, 0);
378  if (!a || a->isSeparator())
379  return QString();
380  if (a->menu()) {
381  if (a->menu()->isVisible())
382  return QMenu::tr("Close");
383  return QMenu::tr("Open");
384  }
385  return QMenu::tr("Execute");
386  }
387 
388  return QAccessibleWidgetEx::actionText(action, text, child);
389 }
390 
391 bool QAccessibleMenuBar::doAction(int act, int child, const QVariantList &)
392 {
393  if (act != !child)
394  return false;
395 
396  QAction *action = menuBar()->actions().value(child-1, 0);
397  if (!action || !action->isEnabled())
398  return false;
399  if (action->menu() && action->menu()->isVisible())
400  action->menu()->hide();
401  else
402  menuBar()->setActiveAction(action);
403  return true;
404 }
405 
406 #endif // QT_NO_MENUBAR
407 
408 QAccessibleMenuItem::QAccessibleMenuItem(QWidget *owner, QAction *action) : m_action(action), m_owner(owner)
409 {
410 }
411 
412 
414 {}
415 
416 int QAccessibleMenuItem::childAt(int x, int y ) const
417 {
418  for (int i = childCount(); i >= 0; --i) {
419  if (rect(i).contains(x,y))
420  return i;
421  }
422  return -1;
423 }
424 
426 {
427  return m_action->menu() ? 1 : 0;
428 }
429 
431 {
432  if (text == Name && child == 0) {
433  switch (action) {
434  case Press:
435  case DefaultAction:
436  if (m_action->menu())
437  return QMenu::tr("Open");
438  return QMenu::tr("Execute");
439  break;
440  default:
441  break;
442  }
443  }
444  return QString();
445 }
446 
447 bool QAccessibleMenuItem::doAction(int action, int child, const QVariantList & /*params = QVariantList()*/ )
448 {
449  if ((child) || ((action != DefaultAction) && (action != Press)))
450  return false;
451 
452  // if the action has a menu, expand/hide it
453  if (m_action->menu()) {
454  if (m_action->menu()->isVisible()) {
455  m_action->menu()->hide();
456  return true;
457  } else {
458  if (QMenuBar *bar = qobject_cast<QMenuBar*>(owner())) {
459  bar->setActiveAction(m_action);
460  return true;
461  } else if (QMenu *menu = qobject_cast<QMenu*>(owner())){
462  menu->setActiveAction(m_action);
463  return true;
464  }
465  }
466  }
467  // no menu
468  m_action->trigger();
469  return true;
470 }
471 
472 // action interface
474 {
475  return 1;
476 }
477 
478 void QAccessibleMenuItem::doAction(int actionIndex)
479 {
480  if (actionIndex)
481  return;
482 
484 }
485 
487 {
488  if (child->role(0) == PopupMenu && child->object() == m_action->menu())
489  return 1;
490 
491  return -1;
492 }
493 
495 {
496  return m_action ? true : false;
497 }
498 
499 int QAccessibleMenuItem::navigate(RelationFlag relation, int entry, QAccessibleInterface ** target ) const
500 {
501  int ret = -1;
502  if (entry < 0) {
503  *target = 0;
504  return ret;
505  }
506 
507  if (relation == Self || entry == 0) {
508  *target = new QAccessibleMenuItem(owner(), action());
509  return 0;
510  }
511 
512  switch (relation) {
513  case Child:
514  if (entry <= childCount()) {
515  *target = new QAccessibleMenu(action()->menu());
516  ret = 0;
517  }
518  break;
519 
520  case Ancestor:{
521  QWidget *parent = owner();
522  QAccessibleInterface *ancestor = parent ? QAccessible::queryAccessibleInterface(parent) : 0;
523  if (ancestor) {
524  if (entry == 1) {
525  *target = ancestor;
526  ret = 0;
527  } else {
528  ret = ancestor->navigate(Ancestor, entry - 1, target);
529  delete ancestor;
530  }
531  }
532  break;}
533  case Up:
534  case Down:{
535  QAccessibleInterface *parent = 0;
536  int ent = navigate(Ancestor, 1, &parent);
537  if (ent == 0) {
538  int index = parent->indexOfChild(this);
539  if (index != -1) {
540  index += (relation == Down ? +1 : -1);
541  ret = parent->navigate(Child, index, target);
542  }
543  }
544  delete parent;
545  break;}
546  case Sibling: {
547  QAccessibleInterface *parent = 0;
548  int ent = navigate(Ancestor, 1, &parent);
549  if (ent == 0) {
550  ret = parent->navigate(Child, entry, target);
551  }
552  delete parent;
553  break;}
554  default:
555  break;
556 
557  }
558  if (ret == -1)
559  *target = 0;
560  return ret;
561 }
562 
564 {
565  return m_action;
566 }
567 
569 {
570  QRect rect;
571  if (child == 0) {
572  QWidget *own = owner();
573 #ifndef QT_NO_MENUBAR
574  if (QMenuBar *menuBar = qobject_cast<QMenuBar*>(own)) {
575  rect = menuBar->actionGeometry(m_action);
576  QPoint globalPos = menuBar->mapToGlobal(QPoint(0,0));
577  rect = rect.translated(globalPos);
578  } else
579 #endif // QT_NO_MENUBAR
580  if (QMenu *menu = qobject_cast<QMenu*>(own)) {
581  rect = menu->actionGeometry(m_action);
582  QPoint globalPos = menu->mapToGlobal(QPoint(0,0));
583  rect = rect.translated(globalPos);
584  }
585  } else if (child == 1) {
586  QMenu *menu = m_action->menu();
587  if (menu) {
588  rect = menu->rect();
589  QPoint globalPos = menu->mapToGlobal(QPoint(0,0));
590  rect = rect.translated(globalPos);
591  }
592  }
593  return rect;
594 }
595 
596 QAccessible::Relation QAccessibleMenuItem::relationTo ( int child, const QAccessibleInterface * other, int otherChild ) const
597 {
598  if (other->object() == owner()) {
599  return Child;
600  }
601  Q_UNUSED(child)
602  Q_UNUSED(other)
603  Q_UNUSED(otherChild)
604  // ###
605  return Unrelated;
606 }
607 
609 {
610  return m_action->isSeparator() ? Separator :MenuItem;
611 }
612 
613 void QAccessibleMenuItem::setText ( Text /*t*/, int /*child*/, const QString & /*text */)
614 {
615 
616 }
617 
619 {
621 
622  if (child == 0) {
623  s = Normal;
624  QWidget *own = owner();
625 
626  if (own && (own->testAttribute(Qt::WA_WState_Visible) == false || m_action->isVisible() == false)) {
627  s |= Invisible;
628  }
629 
630  if (QMenu *menu = qobject_cast<QMenu*>(own)) {
631  if (menu->activeAction() == m_action)
632  s |= Focused;
633 #ifndef QT_NO_MENUBAR
634  } else if (QMenuBar *menuBar = qobject_cast<QMenuBar*>(own)) {
635  if (menuBar->activeAction() == m_action)
636  s |= Focused;
637 #endif
638  }
639  if (own && own->style()->styleHint(QStyle::SH_Menu_MouseTracking))
640  s |= HotTracked;
641  if (m_action->isSeparator() || !m_action->isEnabled())
642  s |= Unavailable;
643  if (m_action->isChecked())
644  s |= Checked;
645  } else if (child == 1) {
646  QMenu *menu = m_action->menu();
647  if (menu) {
649  s = iface->state(0);
650  delete iface;
651  }
652  }
653  return s | HasInvokeExtension;;
654 }
655 
656 QString QAccessibleMenuItem::text ( Text t, int child ) const
657 {
658  QString str;
659  switch (t) {
660  case Name:
661  if (child == 0) {
662  str = m_action->text();
663  } else if (child == 1) {
664  QMenu *m = m_action->menu();
665  if (m)
666  str = m->title();
667  }
668  str = qt_accStripAmp(str);
669  break;
670  case Accelerator:
671  if (child == 0) {
672 #ifndef QT_NO_SHORTCUT
674  if (!key.isEmpty()) {
675  str = key.toString();
676  } else
677 #endif
678  {
679  str = qt_accHotKey(m_action->text());
680  }
681  }
682  break;
683  default:
684  break;
685  }
686  return str;
687 }
688 
689 // action interface
690 int QAccessibleMenuItem::userActionCount ( int /*child*/ ) const
691 {
692  return 0;
693 }
694 
696 {
697  return m_action;
698 }
699 
701 {
702  return text(QAccessible::Description, 0);
703 }
704 
706 {
708 }
709 
711 {
712  return text(QAccessible::Name, 0);
713 }
714 
716 {
718 #ifndef QT_NO_SHORTCUT
720  if (!key.isEmpty()) {
721  keys.append(key.toString());
722  }
723 #endif
724  return keys;
725 }
726 
727 
729 {
730  return QVariant();
731 }
732 
734 {
735  return m_owner;
736 }
737 
738 #endif // QT_NO_MENU
739 
741 
742 #endif // QT_NO_ACCESSIBILITY
743 
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
bool isSeparator() const
Returns true if this action is a separator action; otherwise it returns false.
Definition: qaction.cpp:839
T qobject_cast(QObject *object)
Definition: qobject.h:375
void setActiveAction(QAction *act)
Sets the currently highlighted action to act.
Definition: qmenu.cpp:1707
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
bool isEnabled() const
Definition: qaction.cpp:1208
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...
QRect actionGeometry(QAction *) const
Returns the geometry of action act.
Definition: qmenu.cpp:1797
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QString title
The title of the menu.
Definition: qmenu.h:79
virtual int actionCount()
QKeySequence shortcut
the action&#39;s primary shortcut key
Definition: qaction.h:83
QMenu * menu() const
virtual QObject * object() const
Returns a pointer to the QObject this interface implementation provides information for...
QRect rect(int child) const
Returns the geometry of the object, or of the object&#39;s child if child is not 0.
QObject * object() const
Returns a pointer to the QObject this interface implementation provides information for...
bool isVisible() const
Definition: qwidget.h:1005
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...
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&#39;s child if...
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
QWidget * owner() const
#define at(className, varName)
Role
This enum defines the role of an accessible object.
Definition: qaccessible.h:188
virtual QRect rect(int child) const
Returns the geometry of the object, or of the object&#39;s child if child is not 0.
QString text
the action&#39;s descriptive text
Definition: qaction.h:76
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
virtual 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&#39;s child if...
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const =0
Returns an integer representing the specified style hint for the given widget described by the provid...
QAction * activeAction() const
Returns the currently highlighted action, or 0 if no action is currently highlighted.
Definition: qmenu.cpp:1720
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
Definition: qrect.h:328
QString Q_GUI_EXPORT qt_accHotKey(const QString &text)
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
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...
QAccessibleMenuItem(QWidget *owner, QAction *w)
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
State state(int child) const
Returns the current state of the object, or of the object&#39;s child if child is not 0...
int indexOfChild(const QAccessibleInterface *child) const
Returns the 1-based index of the object child in this object&#39;s children list, or -1 if child is not a...
long ASN1_INTEGER_get ASN1_INTEGER * a
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
QString actionText(int action, QAccessible::Text text, int child) const
virtual 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...
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
The QString class provides a Unicode character string.
Definition: qstring.h:83
virtual QObject * object() const =0
Returns a pointer to the QObject this interface implementation provides information for...
static QWidget * owner
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...
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
QStringList keys
virtual bool doAction(int action, int child, const QVariantList &params=QVariantList())
Asks the object, or the object&#39;s child if child is not 0, to execute action using the parameters...
int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const
Navigates from this object to an object that has a relationship relation to this object, and returns the respective object in target.
QStyle * style() const
Definition: qwidget.cpp:2742
bool isVisible() const
Definition: qaction.cpp:1246
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
virtual QStringList keyBindings(int)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QAccessibleMenu(QWidget *w)
virtual QVariant invokeMethodEx(Method, int, const QVariantList &)
QRect rect(int child) const
Returns the geometry of the object, or of the object&#39;s child if child is not 0.
void trigger()
This is a convenience slot that calls activate(Trigger).
Definition: qaction.h:218
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
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.
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const
Navigates from this object to an object that has a relationship relation to this object, and returns the respective object in target.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
virtual void setText(Text t, int child, const QString &text)
Sets the text property t of the object, or of the object&#39;s child if child is not 0, to text.
QRect rect(int child) const
Returns the geometry of the object, or of the object&#39;s child if child is not 0.
RelationFlag
This enum type defines bit flags that can be combined to indicate the relationship between two access...
Definition: qaccessible.h:268
Method
This enum describes the possible types of methods that can be invoked on an accessible object...
Definition: qaccessible.h:311
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
QAction * actionAt(const QPoint &) const
Returns the item at pt; returns 0 if there is no item there.
Definition: qmenu.cpp:1787
QMenuBar * menuBar() const
virtual int childCount() const
Returns the number of children that belong to this object.
const char * styleHint(const QFontDef &request)
QString windowTitle() const
QString toString(SequenceFormat format=PortableText) const
Return a string representation of the key sequence, based on format.
int childAt(int x, int y) const
Returns the 1-based index of the child that contains the screen coordinates (x, y).
T value(int i) const
Returns the value at index position i in the list.
Definition: qlist.h:661
The State element defines configurations of objects and properties.
int indexOfChild(const QAccessibleInterface *child) const
Returns the 1-based index of the object child in this object&#39;s children list, or -1 if child is not a...
virtual State state(int child) const
Returns the current state of the object, or of the object&#39;s child if child is not 0...
bool isEmpty() const
Returns true if the key sequence is empty; otherwise returns false.
QString actionText(int action, QAccessible::Text text, int child) const
bool doAction(int action, int child, const QVariantList &params)
Asks the object, or the object&#39;s child if child is not 0, to execute action using the parameters...
QRect rect() const
int childCount() const
Returns the number of children that belong to this object.
void hide()
Hides the widget.
Definition: qwidget.h:501
QAction * action() const
static QAccessibleInterface * queryAccessibleInterface(QObject *)
If a QAccessibleInterface implementation exists for the given object, this function returns a pointer...
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...
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.
virtual Role role(int child) const
Returns the role of the object, or of the object&#39;s child if child is not 0.
QMenu * menu() const
Returns the menu contained by this action.
Definition: qaction.cpp:793
The QMenuBar class provides a horizontal menu bar.
Definition: qmenubar.h:62
The QKeySequence class encapsulates a key sequence as used by shortcuts.
Definition: qkeysequence.h:72
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 QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus...
Definition: qmenu.h:72
State
Definition: qaudio.h:59
virtual int childAt(int x, int y) const
Returns the 1-based index of the child that contains the screen coordinates (x, y).
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
The QAccessibleInterface class defines an interface that exposes information about accessible objects...
Definition: qaccessible.h:370
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
int key
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
virtual int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const
Navigates from this object to an object that has a relationship relation to this object, and returns the respective object in target.
QString whatsThis
the action&#39;s "What&#39;s This?" help text
Definition: qaction.h:80
QList< QAction * > actions() const
Returns the (possibly empty) list of this widget&#39;s actions.
Definition: qwidget.cpp:3407
bool doAction(int action, int child, const QVariantList &params)
Asks the object, or the object&#39;s child if child is not 0, to execute action using the parameters...
virtual int indexOfChild(const QAccessibleInterface *child) const
Returns the 1-based index of the object child in this object&#39;s children list, or -1 if child is not a...
void setActiveAction(QAction *action)
Sets the currently highlighted action to act.
Definition: qmenubar.cpp:1002
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
bool isChecked() const
Definition: qaction.cpp:1151
QAccessibleMenuBar(QWidget *w)
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
int childAt(int x, int y) const
Returns the 1-based index of the child that contains the screen coordinates (x, y).
quint16 index
virtual int userActionCount(int child) const
Returns the number of custom actions of the object, or of the object&#39;s child if child is not 0...
virtual QString name(int)
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
QAction * activeAction() const
Returns the QAction that is currently highlighted.
Definition: qmenubar.cpp:988
State state(int child) const
Returns the current state of the object, or of the object&#39;s child if child is not 0...
virtual Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const
Returns the relationship between this object&#39;s \a child and the \a other object&#39;s \a otherChild...
Text
This enum specifies string information that an accessible object returns.
Definition: qaccessible.h:259
int navigate(RelationFlag rel, int entry, QAccessibleInterface **target) const
Navigates from this object to an object that has a relationship relation to this object, and returns the respective object in target.
State state(int child) const
Returns the current state of the object, or of the object&#39;s child if child is not 0...
virtual QString localizedName(int)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
QPoint mapToGlobal(const QPoint &) const
Translates the widget coordinate pos to global screen coordinates.
virtual bool isValid() const
Returns true if all the data necessary to use this interface implementation is valid (e...
The QAction class provides an abstract user interface action that can be inserted into widgets...
Definition: qaction.h:64
QRect actionGeometry(QAction *) const
Returns the geometry of action act as a QRect.
Definition: qmenubar.cpp:1717
virtual QString description(int)
Role role(int child) const
Returns the role of the object, or of the object&#39;s child if child is not 0.
#define text
Definition: qobjectdefs.h:80
QString Q_GUI_EXPORT qt_accStripAmp(const QString &text)
int childCount() const
Returns the number of children that belong to this object.
The Text item allows you to add formatted text to a scene.
Role role(int child) const
Returns the role of the object, or of the object&#39;s child if child is not 0.