File indexing completed on 2025-01-26 03:28:30
0001 /* 0002 SPDX-FileCopyrightText: 2012 Frederik Gladhorn <gladhorn@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #include "accessiblewrapper.h" 0008 0009 AccessibleWrapper::AccessibleWrapper(const QAccessibleClient::AccessibleObject &object, AccessibleWrapper *parent) 0010 : acc(object) 0011 , mParent(parent) 0012 { 0013 } 0014 0015 AccessibleWrapper::~AccessibleWrapper() 0016 { 0017 qDeleteAll(mChildren); 0018 } 0019 0020 int AccessibleWrapper::childCount() const 0021 { 0022 if (mChildren.isEmpty()) 0023 return acc.childCount(); 0024 return mChildren.count(); 0025 } 0026 0027 AccessibleWrapper *AccessibleWrapper::parent() const 0028 { 0029 return mParent; 0030 } 0031 0032 AccessibleWrapper *AccessibleWrapper::child(int index) 0033 { 0034 if (mChildren.isEmpty()) { 0035 const QList<QAccessibleClient::AccessibleObject> children = acc.children(); 0036 for (const QAccessibleClient::AccessibleObject &c : children) { 0037 mChildren.append(new AccessibleWrapper(c, this)); 0038 } 0039 } 0040 if (index >= 0 && index < mChildren.count()) { 0041 return mChildren.at(index); 0042 } 0043 return nullptr; 0044 }