Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qtreewidgetitemiterator.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QTREEWIDGETITEMITERATOR_H
5#define QTREEWIDGETITEMITERATOR_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtCore/qscopedpointer.h>
9
11
13
14class QTreeWidget;
15class QTreeWidgetItem;
16class QTreeModel;
17
18class QTreeWidgetItemIteratorPrivate;
19class Q_WIDGETS_EXPORT QTreeWidgetItemIterator
20{
21 friend class QTreeModel;
22
23public:
25 All = 0x00000000,
26 Hidden = 0x00000001,
27 NotHidden = 0x00000002,
28 Selected = 0x00000004,
29 Unselected = 0x00000008,
30 Selectable = 0x00000010,
31 NotSelectable = 0x00000020,
32 DragEnabled = 0x00000040,
33 DragDisabled = 0x00000080,
34 DropEnabled = 0x00000100,
35 DropDisabled = 0x00000200,
36 HasChildren = 0x00000400,
37 NoChildren = 0x00000800,
38 Checked = 0x00001000,
39 NotChecked = 0x00002000,
40 Enabled = 0x00004000,
41 Disabled = 0x00008000,
42 Editable = 0x00010000,
43 NotEditable = 0x00020000,
44 UserFlag = 0x01000000 // The first flag that can be used by the user.
45 };
46 Q_DECLARE_FLAGS(IteratorFlags, IteratorFlag)
47
49 explicit QTreeWidgetItemIterator(QTreeWidget *widget, IteratorFlags flags = All);
50 explicit QTreeWidgetItemIterator(QTreeWidgetItem *item, IteratorFlags flags = All);
52
54
55 QTreeWidgetItemIterator &operator++();
56 inline const QTreeWidgetItemIterator operator++(int);
58
59 QTreeWidgetItemIterator &operator--();
60 inline const QTreeWidgetItemIterator operator--(int);
61 inline QTreeWidgetItemIterator &operator-=(int n);
62
63 inline QTreeWidgetItem *operator*() const;
64
65private:
66 bool matchesFlags(const QTreeWidgetItem *item) const;
67 QScopedPointer<QTreeWidgetItemIteratorPrivate> d_ptr;
68 QTreeWidgetItem *current;
69 IteratorFlags flags;
70 Q_DECLARE_PRIVATE(QTreeWidgetItemIterator)
71};
72
74{
76 ++(*this);
77 return it;
78}
79
81{
83 --(*this);
84 return it;
85}
86
88{
89 if (n < 0)
90 return (*this) -= (-n);
91 while (current && n--)
92 ++(*this);
93 return *this;
94}
95
97{
98 if (n < 0)
99 return (*this) += (-n);
100 while (current && n--)
101 --(*this);
102 return *this;
103}
104
106{
107 return current;
108}
109
110Q_DECLARE_OPERATORS_FOR_FLAGS(QTreeWidgetItemIterator::IteratorFlags)
111
113#endif // QTREEWIDGETITEMITERATOR_H
IteratorFlag
These flags can be passed to a QTreeWidgetItemIterator constructor (OR-ed together if more than one i...
QTreeWidgetItem * operator*() const
Dereference operator.
QTreeWidgetItemIterator & operator++()
The prefix {++} operator ({++it}) advances the iterator to the next matching item and returns a refer...
QTreeWidgetItemIterator & operator--()
The prefix {–} operator ({–it}) advances the iterator to the previous matching item and returns a ref...
QTreeWidgetItemIterator & operator-=(int n)
Makes the iterator go backward by n matching items.
QTreeWidgetItemIterator & operator+=(int n)
Makes the iterator go forward by n matching items.
The QTreeWidgetItem class provides an item for use with the QTreeWidget convenience class.
Definition qtreewidget.h:23
The QTreeWidget class provides a tree view that uses a predefined tree model.
QOpenGLWidget * widget
[1]
QSet< QString >::iterator it
Combined button and popup list for selecting options.
constexpr timespec operator*(const timespec &t1, int mul)
constexpr timespec & operator+=(timespec &t1, const timespec &t2)
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
GLbitfield flags
GLfloat n
#define QT_REQUIRE_CONFIG(feature)
QGraphicsItem * item