6#if QT_CONFIG(accessibility)
18#if QT_CONFIG(whatsthis)
24#if QT_CONFIG(rubberband)
31#include <QtWidgets/private/qwidget_p.h>
46#if QT_CONFIG(shortcut) && QT_CONFIG(label)
47 for (
QObject *
o : parent->children()) {
54#if QT_CONFIG(groupbox)
55 QGroupBox *groupbox = qobject_cast<QGroupBox*>(parent);
57 return groupbox->title();
98 qsizetype ampIndex = qt_accAmpIndex(newText);
100 newText.remove(ampIndex, 1);
102 return newText.replace(
"&&"_L1,
"&"_L1);
107#ifndef QT_NO_SHORTCUT
119class QAccessibleWidgetPrivate
122 QAccessibleWidgetPrivate()
126 QAccessible::Role role;
159QAccessibleWidget::QAccessibleWidget(
QWidget *
w, QAccessible::Role role,
const QString &
name)
160: QAccessibleObject(
w)
163 d =
new QAccessibleWidgetPrivate();
169bool QAccessibleWidget::isValid()
const
171 if (!
object() ||
static_cast<QWidget *
>(
object())->d_func()->
data.in_destructor)
173 return QAccessibleObject::isValid();
177QWindow *QAccessibleWidget::window()
const
184 result = nativeParent->windowHandle();
192QAccessibleWidget::~QAccessibleWidget()
200QWidget *QAccessibleWidget::widget()
const
209QObject *QAccessibleWidget::parentObject()
const
212 if (!
w ||
w->isWindow() || !
w->parentWidget())
218QRect QAccessibleWidget::rect()
const
225 return QRect(wpos.x(), wpos.y(),
w->width(),
w->height());
234void QAccessibleWidget::addControllingSignal(
const QString &
signal)
238 qWarning(
"Signal %s unknown in %s",
s.constData(),
object()->metaObject()->className());
253QList<QPair<QAccessibleInterface *, QAccessible::Relation>>
254QAccessibleWidget::relations(QAccessible::Relation
match )
const
256 QList<QPair<QAccessibleInterface *, QAccessible::Relation>> rels;
257 if (
match & QAccessible::Label) {
258 const QAccessible::Relation rel = QAccessible::Label;
260#if QT_CONFIG(shortcut) && QT_CONFIG(label)
264 const QList<QWidget*> kids = _q_ac_childWidgets(parent);
266 if (
QLabel *labelSibling = qobject_cast<QLabel*>(kid)) {
267 if (labelSibling->buddy() ==
widget()) {
268 QAccessibleInterface *
iface = QAccessible::queryAccessibleInterface(labelSibling);
274#if QT_CONFIG(groupbox)
275 QGroupBox *groupbox = qobject_cast<QGroupBox*>(parent);
276 if (groupbox && !groupbox->title().isEmpty()) {
277 QAccessibleInterface *
iface = QAccessible::queryAccessibleInterface(groupbox);
284 if (
match & QAccessible::Controlled) {
287 for (
int sig = 0; sig <
d->primarySignals.size(); ++sig) {
288 const QObjectList receivers = connectionObject->d_func()->receiverList(
d->primarySignals.at(sig).toLatin1());
289 allReceivers += receivers;
294 for (
int i = 0;
i < allReceivers.size(); ++
i) {
295 const QAccessible::Relation rel = QAccessible::Controlled;
296 QAccessibleInterface *
iface = QAccessible::queryAccessibleInterface(allReceivers.at(
i));
306QAccessibleInterface *QAccessibleWidget::parent()
const
308 return QAccessible::queryAccessibleInterface(parentObject());
312QAccessibleInterface *QAccessibleWidget::child(
int index)
const
317 return QAccessible::queryAccessibleInterface(childList.at(
index));
322QAccessibleInterface *QAccessibleWidget::focusChild()
const
325 return QAccessible::queryAccessibleInterface(
object());
331 if (isAncestor(
widget(), fw)) {
332 QAccessibleInterface *
iface = QAccessible::queryAccessibleInterface(fw);
333 if (!iface || iface ==
this || !
iface->focusChild())
335 return iface->focusChild();
341int QAccessibleWidget::childCount()
const
348int QAccessibleWidget::indexOfChild(
const QAccessibleInterface *
child)
const
353 return cl.indexOf(qobject_cast<QWidget *>(
child->object()));
360QString QAccessibleWidget::text(QAccessible::Text
t)
const
365 case QAccessible::Name:
366 if (!
d->name.isEmpty()) {
368 }
else if (!
widget()->accessibleName().isEmpty()) {
371 if (
widget()->isMinimized())
376 str = qt_accStripAmp(buddyString(
widget()));
379 case QAccessible::Description:
381#if QT_CONFIG(tooltip)
386 case QAccessible::Help:
387#if QT_CONFIG(whatsthis)
391 case QAccessible::Accelerator:
392 str = qt_accHotKey(buddyString(
widget()));
394 case QAccessible::Value:
408 names << setFocusAction();
414void QAccessibleWidget::doAction(
const QString &actionName)
419 if (actionName == setFocusAction()) {
433QAccessible::Role QAccessibleWidget::role()
const
445 state.invisible =
true;
447 state.focusable =
true;
449 state.focused =
true;
451 state.disabled =
true;
454 state.movable =
true;
455 if (
w->minimumSize() !=
w->maximumSize())
456 state.sizeable =
true;
457 if (
w->isActiveWindow())
465QColor QAccessibleWidget::foregroundColor()
const
471QColor QAccessibleWidget::backgroundColor()
const
477void *QAccessibleWidget::interface_cast(QAccessible::InterfaceType
t)
479 if (
t == QAccessible::ActionInterface)
480 return static_cast<QAccessibleActionInterface*
>(
this);
The QAccessible class provides enums and static functions related to accessibility.
The QColor class provides colors based on RGB, HSV or CMYK values.
The QGroupBox widget provides a group box frame with a title.
The QKeySequence class encapsulates a key sequence as used by shortcuts.
QString toString(SequenceFormat format=PortableText) const
The QLabel widget provides a text or image display.
qsizetype removeAll(const AT &t)
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
qsizetype indexOf(QLatin1StringView s, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
qsizetype size() const noexcept
Returns the number of characters in this string.
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
Combined button and popup list for selecting options.
constexpr QBindableInterface iface
QList< QString > QStringList
Constructs a string list that contains the given string, str.
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLuint GLsizei const GLchar * label
[43]
QT_BEGIN_NAMESPACE constexpr decltype(auto) qMakePair(T1 &&value1, T2 &&value2) noexcept(noexcept(std::make_pair(std::forward< T1 >(value1), std::forward< T2 >(value2))))
static bool isWindow(QObject *object)
static bool match(const uchar *found, uint foundLen, const char *target, uint targetLen)
static QString windowTitle(HWND hwnd)
obj metaObject() -> className()