Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/QtWidgets/qtreewidgetitemiterator.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QTREEWIDGETITEMITERATOR_H
0005 #define QTREEWIDGETITEMITERATOR_H
0006 
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtCore/qscopedpointer.h>
0009 
0010 QT_REQUIRE_CONFIG(treewidget);
0011 
0012 QT_BEGIN_NAMESPACE
0013 
0014 class QTreeWidget;
0015 class QTreeWidgetItem;
0016 class QTreeModel;
0017 
0018 class QTreeWidgetItemIteratorPrivate;
0019 class Q_WIDGETS_EXPORT QTreeWidgetItemIterator
0020 {
0021     friend class QTreeModel;
0022 
0023 public:
0024     enum IteratorFlag {
0025         All           = 0x00000000,
0026         Hidden        = 0x00000001,
0027         NotHidden     = 0x00000002,
0028         Selected      = 0x00000004,
0029         Unselected    = 0x00000008,
0030         Selectable    = 0x00000010,
0031         NotSelectable = 0x00000020,
0032         DragEnabled   = 0x00000040,
0033         DragDisabled  = 0x00000080,
0034         DropEnabled   = 0x00000100,
0035         DropDisabled  = 0x00000200,
0036         HasChildren   = 0x00000400,
0037         NoChildren    = 0x00000800,
0038         Checked       = 0x00001000,
0039         NotChecked    = 0x00002000,
0040         Enabled       = 0x00004000,
0041         Disabled      = 0x00008000,
0042         Editable      = 0x00010000,
0043         NotEditable   = 0x00020000,
0044         UserFlag      = 0x01000000 // The first flag that can be used by the user.
0045     };
0046     Q_DECLARE_FLAGS(IteratorFlags, IteratorFlag)
0047 
0048     QTreeWidgetItemIterator(const QTreeWidgetItemIterator &it);
0049     explicit QTreeWidgetItemIterator(QTreeWidget *widget, IteratorFlags flags = All);
0050     explicit QTreeWidgetItemIterator(QTreeWidgetItem *item, IteratorFlags flags = All);
0051     ~QTreeWidgetItemIterator();
0052 
0053     QTreeWidgetItemIterator &operator=(const QTreeWidgetItemIterator &it);
0054 
0055     QTreeWidgetItemIterator &operator++();
0056     inline const QTreeWidgetItemIterator operator++(int);
0057     inline QTreeWidgetItemIterator &operator+=(int n);
0058 
0059     QTreeWidgetItemIterator &operator--();
0060     inline const QTreeWidgetItemIterator operator--(int);
0061     inline QTreeWidgetItemIterator &operator-=(int n);
0062 
0063     inline QTreeWidgetItem *operator*() const;
0064 
0065 private:
0066     bool matchesFlags(const QTreeWidgetItem *item) const;
0067     QScopedPointer<QTreeWidgetItemIteratorPrivate> d_ptr;
0068     QTreeWidgetItem *current;
0069     IteratorFlags flags;
0070     Q_DECLARE_PRIVATE(QTreeWidgetItemIterator)
0071 };
0072 
0073 inline const QTreeWidgetItemIterator QTreeWidgetItemIterator::operator++(int)
0074 {
0075     QTreeWidgetItemIterator it = *this;
0076     ++(*this);
0077     return it;
0078 }
0079 
0080 inline const QTreeWidgetItemIterator QTreeWidgetItemIterator::operator--(int)
0081 {
0082     QTreeWidgetItemIterator it = *this;
0083     --(*this);
0084     return it;
0085 }
0086 
0087 inline QTreeWidgetItemIterator &QTreeWidgetItemIterator::operator+=(int n)
0088 {
0089     if (n < 0)
0090         return (*this) -= (-n);
0091     while (current && n--)
0092         ++(*this);
0093     return *this;
0094 }
0095 
0096 inline QTreeWidgetItemIterator &QTreeWidgetItemIterator::operator-=(int n)
0097 {
0098     if (n < 0)
0099         return (*this) += (-n);
0100     while (current && n--)
0101         --(*this);
0102     return *this;
0103 }
0104 
0105 inline QTreeWidgetItem *QTreeWidgetItemIterator::operator*() const
0106 {
0107     return current;
0108 }
0109 
0110 Q_DECLARE_OPERATORS_FOR_FLAGS(QTreeWidgetItemIterator::IteratorFlags)
0111 
0112 QT_END_NAMESPACE
0113 #endif // QTREEWIDGETITEMITERATOR_H