Accessible: use range-based for instead of foreach
Change-Id: Idb745f6a59d102f2f89b2cfa5177ec874d7599a8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
46ad794a96
commit
a1e94c8b3b
@ -199,7 +199,7 @@ QAccessibleTabBar::QAccessibleTabBar(QWidget *w)
|
||||
|
||||
QAccessibleTabBar::~QAccessibleTabBar()
|
||||
{
|
||||
foreach (QAccessible::Id id, m_childInterfaces)
|
||||
for (QAccessible::Id id : qAsConst(m_childInterfaces))
|
||||
QAccessible::deleteAccessibleInterface(id);
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ bool QAccessibleTable::isValid() const
|
||||
|
||||
QAccessibleTable::~QAccessibleTable()
|
||||
{
|
||||
Q_FOREACH (QAccessible::Id id, childToId)
|
||||
for (QAccessible::Id id : qAsConst(childToId))
|
||||
QAccessible::deleteAccessibleInterface(id);
|
||||
}
|
||||
|
||||
@ -221,7 +221,7 @@ QList<QAccessibleInterface *> QAccessibleTable::selectedCells() const
|
||||
return cells;
|
||||
const QModelIndexList selectedIndexes = view()->selectionModel()->selectedIndexes();
|
||||
cells.reserve(selectedIndexes.size());
|
||||
Q_FOREACH (const QModelIndex &index, selectedIndexes)
|
||||
for (const QModelIndex &index : selectedIndexes)
|
||||
cells.append(child(logicalIndex(index)));
|
||||
return cells;
|
||||
}
|
||||
@ -233,7 +233,7 @@ QList<int> QAccessibleTable::selectedColumns() const
|
||||
QList<int> columns;
|
||||
const QModelIndexList selectedColumns = view()->selectionModel()->selectedColumns();
|
||||
columns.reserve(selectedColumns.size());
|
||||
Q_FOREACH (const QModelIndex &index, selectedColumns)
|
||||
for (const QModelIndex &index : selectedColumns)
|
||||
columns.append(index.column());
|
||||
|
||||
return columns;
|
||||
@ -246,7 +246,7 @@ QList<int> QAccessibleTable::selectedRows() const
|
||||
QList<int> rows;
|
||||
const QModelIndexList selectedRows = view()->selectionModel()->selectedRows();
|
||||
rows.reserve(selectedRows.size());
|
||||
Q_FOREACH (const QModelIndex &index, selectedRows)
|
||||
for (const QModelIndex &index : selectedRows)
|
||||
rows.append(index.row());
|
||||
|
||||
return rows;
|
||||
@ -553,7 +553,7 @@ void QAccessibleTable::modelChange(QAccessibleTableModelChangeEvent *event)
|
||||
|
||||
switch (event->modelChangeType()) {
|
||||
case QAccessibleTableModelChangeEvent::ModelReset:
|
||||
Q_FOREACH (QAccessible::Id id, childToId)
|
||||
for (QAccessible::Id id : qAsConst(childToId))
|
||||
QAccessible::deleteAccessibleInterface(id);
|
||||
childToId.clear();
|
||||
break;
|
||||
|
@ -117,10 +117,9 @@ QAccessibleInterface *QAccessibleMenu::child(int index) const
|
||||
QAccessibleInterface *QAccessibleMenu::parent() const
|
||||
{
|
||||
if (QAction *menuAction = menu()->menuAction()) {
|
||||
QList<QWidget *> parentCandidates;
|
||||
parentCandidates << menu()->parentWidget();
|
||||
parentCandidates << menuAction->associatedWidgets();
|
||||
foreach (QWidget *w, parentCandidates) {
|
||||
const QList<QWidget*> parentCandidates =
|
||||
QList<QWidget*>() << menu()->parentWidget() << menuAction->associatedWidgets();
|
||||
for (QWidget *w : parentCandidates) {
|
||||
if (qobject_cast<QMenu*>(w)
|
||||
#if QT_CONFIG(menubar)
|
||||
|| qobject_cast<QMenuBar*>(w)
|
||||
|
@ -569,7 +569,7 @@ QCalendarWidget *QAccessibleCalendarWidget::calendarWidget() const
|
||||
|
||||
QAbstractItemView *QAccessibleCalendarWidget::calendarView() const
|
||||
{
|
||||
foreach (QObject *child, calendarWidget()->children()) {
|
||||
for (QObject *child : calendarWidget()->children()) {
|
||||
if (child->objectName() == QLatin1String("qt_calendar_calendarview"))
|
||||
return static_cast<QAbstractItemView *>(child);
|
||||
}
|
||||
@ -578,7 +578,7 @@ QAbstractItemView *QAccessibleCalendarWidget::calendarView() const
|
||||
|
||||
QWidget *QAccessibleCalendarWidget::navigationBar() const
|
||||
{
|
||||
foreach (QObject *child, calendarWidget()->children()) {
|
||||
for (QObject *child : calendarWidget()->children()) {
|
||||
if (child->objectName() == QLatin1String("qt_calendar_navigationbar"))
|
||||
return static_cast<QWidget *>(child);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user