Qt 4.8
simplewidgets.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 "simplewidgets.h"
43 
44 #include <qabstractbutton.h>
45 #include <qcheckbox.h>
46 #include <qpushbutton.h>
47 #include <qprogressbar.h>
48 #include <qstatusbar.h>
49 #include <qradiobutton.h>
50 #include <qtoolbutton.h>
51 #include <qlabel.h>
52 #include <qgroupbox.h>
53 #include <qlcdnumber.h>
54 #include <qtextdocument.h>
55 #include <qlineedit.h>
56 #include <private/qlineedit_p.h>
57 #include <qstyle.h>
58 #include <qstyleoption.h>
59 
60 #ifdef Q_OS_MAC
61 #include <qfocusframe.h>
62 #endif
63 
65 
66 #ifndef QT_NO_ACCESSIBILITY
67 
68 using namespace QAccessible2;
69 extern QList<QWidget*> childWidgets(const QWidget *widget, bool includeTopLevel = false);
70 
73 
75  int *startOffset, int *endOffset, const QString& text);
77  int *startOffset, int *endOffset, const QString& text);
79  int *startOffset, int *endOffset, const QString& text);
80 
97 : QAccessibleWidgetEx(w, role)
98 {
99  Q_ASSERT(button());
100  if (button()->isCheckable())
101  addControllingSignal(QLatin1String("toggled(bool)"));
102  else
103  addControllingSignal(QLatin1String("clicked()"));
104 }
105 
108 {
109  return qobject_cast<QAbstractButton*>(object());
110 }
111 
113 QString QAccessibleButton::actionText(int action, Text text, int child) const
114 {
115  if (child)
116  return QString();
117 
118  if (text == Name) switch (action) {
119  case Press:
120  case DefaultAction: // press, checking or open
121  switch (role(0)) {
122  case ButtonMenu:
123  return QPushButton::tr("Open");
124  case CheckBox:
125  {
126  if (state(child) & Checked)
127  return QCheckBox::tr("Uncheck");
129  if (!cb || !cb->isTristate() || cb->checkState() == Qt::PartiallyChecked)
130  return QCheckBox::tr("Check");
131  return QCheckBox::tr("Toggle");
132  }
133  break;
134  case RadioButton:
135  return QRadioButton::tr("Check");
136  default:
137  break;
138  }
139  break;
140  }
141  return QAccessibleWidgetEx::actionText(action, text, child);
142 }
143 
145 bool QAccessibleButton::doAction(int action, int child, const QVariantList &params)
146 {
147  if (child || !widget()->isEnabled())
148  return false;
149 
150  switch (action) {
151  case DefaultAction:
152  case Press:
153  {
154 #ifndef QT_NO_MENU
156  if (pb && pb->menu())
157  pb->showMenu();
158  else
159 #endif
160  button()->animateClick();
161  }
162  return true;
163  }
164  return QAccessibleWidgetEx::doAction(action, child, params);
165 }
166 
169 {
170  QString str;
171  switch (t) {
172  case Accelerator:
173  {
174 #ifndef QT_NO_SHORTCUT
176  if (pb && pb->isDefault())
178 #endif
179  if (str.isEmpty())
180  str = qt_accHotKey(button()->text());
181  }
182  break;
183  case Name:
184  str = widget()->accessibleName();
185  if (str.isEmpty())
186  str = button()->text();
187  break;
188  default:
189  break;
190  }
191  if (str.isEmpty())
192  str = QAccessibleWidgetEx::text(t, child);
193  return qt_accStripAmp(str);
194 }
195 
198 {
200 
201  QAbstractButton *b = button();
202  QCheckBox *cb = qobject_cast<QCheckBox *>(b);
203  if (b->isChecked())
204  state |= Checked;
205  else if (cb && cb->checkState() == Qt::PartiallyChecked)
206  state |= Mixed;
207  if (b->isDown())
208  state |= Pressed;
210  if (pb) {
211  if (pb->isDefault())
212  state |= DefaultButton;
213 #ifndef QT_NO_MENU
214  if (pb->menu())
215  state |= HasPopup;
216 #endif
217  }
218 
219  return state;
220 }
221 
223 {
224  return 1;
225 }
226 
227 void QAccessibleButton::doAction(int actionIndex)
228 {
229  switch (actionIndex) {
230  case 0:
231  button()->click();
232  break;
233  }
234 }
235 
237 {
238  switch (actionIndex) {
239  case 0:
240  if (button()->isCheckable()) {
241  return QLatin1String("Toggles the button.");
242  }
243  return QLatin1String("Clicks the button.");
244  default:
245  return QString();
246  }
247 }
248 
250 {
251  switch (actionIndex) {
252  case 0:
253  if (button()->isCheckable()) {
254  if (button()->isChecked()) {
255  return QLatin1String("Uncheck");
256  } else {
257  return QLatin1String("Check");
258  }
259  }
260  return QLatin1String("Press");
261  default:
262  return QString();
263  }
264 }
265 
267 {
268  switch (actionIndex) {
269  case 0:
270  if (button()->isCheckable()) {
271  if (button()->isChecked()) {
272  return tr("Uncheck");
273  } else {
274  return tr("Check");
275  }
276  }
277  return tr("Press");
278  default:
279  return QString();
280  }
281 }
282 
284 {
285  switch (actionIndex) {
286 #ifndef QT_NO_SHORTCUT
287  case 0:
288  return QStringList() << button()->shortcut().toString();
289 #endif
290  default:
291  return QStringList();
292  }
293 }
294 
295 #ifndef QT_NO_TOOLBUTTON
296 
325 : QAccessibleButton(w, role)
326 {
327  Q_ASSERT(toolButton());
328 }
329 
332 {
333  return qobject_cast<QToolButton*>(object());
334 }
335 
340 {
341 #ifndef QT_NO_MENU
343 #else
344  return false;
345 #endif
346 }
347 
350 {
351  if (isSplitButton()) switch(child) {
352  case ButtonExecute:
353  return PushButton;
354  case ButtonDropMenu:
355  return ButtonMenu;
356  }
357  return QAccessibleButton::role(child);
358 }
359 
362 {
364  if (toolButton()->autoRaise())
365  st |= HotTracked;
366 #ifndef QT_NO_MENU
367  if (toolButton()->menu() && child != ButtonExecute)
368  st |= HasPopup;
369 #endif
370  return st;
371 }
372 
375 {
376  if (!toolButton()->isVisible())
377  return 0;
378  return isSplitButton() ? ButtonDropMenu : 0;
379 }
380 
391 {
392  if (!toolButton()->isVisible())
393  return QRect();
394  if (!child)
395  return QAccessibleButton::rect(child);
396 
398  opt.init(widget());
399  QRect subrect = widget()->style()->subControlRect(QStyle::CC_ToolButton, &opt,
401 
402  if (child == ButtonExecute)
403  subrect = QRect(0, 0, subrect.x(), widget()->height());
404 
405  QPoint ntl = widget()->mapToGlobal(subrect.topLeft());
406  subrect.moveTopLeft(ntl);
407  return subrect;
408 }
409 
420 {
421  QString str;
422  switch (t) {
423  case Name:
424  str = toolButton()->accessibleName();
425  if (str.isEmpty())
426  str = toolButton()->text();
427  break;
428  default:
429  break;
430  }
431  if (str.isEmpty())
432  str = QAccessibleButton::text(t, child);;
433  return qt_accStripAmp(str);
434 }
435 
446 {
447  // each subelement has one action
448  if (child)
449  return isSplitButton() ? 1 : 0;
450  int ac = widget()->focusPolicy() != Qt::NoFocus ? 1 : 0;
451  // button itself has two actions if a menu button
452 #ifndef QT_NO_MENU
453  return ac + (toolButton()->menu() ? 2 : 1);
454 #else
455  return ac + 1;
456 #endif
457 }
458 
470 QString QAccessibleToolButton::actionText(int action, Text text, int child) const
471 {
472  if (text == Name) switch(child) {
473  case ButtonExecute:
474  return QToolButton::tr("Press");
475  case ButtonDropMenu:
476  return QToolButton::tr("Open");
477  default:
478  switch(action) {
479  case 0:
480  return QToolButton::tr("Press");
481  case 1:
482 #ifndef QT_NO_MENU
483  if (toolButton()->menu())
484  return QToolButton::tr("Open");
485 #endif
486  //fall through
487  case 2:
488  return QLatin1String("Set Focus");
489  }
490  }
491  return QString();
492 }
493 
497 bool QAccessibleToolButton::doAction(int action, int child, const QVariantList &params)
498 {
499  if (!widget()->isEnabled())
500  return false;
501  if (action == 1 || child == ButtonDropMenu) {
502  if(!child)
503  toolButton()->setDown(true);
504 #ifndef QT_NO_MENU
505  toolButton()->showMenu();
506 #endif
507  return true;
508  }
509  return QAccessibleButton::doAction(action, 0, params);
510 }
511 
512 #endif // QT_NO_TOOLBUTTON
513 
530 : QAccessibleWidgetEx(w, role)
531 {
532 }
533 
536 {
538  if (l) {
539  if (l->pixmap())
540  return Graphic;
541 #ifndef QT_NO_PICTURE
542  if (l->picture())
543  return Graphic;
544 #endif
545 #ifndef QT_NO_MOVIE
546  if (l->movie())
547  return Animation;
548 #endif
549 #ifndef QT_NO_PROGRESSBAR
550  } else if (qobject_cast<QProgressBar*>(object())) {
551  return ProgressBar;
552 #endif
553  } else if (qobject_cast<QStatusBar*>(object())) {
554  return StatusBar;
555  }
556  return QAccessibleWidgetEx::role(child);
557 }
558 
561 {
562  QString str;
563  switch (t) {
564  case Name:
565  str = widget()->accessibleName();
566  if (str.isEmpty()) {
567  if (qobject_cast<QLabel*>(object())) {
568  QLabel *label = qobject_cast<QLabel*>(object());
569  str = label->text();
570  if (label->textFormat() == Qt::RichText
571  || (label->textFormat() == Qt::AutoText && Qt::mightBeRichText(str))) {
572  QTextDocument doc;
573  doc.setHtml(str);
574  str = doc.toPlainText();
575  }
576 #ifndef QT_NO_LCDNUMBER
577  } else if (qobject_cast<QLCDNumber*>(object())) {
579  if (l->digitCount())
580  str = QString::number(l->value());
581  else
582  str = QString::number(l->intValue());
583 #endif
584  } else if (qobject_cast<QStatusBar*>(object())) {
585  return qobject_cast<QStatusBar*>(object())->currentMessage();
586  }
587  }
588  break;
589  case Value:
590 #ifndef QT_NO_PROGRESSBAR
591  if (qobject_cast<QProgressBar*>(object()))
592  str = QString::number(qobject_cast<QProgressBar*>(object())->value());
593 #endif
594  break;
595  default:
596  break;
597  }
598  if (str.isEmpty())
599  str = QAccessibleWidgetEx::text(t, child);;
600  return qt_accStripAmp(str);
601 }
602 
604 QAccessible::Relation QAccessibleDisplay::relationTo(int child, const QAccessibleInterface *other,
605  int otherChild) const
606 {
607  Relation relation = QAccessibleWidgetEx::relationTo(child, other, otherChild);
608  if (child || otherChild)
609  return relation;
610 
611  QObject *o = other->object();
612  QLabel *label = qobject_cast<QLabel*>(object());
613  if (label) {
614 #ifndef QT_NO_SHORTCUT
615  if (o == label->buddy())
616  relation |= Label;
617 #endif
618  }
619  return relation;
620 }
621 
624 {
625  *target = 0;
626  if (rel == Labelled) {
627  QObject *targetObject = 0;
628  QLabel *label = qobject_cast<QLabel*>(object());
629  if (label) {
630 #ifndef QT_NO_SHORTCUT
631  if (entry == 1)
632  targetObject = label->buddy();
633 #endif
634  }
635  *target = QAccessible::queryAccessibleInterface(targetObject);
636  if (*target)
637  return 0;
638  }
639  return QAccessibleWidgetEx::navigate(rel, entry, target);
640 }
641 
644 {
645 #ifndef QT_NO_TOOLTIP
646  return widget()->toolTip();
647 #else
648  return QString::null;
649 #endif
650 }
651 
654 {
655  QLabel *label = qobject_cast<QLabel *>(widget());
656  if (!label)
657  return QSize();
658  const QPixmap *pixmap = label->pixmap();
659  if (!pixmap)
660  return QSize();
661  return pixmap->size();
662 }
663 
666 {
667  QLabel *label = qobject_cast<QLabel *>(widget());
668  if (!label)
669  return QRect();
670  const QPixmap *pixmap = label->pixmap();
671  if (!pixmap)
672  return QRect();
673 
674  switch (coordType) {
676  return QRect(label->mapToGlobal(label->pos()), label->size());
678  return label->geometry();
679  }
680 
681  return QRect();
682 }
683 
684 #ifndef QT_NO_GROUPBOX
687 {
688 }
689 
691 {
692  return static_cast<QGroupBox *>(widget());
693 }
694 
696 {
697  QString txt = QAccessibleWidgetEx::text(t, child);
698 
699  if (txt.isEmpty()) {
700  switch (t) {
701  case Name:
702  txt = qt_accStripAmp(groupBox()->title());
703  case Description:
704  txt = qt_accStripAmp(groupBox()->title());
705  default:
706  break;
707  }
708  }
709 
710  return txt;
711 }
712 
714 {
716 
717  if (groupBox()->isChecked())
718  st |= QAccessible::Checked;
719 
720  return st;
721 }
722 
724 {
725  if (child)
726  return QAccessibleWidgetEx::role(child);
727 
729 }
730 
732 {
733  if ((rel == Labelled) && !groupBox()->title().isEmpty())
734  rel = Child;
735  return QAccessibleWidgetEx::navigate(rel, entry, target);
736 }
737 
738 QAccessible::Relation QAccessibleGroupBox::relationTo(int child, const QAccessibleInterface* other, int otherChild) const
739 {
740  QGroupBox *groupbox = this->groupBox();
741 
742  QAccessible::Relation relation = QAccessibleWidgetEx::relationTo(child, other, otherChild);
743 
744  if (!child && !otherChild && !groupbox->title().isEmpty()) {
745  QObject *o = other->object();
746  if (groupbox->children().contains(o))
747  relation |= Label;
748  }
749 
750  return relation;
751 }
752 
754 {
755  return groupBox()->isCheckable() ? 1 : 0;
756 }
757 
758 void QAccessibleGroupBox::doAction(int actionIndex)
759 {
760  if ((actionIndex == 0) && groupBox()->isCheckable()) {
761  groupBox()->setChecked(!groupBox()->isChecked());
762  }
763 }
764 
766 {
767  if ((actionIndex == 0) && (groupBox()->isCheckable())) {
768  return QLatin1String("Toggles the button.");
769  }
770  return QString();
771 }
772 
774 {
775  if (actionIndex || !groupBox()->isCheckable())
776  return QString();
777 
778  return QLatin1String("Toggle");
779 }
780 
782 {
783  if (actionIndex || !groupBox()->isCheckable())
784  return QString();
785 
786  return QGroupBox::tr("Toggle");
787 }
788 
790 {
791  Q_UNUSED(actionIndex)
792  return QStringList();
793 }
794 
795 #endif
796 
797 #ifndef QT_NO_LINEEDIT
798 
815 {
816  addControllingSignal(QLatin1String("textChanged(const QString&)"));
817  addControllingSignal(QLatin1String("returnPressed()"));
818 }
819 
822 {
823  return qobject_cast<QLineEdit*>(object());
824 }
825 
828 {
829  QString str;
830  switch (t) {
831  case Value:
832  if (lineEdit()->echoMode() == QLineEdit::Normal)
833  str = lineEdit()->text();
834  break;
835  default:
836  break;
837  }
838  if (str.isEmpty())
839  str = QAccessibleWidgetEx::text(t, child);;
840  return qt_accStripAmp(str);
841 }
842 
844 void QAccessibleLineEdit::setText(Text t, int control, const QString &text)
845 {
846  if (t != Value || control) {
847  QAccessibleWidgetEx::setText(t, control, text);
848  return;
849  }
850 
851  QString newText = text;
852  if (lineEdit()->validator()) {
853  int pos = 0;
854  if (lineEdit()->validator()->validate(newText, pos) != QValidator::Acceptable)
855  return;
856  }
857  lineEdit()->setText(newText);
858 }
859 
862 {
864 
865  QLineEdit *l = lineEdit();
866  if (l->isReadOnly())
867  state |= ReadOnly;
868  if (l->echoMode() != QLineEdit::Normal)
869  state |= Protected;
870  state |= Selectable;
871  if (l->hasSelectedText())
872  state |= Selected;
873 
876  state |= HasPopup;
877 
878  return state;
879 }
880 
882  const QVariantList &params)
883 {
884  if (child)
885  return QVariant();
886 
887  switch (method) {
888  case ListSupportedMethods: {
892  QAccessibleWidgetEx::invokeMethodEx(method, child, params)));
893  }
894  case SetCursorPosition:
895  setCursorPosition(params.value(0).toInt());
896  return true;
897  case GetCursorPosition:
898  return cursorPosition();
899  default:
900  return QAccessibleWidgetEx::invokeMethodEx(method, child, params);
901  }
902 }
903 
904 void QAccessibleLineEdit::addSelection(int startOffset, int endOffset)
905 {
906  setSelection(0, startOffset, endOffset);
907 }
908 
909 QString QAccessibleLineEdit::attributes(int offset, int *startOffset, int *endOffset)
910 {
911  // QLineEdit doesn't have text attributes
912  *startOffset = *endOffset = offset;
913  return QString();
914 }
915 
917 {
918  return lineEdit()->cursorPosition();
919 }
920 
922 {
923  int left, top, right, bottom;
924  lineEdit()->getTextMargins(&left, &top, &right, &bottom);
925  int x = lineEdit()->d_func()->control->cursorToX(offset);
926  int y = top;
927  QFontMetrics fm(lineEdit()->font());
928  const QString ch = text(offset, offset + 1);
929  int w = fm.width(ch);
930  int h = fm.height();
931 
932  QRect r(x, y, w, h);
933  if (coordType == QAccessible2::RelativeToScreen)
934  r.moveTo(lineEdit()->mapToGlobal(r.topLeft()));
935 
936  return r;
937 }
938 
940 {
941  return lineEdit()->hasSelectedText() ? 1 : 0;
942 }
943 
945 {
946  QPoint p = point;
947  if (coordType == RelativeToScreen)
948  p = lineEdit()->mapFromGlobal(p);
949 
950  return lineEdit()->cursorPositionAt(p);
951 }
952 
953 void QAccessibleLineEdit::selection(int selectionIndex, int *startOffset, int *endOffset)
954 {
955  *startOffset = *endOffset = 0;
956  if (selectionIndex != 0)
957  return;
958 
959  *startOffset = lineEdit()->selectionStart();
960  *endOffset = *startOffset + lineEdit()->selectedText().count();
961 }
962 
963 QString QAccessibleLineEdit::text(int startOffset, int endOffset)
964 {
965  if (startOffset > endOffset)
966  return QString();
967 
968  if (lineEdit()->echoMode() != QLineEdit::Normal)
969  return QString();
970 
971  return lineEdit()->text().mid(startOffset, endOffset - startOffset);
972 }
973 
975  int *startOffset, int *endOffset)
976 {
977  if (lineEdit()->echoMode() != QLineEdit::Normal) {
978  *startOffset = *endOffset = -1;
979  return QString();
980  }
981  return qTextBeforeOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
982 }
983 
985  int *startOffset, int *endOffset)
986 {
987  if (lineEdit()->echoMode() != QLineEdit::Normal) {
988  *startOffset = *endOffset = -1;
989  return QString();
990  }
991  return qTextAfterOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
992 }
993 
995  int *startOffset, int *endOffset)
996 {
997  if (lineEdit()->echoMode() != QLineEdit::Normal) {
998  *startOffset = *endOffset = -1;
999  return QString();
1000  }
1001  return qTextAtOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
1002 }
1003 
1005 {
1006  if (selectionIndex != 0)
1007  return;
1008 
1009  lineEdit()->deselect();
1010 }
1011 
1013 {
1014  lineEdit()->setCursorPosition(position);
1015 }
1016 
1017 void QAccessibleLineEdit::setSelection(int selectionIndex, int startOffset, int endOffset)
1018 {
1019  if (selectionIndex != 0)
1020  return;
1021 
1022  lineEdit()->setSelection(startOffset, endOffset - startOffset);
1023 }
1024 
1026 {
1027  return lineEdit()->text().count();
1028 }
1029 
1030 void QAccessibleLineEdit::scrollToSubstring(int startIndex, int endIndex)
1031 {
1032  lineEdit()->setCursorPosition(endIndex);
1033  lineEdit()->setCursorPosition(startIndex);
1034 }
1035 
1036 #endif // QT_NO_LINEEDIT
1037 
1038 #ifndef QT_NO_PROGRESSBAR
1040  : QAccessibleDisplay(o)
1041 {
1042  Q_ASSERT(progressBar());
1043 }
1044 
1046 {
1047  return progressBar()->value();
1048 }
1049 
1051 {
1052  return progressBar()->maximum();
1053 }
1054 
1056 {
1057  return progressBar()->minimum();
1058 }
1059 
1061 {
1062  return qobject_cast<QProgressBar *>(object());
1063 }
1064 #endif
1065 
1066 #endif // QT_NO_ACCESSIBILITY
1067 
1069 
QString accessibleName
the widget&#39;s name as seen by assistive technologies
Definition: qwidget.h:213
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
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
bool isSplitButton() const
Returns true if this tool button is a split button.
QAccessibleGroupBox(QWidget *w)
The QAbstractButton class is the abstract base class of button widgets, providing functionality commo...
QPoint pos() const
T qobject_cast(QObject *object)
Definition: qobject.h:375
QString Q_GUI_EXPORT qt_accHotKey(const QString &text)
int width(const QString &, int len=-1) const
Returns the width in pixels of the first len characters of text.
int selectionStart() const
selectionStart() returns the index of the first selected character in the line edit or -1 if no text ...
Definition: qlineedit.cpp:1039
The QAccessible2 namespace defines constants relating to IAccessible2-based interfaces.
Definition: qaccessible.h:347
bool isChecked() const
Role role(int child) const
Returns the role of the object, or of the object&#39;s child if child is not 0.
int cursorPositionAt(const QPoint &pos)
Returns the cursor position under the point pos.
Definition: qlineedit.cpp:768
void scrollToSubstring(int startIndex, int endIndex)
The QFontMetrics class provides font metrics information.
Definition: qfontmetrics.h:65
QString description(int actionIndex)
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QString text() const
void setChecked(bool checked)
Definition: qgroupbox.cpp:664
QSize size() const
State state(int child) const
Reimplemented Function
QPointer< QWidget > widget
QSize size() const
Returns the size of the pixmap.
Definition: qpixmap.cpp:661
void showMenu()
Shows (pops up) the associated popup menu.
QString imageDescription()
Qt::TextFormat textFormat
the label&#39;s text format
Definition: qlabel.h:59
int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType)
virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget=0) const =0
Returns the rectangle containing the specified subControl of the given complex control (with the styl...
QObject * object() const
Returns a pointer to the QObject this interface implementation provides information for...
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...
int childCount() const
Reimplemented Function
QAccessibleButton(QWidget *w, Role r)
Creates a QAccessibleButton object for w.
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
Role
This enum defines the role of an accessible object.
Definition: qaccessible.h:188
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...
void showMenu()
Shows (pops up) the associated popup menu.
bool isTristate() const
Definition: qcheckbox.cpp:242
Qt::FocusPolicy focusPolicy
the way the widget accepts keyboard focus
Definition: qwidget.h:187
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QLineEdit * lineEdit() const
Returns the line edit.
bool isDown() const
void setSelection(int selectionIndex, int startOffset, int endOffset)
Q_GUI_EXPORT bool mightBeRichText(const QString &)
Returns true if the string text is likely to be rich text; otherwise returns false.
Role role(int child) const
Reimplemented Function
void deselect()
Deselects any selected text.
Definition: qlineedit.cpp:1417
The QPushButton widget provides a command button.
Definition: qpushbutton.h:57
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...
void init(const QWidget *w)
Use initFrom(widget) instead.
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void moveTo(int x, int t)
Moves the rectangle, leaving the top-left corner at the given position (x, y).
Definition: qrect.h:334
QString Q_GUI_EXPORT qTextAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, int *startOffset, int *endOffset, const QString &text)
The QProgressBar widget provides a horizontal or vertical progress bar.
Definition: qprogressbar.h:58
QString text
the text shown on the button
QAccessibleToolButton(QWidget *w, Role role)
Creates a QAccessibleToolButton object for w.
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...
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...
QString text(Text t, int child) const
Reimplemented Function
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
QString attributes(int offset, int *startOffset, int *endOffset)
QAbstractButton * button() const
Returns the button.
QString toPlainText() const
Returns the plain text contained in the document.
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
The QStyleOptionToolButton class is used to describe the parameters for drawing a tool button...
Definition: qstyleoption.h:768
QRect rect(int child) const
Returns the rectangle occupied by this button, depending on child.
QList< QWidget * > childWidgets(const QWidget *widget, bool includeTopLevel=false)
QStyle * style() const
Definition: qwidget.cpp:2742
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.
QString name(int actionIndex)
The QStatusBar class provides a horizontal bar suitable for presenting status information.
Definition: qstatusbar.h:57
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
Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const
Reimplemented Function
State state(int child) const
Reimplemented Function
Qt::ContextMenuPolicy contextMenuPolicy() const
QWidget * buddy() const
Returns this label&#39;s buddy, or 0 if no buddy is currently set.
Definition: qlabel.cpp:1319
void removeSelection(int selectionIndex)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
Definition: qlist.h:880
QRect rect(int child) const
Returns the geometry of the object, or of the object&#39;s child if child is not 0.
static bool isEmpty(const char *str)
void addSelection(int startOffset, int endOffset)
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.
int height
the height of the widget excluding any window frame
Definition: qwidget.h:167
QString localizedName(int actionIndex)
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
void setCursorPosition(int position)
RelationFlag
This enum type defines bit flags that can be combined to indicate the relationship between two access...
Definition: qaccessible.h:268
QString text
the line edit&#39;s text
Definition: qlineedit.h:72
void doAction(int actionIndex)
int digitCount
the current number of digits displayed
Definition: qlcdnumber.h:63
Method
This enum describes the possible types of methods that can be invoked on an accessible object...
Definition: qaccessible.h:311
void setSelection(int, int)
Selects text from position start and for length characters.
Definition: qlineedit.cpp:1106
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
The QAccessibleDisplay class implements the QAccessibleInterface for widgets that display information...
int maximum
the progress bar&#39;s maximum value
Definition: qprogressbar.h:63
bool isCheckable() const
Definition: qgroupbox.cpp:604
QString text(Text t, int child) const
Reimplemented Function
const QPicture * picture() const
Returns the label&#39;s picture or 0 if the label doesn&#39;t have a picture.
Definition: qlabel.cpp:163
bool doAction(int action, int child, const QVariantList &params)
The QGroupBox widget provides a group box frame with a title.
Definition: qgroupbox.h:57
QString text(Text t, int child) const
Reimplemented Function
QString accessibleName() const
QAccessibleLineEdit(QWidget *o, const QString &name=QString())
Constructs a QAccessibleLineEdit object for w.
The QAccessibleButton class implements the QAccessibleInterface for button type widgets.
Definition: simplewidgets.h:59
QString toString(SequenceFormat format=PortableText) const
Return a string representation of the key sequence, based on format.
void setHtml(const QString &html)
Replaces the entire contents of the document with the given HTML-formatted text in the html string...
T value(int i) const
Returns the value at index position i in the list.
Definition: qlist.h:661
QString Q_GUI_EXPORT qTextAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, int *startOffset, int *endOffset, const QString &text)
The State element defines configurations of objects and properties.
QMenu * menu() const
Returns the button&#39;s associated popup menu or 0 if no popup menu has been set.
QGroupBox * groupBox() const
QStringList keyBindings(int actionIndex)
static QVariant fromValue(const T &value)
Returns a QVariant containing a copy of value.
Definition: qvariant.h:336
QAccessibleProgressBar(QWidget *o)
bool doAction(int action, int child, const QVariantList &params)
Reimplemented Function
QString textBeforeOffset(int offset, QAccessible2::BoundaryType boundaryType, int *startOffset, int *endOffset)
int count() const
Definition: qstring.h:103
The QAccessibleSimpleEditableTextInterface class is a convenience class for text-based widgets...
Definition: qaccessible2.h:176
void moveTopLeft(const QPoint &p)
Moves the rectangle, leaving the top-left corner at the given position.
Definition: qrect.h:368
int intValue
the displayed value rounded to the nearest integer
Definition: qlcdnumber.h:67
QAccessibleDisplay(QWidget *w, Role role=StaticText)
Constructs a QAccessibleDisplay object for w.
QProgressBar * progressBar() const
QMovie * movie() const
Returns a pointer to the label&#39;s movie, or 0 if no movie has been set.
Definition: qlabel.cpp:1468
static QAccessibleInterface * queryAccessibleInterface(QObject *)
If a QAccessibleInterface implementation exists for the given object, this function returns a pointer...
EchoMode echoMode
the line edit&#39;s echo mode
Definition: qlineedit.h:75
void setText(const QString &)
Definition: qlineedit.cpp:401
void selection(int selectionIndex, int *startOffset, int *endOffset)
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
Definition: qstring.cpp:3706
QString selectedText
the selected text
Definition: qlineedit.h:81
QString name(int actionIndex)
Qt::CheckState checkState() const
Returns the check box&#39;s check state.
Definition: qcheckbox.cpp:255
bool isReadOnly() const
Definition: qlineedit.cpp:1493
QVariant invokeMethodEx(Method method, int child, const QVariantList &params)
The QKeySequence class encapsulates a key sequence as used by shortcuts.
Definition: qkeysequence.h:72
QString actionText(int action, Text text, int child) const
If text is Name, then depending on the child or the action, an action text is returned.
bool hasSelectedText
whether there is any text selected
Definition: qlineedit.h:80
State
Definition: qaudio.h:59
QKeySequence shortcut
the mnemonic associated with the button
QString Q_GUI_EXPORT qTextBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, int *startOffset, int *endOffset, const QString &text)
The QAccessibleInterface class defines an interface that exposes information about accessible objects...
Definition: qaccessible.h:370
void addControllingSignal(const QString &signal)
QWidget * widget() const
QRect imagePosition(QAccessible2::CoordinateType coordType)
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 x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
QMenu * menu() const
Returns the associated menu, or 0 if no menu has been defined.
#define st(var, type, card)
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
double value
the displayed value
Definition: qlcdnumber.h:66
QString localizedName(int actionIndex)
QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType, int *startOffset, int *endOffset)
QString actionText(int action, Text text, int child) const
Reimplemented Function
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QFactoryLoader * l
ToolButtonPopupMode popupMode
describes the way that popup menus are used with tool buttons
Definition: qtoolbutton.h:64
bool isDefault() const
The QLabel widget provides a text or image display.
Definition: qlabel.h:55
const QObjectList & children() const
Returns a list of child objects.
Definition: qobject.h:197
QPixmap pixmap
the label&#39;s pixmap
Definition: qlabel.h:60
int value
the progress bar&#39;s current value
Definition: qprogressbar.h:65
T qvariant_cast(const QVariant &)
Definition: qvariant.h:571
The QLCDNumber widget displays a number with LCD-like digits.
Definition: qlcdnumber.h:57
Role role(int child) const
Returns the role of the object, or of the object&#39;s child if child is not 0.
The QLineEdit widget is a one-line text editor.
Definition: qlineedit.h:66
The Animation element is the base of all QML animations.
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
QString title
the group box title text
Definition: qgroupbox.h:61
QVariant invokeMethodEx(QAccessible::Method method, int child, const QVariantList &params)
The QTextDocument class holds formatted text that can be viewed and edited using a QTextEdit...
QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType, int *startOffset, int *endOffset)
void setText(Text t, int control, const QString &text)
Reimplemented Function
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
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...
void click()
Performs a click.
QString description(int actionIndex)
static const Null null
Definition: qstring.h:502
QToolButton * toolButton() const
Returns the button.
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...
void setCursorPosition(int)
Definition: qlineedit.cpp:758
int minimum
the progress bar&#39;s minimum value
Definition: qprogressbar.h:62
The QToolButton class provides a quick-access button to commands or options, usually used inside a QT...
Definition: qtoolbutton.h:59
QString text
the label&#39;s text
Definition: qlabel.h:58
Text
This enum specifies string information that an accessible object returns.
Definition: qaccessible.h:259
int height() const
Returns the height of the font.
const QRect & geometry() const
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.
QStringList keyBindings(int actionIndex)
QString Q_GUI_EXPORT qt_accStripAmp(const QString &text)
State state(int child) const
Returns the current state of the object, or of the object&#39;s child if child is not 0...
QString toolTip
the widget&#39;s tooltip
Definition: qwidget.h:204
The QCheckBox widget provides a checkbox with a text label.
Definition: qcheckbox.h:56
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
int navigate(RelationFlag, int entry, QAccessibleInterface **target) const
Reimplemented Function
#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
QString text(Text t, int child) const
Returns the button&#39;s text label, depending on the text t, and the child.
QPoint mapToGlobal(const QPoint &) const
Translates the widget coordinate pos to global screen coordinates.
QRect characterRect(int offset, QAccessible2::CoordinateType coordType)
int cursorPosition
the current cursor position for this line edit
Definition: qlineedit.h:77
Role role(int child) const
Reimplemented Function
State state(int child) const
Reimplemented Function
void getTextMargins(int *left, int *top, int *right, int *bottom) const
Returns the widget&#39;s text margins for left, top, right, and bottom.
Definition: qlineedit.cpp:1290
#define text
Definition: qobjectdefs.h:80
void animateClick(int msec=100)
Performs an animated click: the button is pressed immediately, and released msec milliseconds later (...
The Text item allows you to add formatted text to a scene.
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288