Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qaccessiblequickpage.cpp
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
6#include "qquickpage_p.h"
7
9
14
15QAccessibleInterface *QAccessibleQuickPage::child(int index) const
16{
17 const QList<QQuickItem*> kids = orderedChildItems();
18 if (QQuickItem *item = kids.value(index))
19 return QAccessible::queryAccessibleInterface(item);
20 return nullptr;
21}
22
23int QAccessibleQuickPage::indexOfChild(const QAccessibleInterface *iface) const
24{
25 const QList<QQuickItem*> kids = orderedChildItems();
26 return (int)kids.indexOf(static_cast<QQuickItem*>(iface->object()));
27}
28
29QList<QQuickItem *> QAccessibleQuickPage::orderedChildItems() const
30{
31 // Just ensures that the header is first, and footer is last. Other existing order is kept.
32 const QQuickPage *p = page();
33 QList<QQuickItem*> kids = childItems();
34 const qsizetype hidx = kids.indexOf(p->header());
35 if (hidx != -1)
36 kids.move(hidx, 0);
37 const qsizetype fidx = kids.indexOf(p->footer());
38 if (fidx != -1)
39 kids.move(fidx, kids.size() - 1);
40 return kids;
41}
42
43QQuickPage *QAccessibleQuickPage::page() const
44{
45 return static_cast<QQuickPage*>(object());
46}
47
48QT_END_NAMESPACE
int indexOfChild(const QAccessibleInterface *iface) const override