9#if QT_CONFIG(itemviews)
14#include <private/qtabbar_p.h>
16#if QT_CONFIG(combobox)
19#if QT_CONFIG(lineedit)
27#if QT_CONFIG(whatsthis)
30#include <QAbstractScrollArea>
31#if QT_CONFIG(scrollarea)
34#if QT_CONFIG(scrollbar)
39#if QT_CONFIG(accessibility)
57class QAccessibleTabButton:
public QAccessibleInterface,
public QAccessibleActionInterface
64 void *interface_cast(QAccessible::InterfaceType
t)
override {
65 if (
t == QAccessible::ActionInterface) {
66 return static_cast<QAccessibleActionInterface*
>(
this);
72 QAccessible::Role role()
const override {
return QAccessible::PageTab; }
81 s.focused = (m_index == m_parent->currentIndex());
89 QRect rec = m_parent->tabRect(m_index);
94 bool isValid()
const override {
96 if (
static_cast<QWidget *
>(m_parent.data())->d_func()->data.in_destructor)
98 return m_parent->count() > m_index;
103 QAccessibleInterface *childAt(
int,
int)
const override {
return nullptr; }
104 int childCount()
const override {
return 0; }
105 int indexOfChild(
const QAccessibleInterface *)
const override {
return -1; }
113 case QAccessible::Name:
114 str = m_parent->accessibleTabName(m_index);
116 str = qt_accStripAmp(m_parent->tabText(m_index));
118 case QAccessible::Accelerator:
119 str = qt_accHotKey(m_parent->tabText(m_index));
121#if QT_CONFIG(tooltip)
122 case QAccessible::Description:
123 str = m_parent->tabToolTip(m_index);
126#if QT_CONFIG(whatsthis)
127 case QAccessible::Help:
128 str = m_parent->tabWhatsThis(m_index);
139 QAccessibleInterface *
parent()
const override {
140 return QAccessible::queryAccessibleInterface(m_parent.data());
142 QAccessibleInterface *
child(
int)
const override {
return nullptr; }
150 void doAction(
const QString &actionName)
override
152 if (isValid() && actionName == pressAction())
153 m_parent->setCurrentIndex(m_index);
161 int index()
const {
return m_index; }
172QAccessibleTabBar::QAccessibleTabBar(
QWidget *
w)
178QAccessibleTabBar::~QAccessibleTabBar()
180 for (QAccessible::Id
id :
std::as_const(m_childInterfaces))
185QTabBar *QAccessibleTabBar::tabBar()
const
187 return qobject_cast<QTabBar*>(
object());
190QAccessibleInterface* QAccessibleTabBar::focusChild()
const
192 for (
int i = 0;
i < childCount(); ++
i) {
193 if (
child(
i)->state().focused)
200QAccessibleInterface* QAccessibleTabBar::child(
int index)
const
202 if (QAccessible::Id
id = m_childInterfaces.value(
index))
203 return QAccessible::accessibleInterface(
id);
207 QAccessibleTabButton *
button =
new QAccessibleTabButton(tabBar(),
index);
208 QAccessible::registerAccessibleInterface(
button);
209 m_childInterfaces.insert(
index, QAccessible::uniqueId(
button));
214 return QAccessible::queryAccessibleInterface(tabBar()->d_func()->leftB);
218 return QAccessible::queryAccessibleInterface(tabBar()->d_func()->rightB);
224int QAccessibleTabBar::indexOfChild(
const QAccessibleInterface *
child)
const
226 if (
child->object() &&
child->object() == tabBar()->d_func()->leftB)
227 return tabBar()->count();
228 if (
child->object() &&
child->object() == tabBar()->d_func()->rightB)
229 return tabBar()->count() + 1;
230 if (
child->role() == QAccessible::PageTab) {
233 const QAccessibleTabButton *tabButton =
static_cast<const QAccessibleTabButton *
>(
child);
234 return tabButton->index();
240int QAccessibleTabBar::childCount()
const
243 return tabBar()->count() + 2;
246QString QAccessibleTabBar::text(QAccessible::Text
t)
const
248 if (
t == QAccessible::Name) {
249 const QTabBar *tBar = tabBar();
255 }
else if (
t == QAccessible::Accelerator) {
256 return qt_accHotKey(tabBar()->tabText(tabBar()->currentIndex()));
263#if QT_CONFIG(combobox)
275QAccessibleComboBox::QAccessibleComboBox(
QWidget *
w)
284QComboBox *QAccessibleComboBox::comboBox()
const
286 return qobject_cast<QComboBox*>(
object());
289QAccessibleInterface *QAccessibleComboBox::child(
int index)
const
294 return QAccessible::queryAccessibleInterface(
view);
295 }
else if (
index == 1 && comboBox()->isEditable()) {
296 return QAccessible::queryAccessibleInterface(comboBox()->
lineEdit());
301int QAccessibleComboBox::childCount()
const
304 return comboBox()->isEditable() ? 2 : 1;
307QAccessibleInterface *QAccessibleComboBox::childAt(
int x,
int y)
const
314int QAccessibleComboBox::indexOfChild(
const QAccessibleInterface *
child)
const
316 if (comboBox()->
view() ==
child->object())
318 if (comboBox()->isEditable() && comboBox()->
lineEdit() ==
child->object())
323QAccessibleInterface *QAccessibleComboBox::focusChild()
const
328 if (comboBox()->isEditable())
334QString QAccessibleComboBox::text(QAccessible::Text
t)
const
339 case QAccessible::Name:
341 str = QAccessibleWidget::text(
t);
344 case QAccessible::Value:
345 if (comboBox()->isEditable())
346 str = comboBox()->lineEdit()->text();
348 str = comboBox()->currentText();
350#ifndef QT_NO_SHORTCUT
351 case QAccessible::Accelerator:
359 str = QAccessibleWidget::text(
t);
368 s.expanded = isValid() && comboBox()->view()->isVisible();
369 s.editable = comboBox()->isEditable();
374QStringList QAccessibleComboBox::actionNames()
const
376 return QStringList() << showMenuAction() << pressAction();
379QString QAccessibleComboBox::localizedActionDescription(
const QString &actionName)
const
381 if (actionName == showMenuAction() || actionName == pressAction())
382 return QComboBox::tr(
"Open the combo box selection popup");
386void QAccessibleComboBox::doAction(
const QString &actionName)
388 if (actionName == showMenuAction() || actionName == pressAction()) {
390#if defined(Q_OS_ANDROID)
391 const auto list =
child(0)->tableInterface();
392 if (
list &&
list->selectedRowCount() > 0) {
393 comboBox()->setCurrentIndex(
list->selectedRows().
at(0));
395 comboBox()->setFocus();
397 comboBox()->hidePopup();
399 comboBox()->showPopup();
400#if defined(Q_OS_ANDROID)
401 const auto list =
child(0)->tableInterface();
402 if (
list &&
list->selectedRowCount() > 0) {
403 auto selectedCells =
list->selectedCells();
404 QAccessibleEvent ev(selectedCells.at(0),QAccessible::Focus);
405 QAccessible::updateAccessibility(&ev);
419#if QT_CONFIG(scrollarea)
421QAccessibleAbstractScrollArea::QAccessibleAbstractScrollArea(
QWidget *
widget)
427QAccessibleInterface *QAccessibleAbstractScrollArea::child(
int index)
const
429 return QAccessible::queryAccessibleInterface(accessibleChildren().
at(
index));
432int QAccessibleAbstractScrollArea::childCount()
const
434 return accessibleChildren().size();
437int QAccessibleAbstractScrollArea::indexOfChild(
const QAccessibleInterface *
child)
const
444bool QAccessibleAbstractScrollArea::isValid()
const
446 return (QAccessibleWidget::isValid() && abstractScrollArea() && abstractScrollArea()->
viewport());
449QAccessibleInterface *QAccessibleAbstractScrollArea::childAt(
int x,
int y)
const
454 for (
int i = 0;
i < childCount(); ++
i) {
455 QPoint wpos = accessibleChildren().at(
i)->mapToGlobal(
QPoint(0, 0));
463QAbstractScrollArea *QAccessibleAbstractScrollArea::abstractScrollArea()
const
465 return static_cast<QAbstractScrollArea *
>(
object());
468QWidgetList QAccessibleAbstractScrollArea::accessibleChildren()
const
478 QScrollBar *horizontalScrollBar = abstractScrollArea()->horizontalScrollBar();
479 if (horizontalScrollBar && horizontalScrollBar->
isVisible()) {
482 if (elementType(scrollBarParent) == HorizontalContainer)
483 children.
append(scrollBarParent);
487 QScrollBar *verticalScrollBar = abstractScrollArea()->verticalScrollBar();
488 if (verticalScrollBar && verticalScrollBar->
isVisible()) {
491 if (elementType(scrollBarParent) == VerticalContainer)
492 children.
append(scrollBarParent);
496 QWidget *cornerWidget = abstractScrollArea()->cornerWidget();
497 if (cornerWidget && cornerWidget->
isVisible())
498 children.
append(cornerWidget);
503QAccessibleAbstractScrollArea::AbstractScrollAreaElement
504QAccessibleAbstractScrollArea::elementType(
QWidget *
widget)
const
509 if (
widget == abstractScrollArea())
514 return HorizontalContainer;
516 return VerticalContainer;
517 if (
widget == abstractScrollArea()->cornerWidget())
523bool QAccessibleAbstractScrollArea::isLeftToRight()
const
525 return abstractScrollArea()->isLeftToRight();
530 : QAccessibleAbstractScrollArea(
widget)
The QAbstractItemView class provides the basic functionality for item view classes.
The QAccessible class provides enums and static functions related to accessibility.
The QComboBox widget is a combined button and popup list.
The QKeySequence class encapsulates a key sequence as used by shortcuts.
QString toString(SequenceFormat format=PortableText) const
const_reference at(qsizetype i) const noexcept
void append(parameter_type t)
QString objectName
the name of this object
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
The QTabBar class provides a tab bar, e.g.
int currentIndex
the index of the tab bar's visible tab
QString tabText(int index) const
Returns the text of the tab at position index, or an empty string if index is out of range.
Combined button and popup list for selecting options.
static bool contains(const QJsonArray &haystack, unsigned needle)
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
view viewport() -> scroll(dx, dy, deviceRect)
insertRed setText("insert red text")
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent