diff options
Diffstat (limited to 'tests/auto/other/qabstractitemmodelutils/dynamictreemodel.cpp')
-rw-r--r-- | tests/auto/other/qabstractitemmodelutils/dynamictreemodel.cpp | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.cpp b/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.cpp index ecc95d30b6..d670cec196 100644 --- a/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.cpp +++ b/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Stephen Kelly <steveire@gmail.com> -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2009 Stephen Kelly <steveire@gmail.com> +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "dynamictreemodel.h" @@ -216,7 +191,7 @@ void ModelMoveCommand::doCommand() return; for (int column = 0; column < m_numCols; ++column) { - QList<qint64> l = m_model->m_childItems.value(srcParent.internalId())[column].mid( + const QList<qint64> l = m_model->m_childItems.value(srcParent.internalId())[column].mid( m_startRow, m_endRow - m_startRow + 1); for (int i = m_startRow; i <= m_endRow; i++) @@ -231,7 +206,7 @@ void ModelMoveCommand::doCommand() d = m_destRow; } - foreach (const qint64 id, l) + for (qint64 id : l) m_model->m_childItems[destParent.internalId()][column].insert(d++, id); } @@ -308,9 +283,7 @@ void ModelChangeChildrenLayoutsCommand::doCommand() const QPersistentModelIndex parent1 = findIndex(m_rowNumbers); const QPersistentModelIndex parent2 = findIndex(m_secondRowNumbers); - QList<QPersistentModelIndex> parents; - parents << parent1; - parents << parent2; + const QList<QPersistentModelIndex> parents = { parent1, parent2 }; emit m_model->layoutAboutToBeChanged(parents); @@ -334,13 +307,13 @@ void ModelChangeChildrenLayoutsCommand::doCommand() // changing any children of that parent. The reason is that we're keeping parent1 and parent2 // around as QPersistentModelIndex instances, and we query idx.parent() in the loop. QModelIndexList persistent = m_model->persistentIndexList(); - foreach (const QModelIndex &parent, parents) { + for (const QPersistentModelIndex &parent : parents) { int idx = persistent.indexOf(parent); if (idx != -1) persistent.move(idx, 0); } - foreach (const QModelIndex &idx, persistent) { + for (const QModelIndex &idx : std::as_const(persistent)) { if (idx.parent() == parent1) { if (idx.row() == rowSize1 - 1) { m_model->changePersistentIndex(idx, |