diff options
Diffstat (limited to 'src/widgets/itemviews/qtreewidgetitemiterator.cpp')
-rw-r--r-- | src/widgets/itemviews/qtreewidgetitemiterator.cpp | 68 |
1 files changed, 16 insertions, 52 deletions
diff --git a/src/widgets/itemviews/qtreewidgetitemiterator.cpp b/src/widgets/itemviews/qtreewidgetitemiterator.cpp index 1c1f60bc37..1dd677e209 100644 --- a/src/widgets/itemviews/qtreewidgetitemiterator.cpp +++ b/src/widgets/itemviews/qtreewidgetitemiterator.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** 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-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include <private/qtreewidgetitemiterator_p.h> #include "qtreewidget.h" @@ -90,7 +54,7 @@ QTreeWidgetItemIterator::QTreeWidgetItemIterator(const QTreeWidgetItemIterator & */ QTreeWidgetItemIterator::QTreeWidgetItemIterator(QTreeWidget *widget, IteratorFlags flags) -: current(0), flags(flags) +: current(nullptr), flags(flags) { Q_ASSERT(widget); QTreeModel *model = qobject_cast<QTreeModel*>(widget->model()); @@ -168,9 +132,9 @@ QTreeWidgetItemIterator &QTreeWidgetItemIterator::operator=(const QTreeWidgetIte } /*! - The prefix ++ operator (++it) advances the iterator to the next matching item + The prefix \c{++} operator (\c{++it}) advances the iterator to the next matching item and returns a reference to the resulting iterator. - Sets the current pointer to 0 if the current item is the last matching item. + Sets the current pointer to \nullptr if the current item is the last matching item. */ QTreeWidgetItemIterator &QTreeWidgetItemIterator::operator++() @@ -183,9 +147,9 @@ QTreeWidgetItemIterator &QTreeWidgetItemIterator::operator++() } /*! - The prefix -- operator (--it) advances the iterator to the previous matching item + The prefix \c{--} operator (\c{--it}) advances the iterator to the previous matching item and returns a reference to the resulting iterator. - Sets the current pointer to 0 if the current item is the first matching item. + Sets the current pointer to \nullptr if the current item is the first matching item. */ QTreeWidgetItemIterator &QTreeWidgetItemIterator::operator--() @@ -266,7 +230,7 @@ bool QTreeWidgetItemIterator::matchesFlags(const QTreeWidgetItem *item) const QTreeWidgetItem* QTreeWidgetItemIteratorPrivate::nextSibling(const QTreeWidgetItem* item) const { Q_ASSERT(item); - QTreeWidgetItem *next = 0; + QTreeWidgetItem *next = nullptr; if (QTreeWidgetItem *par = item->parent()) { int i = par->indexOfChild(const_cast<QTreeWidgetItem*>(item)); next = par->child(i + 1); @@ -280,9 +244,9 @@ QTreeWidgetItem* QTreeWidgetItemIteratorPrivate::nextSibling(const QTreeWidgetIt QTreeWidgetItem *QTreeWidgetItemIteratorPrivate::next(const QTreeWidgetItem *current) { - if (!current) return 0; + if (!current) return nullptr; - QTreeWidgetItem *next = 0; + QTreeWidgetItem *next = nullptr; if (current->childCount()) { // walk the child m_parentIndex.push(m_currentIndex); @@ -307,9 +271,9 @@ QTreeWidgetItem *QTreeWidgetItemIteratorPrivate::next(const QTreeWidgetItem *cur QTreeWidgetItem *QTreeWidgetItemIteratorPrivate::previous(const QTreeWidgetItem *current) { - if (!current) return 0; + if (!current) return nullptr; - QTreeWidgetItem *prev = 0; + QTreeWidgetItem *prev = nullptr; // walk the previous sibling QTreeWidgetItem *parent = current->parent(); prev = parent ? parent->child(m_currentIndex - 1) @@ -347,7 +311,7 @@ void QTreeWidgetItemIteratorPrivate::ensureValidIterator(const QTreeWidgetItem * // we need to adjust the iterator. if (nextItem == itemToBeRemoved) { QTreeWidgetItem *parent = nextItem; - nextItem = 0; + nextItem = nullptr; while (parent && !nextItem) { nextItem = nextSibling(parent); parent = parent->parent(); @@ -358,7 +322,7 @@ void QTreeWidgetItemIteratorPrivate::ensureValidIterator(const QTreeWidgetItem * if (!(q->matchesFlags(nextItem))) ++(*q); } else { // set it to null. - q->current = 0; + q->current = nullptr; m_parentIndex.clear(); return; } @@ -395,7 +359,7 @@ void QTreeWidgetItemIteratorPrivate::ensureValidIterator(const QTreeWidgetItem * iterator goes backward.) If the current item is beyond the last item, the current item pointer is - set to 0. Returns the resulting iterator. + set to \nullptr. Returns the resulting iterator. */ /*! @@ -411,7 +375,7 @@ void QTreeWidgetItemIteratorPrivate::ensureValidIterator(const QTreeWidgetItem * iterator goes forward.) If the current item is ahead of the last item, the current item pointer is - set to 0. Returns the resulting iterator. + set to \nullptr. Returns the resulting iterator. */ /*! |