1 /*
2  * DQt - D bindings for the Qt Toolkit
3  *
4  * GNU Lesser General Public License Usage
5  * This file may be used under the terms of the GNU Lesser
6  * General Public License version 3 as published by the Free Software
7  * Foundation and appearing in the file LICENSE.LGPL3 included in the
8  * packaging of this file. Please review the following information to
9  * ensure the GNU Lesser General Public License version 3 requirements
10  * will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
11  */
12 module qt.core.abstractitemmodel;
13 extern(C++):
14 
15 import qt.config;
16 import qt.core.bytearray;
17 import qt.core.datastream;
18 import qt.core.flags;
19 import qt.core.global;
20 import qt.core.hash;
21 import qt.core.list;
22 import qt.core.map;
23 import qt.core.mimedata;
24 import qt.core.namespace;
25 import qt.core.object;
26 import qt.core.size;
27 import qt.core.stringlist;
28 import qt.core.typeinfo;
29 import qt.core.variant;
30 import qt.helpers;
31 
32 /+ QT_REQUIRE_CONFIG(itemmodel); +/
33 
34 
35 /// Binding for C++ class [QModelRoleData](https://doc.qt.io/qt-6/qmodelroledata.html).
36 @Q_RELOCATABLE_TYPE extern(C++, class) struct QModelRoleData
37 {
38 private:
39     int m_role;
40     QVariant m_data;
41 
42 public:
43     /+ explicit +/this(int role)/+ noexcept+/
44     {
45         this.m_role = role;
46     }
47 
48     int role() const/+ noexcept+/ { return m_role; }
49     ref QVariant data()/+ noexcept+/ return { return m_data; }
50     ref const(QVariant) data() const/+ noexcept+/ return { return m_data; }
51 
52     /+ template <typename T> +/
53     /+ constexpr void setData(T &&value) noexcept(noexcept(m_data.setValue(std::forward<T>(value))))
54     { m_data.setValue(std::forward<T>(value)); } +/
55 
56     void clearData()/+ noexcept+/ { m_data.clear(); }
57 }
58 
59 /+ Q_DECLARE_TYPEINFO(QModelRoleData, Q_RELOCATABLE_TYPE); +/
60 
61 
62 extern(C++, "QtPrivate") {
63 struct IsContainerCompatibleWithModelRoleDataSpan(T, Enable) {
64     /+ std:: +/false_type base0;
65     alias base0 this;
66 }
67 
68 /+ template <typename T>
69 struct IsContainerCompatibleWithModelRoleDataSpan<T, std::enable_if_t<std::conjunction_v<
70             // lacking concepts and ranges, we accept any T whose std::data yields a suitable pointer ...
71             std::is_convertible<decltype( std::data(std::declval<T &>()) ), QModelRoleData *>,
72             // ... and that has a suitable size ...
73             std::is_convertible<decltype( std::size(std::declval<T &>()) ), qsizetype>,
74             // ... and it's a range as it defines an iterator-like API
75             std::is_convertible<
76                 typename std::iterator_traits<decltype( std::begin(std::declval<T &>()) )>::value_type,
77                 QModelRoleData
78             >,
79             std::is_convertible<
80                 decltype( std::begin(std::declval<T &>()) != std::end(std::declval<T &>()) ),
81                 bool>,
82             // Don't make an accidental copy constructor
83             std::negation<std::is_same<std::decay_t<T>, QModelRoleDataSpan>>
84         >>> : std::true_type {}; +/
85 } // namespace QtPrivate
86 
87 /// Binding for C++ class [QModelRoleDataSpan](https://doc.qt.io/qt-6/qmodelroledataspan.html).
88 @Q_RELOCATABLE_TYPE extern(C++, class) struct QModelRoleDataSpan
89 {
90 private:
91     QModelRoleData* m_modelRoleData = null;
92     qsizetype m_len = 0;
93 
94     /+ template <typename T> +/
95     alias if_compatible_container(T) = /+ std:: +/enable_if_t!(/+ QtPrivate:: +/IsContainerCompatibleWithModelRoleDataSpan!(T).value, bool);
96 
97 public:
98     @disable this();
99     /+this()/+ noexcept+/ {}+/
100 
101     this(ref QModelRoleData modelRoleData)/+ noexcept+/
102     {
103         this.m_modelRoleData = &modelRoleData;
104         this.m_len = 1;
105     }
106 
107     this(QModelRoleData* modelRoleData, qsizetype len)
108     {
109         this.m_modelRoleData = modelRoleData;
110         this.m_len = len;
111     }
112 
113     /+ template <typename Container, if_compatible_container<Container> = true> +/
114     this(Container,)(ref Container c) /+ noexcept(noexcept(std::data(c)) && noexcept(std::size(c))) +/
115     {
116         this.m_modelRoleData = /+ std:: +/data(c);
117         this.m_len = qsizetype(/+ std:: +/size(c));
118     }
119 
120     qsizetype size() const/+ noexcept+/ { return m_len; }
121     qsizetype length() const/+ noexcept+/ { return m_len; }
122     QModelRoleData* data() /*const*/ /+ noexcept+/ { return m_modelRoleData; }
123     QModelRoleData* begin() /*const*/ /+ noexcept+/ { return m_modelRoleData; }
124     QModelRoleData* end() /*const*/ /+ noexcept+/ { return m_modelRoleData + m_len; }
125     ref QModelRoleData opIndex(qsizetype index) const { return m_modelRoleData[index]; }
126 
127 /+    QVariant* dataForRole(int role) const
128     {
129         static if(defined!"__cpp_lib_constexpr_algorithms")
130         {
131             auto result = /+ std:: +/find_if(begin(), end(), [role](const QModelRoleData &roleData) {
132                 return roleData.role() == role;
133             });
134         }
135         else
136         {
137             auto result = begin();
138             const e = end();
139             for (; result != e; ++result) {
140                 if (result.role() == role)
141                     break;
142             }
143         }
144 
145         return (){ (mixin(Q_ASSERT(q{cast(QModelRoleData*)(result) != QModelRoleDataSpan.end()})));
146 return &result.data();
147 }();
148     }+/
149     mixin(CREATE_CONVENIENCE_WRAPPERS);
150 }
151 
152 /+ Q_DECLARE_TYPEINFO(QModelRoleDataSpan, Q_RELOCATABLE_TYPE); +/
153 
154 
155 /// Binding for C++ class [QModelIndex](https://doc.qt.io/qt-6/qmodelindex.html).
156 @Q_RELOCATABLE_TYPE extern(C++, class) struct QModelIndex
157 {
158 private:
159     /+ friend class QAbstractItemModel; +/
160 public:
161     /+pragma(inline, true) this()/+ noexcept+/
162     {
163         this.r = -1;
164         this.c = -1;
165         this.i = 0;
166         this.m = null;
167     }+/
168     // compiler-generated copy/move ctors/assignment operators are fine!
169     pragma(inline, true) int row() const/+ noexcept+/ { return r; }
170     pragma(inline, true) int column() const/+ noexcept+/ { return c; }
171     pragma(inline, true) quintptr internalId() const/+ noexcept+/ { return i; }
172     pragma(inline, true) void* internalPointer() const/+ noexcept+/ { return reinterpret_cast!(void*)(i); }
173     pragma(inline, true) const(void)* constInternalPointer() const/+ noexcept+/ { return reinterpret_cast!(const(void)*)(i); }
174     pragma(inline, true) QModelIndex parent() const
175     { return m ? m.parent(this) : QModelIndex(); }
176     pragma(inline, true) QModelIndex sibling(int arow, int acolumn) const
177     { auto r = m ? (r == arow && c == acolumn) ? this : m.sibling(arow, acolumn, this) : QModelIndex(); return *cast(QModelIndex*)&r; }
178     pragma(inline, true) QModelIndex siblingAtColumn(int acolumn) const
179     { auto r = m ? (c == acolumn) ? this : m.sibling(r, acolumn, this) : QModelIndex(); return *cast(QModelIndex*)&r; }
180     pragma(inline, true) QModelIndex siblingAtRow(int arow) const
181     { auto r = m ? (r == arow) ? this : m.sibling(arow, c, this) : QModelIndex(); return *cast(QModelIndex*)&r;  }
182     pragma(inline, true) QVariant data(int arole = /+ Qt:: +/qt.core.namespace.ItemDataRole.DisplayRole) const
183     { return m ? m.data(this, arole) : QVariant(); }
184     pragma(inline, true) void multiData(QModelRoleDataSpan roleDataSpan) const
185     { if (m) m.multiData(this, roleDataSpan); }
186     pragma(inline, true) /+ Qt:: +/qt.core.namespace.ItemFlags flags() const
187     { return m ? m.flags(this) : /+ Qt:: +/qt.core.namespace.ItemFlags(); }
188     pragma(inline, true) const(QAbstractItemModel) model() const/+ noexcept+/ { return m; }
189     pragma(inline, true) bool isValid() const/+ noexcept+/ { return (r >= 0) && (c >= 0) && (m !is null); }
190     /+pragma(inline, true) bool operator ==(ref const(QModelIndex) other) const/+ noexcept+/
191         { return (other.r == r) && (other.i == i) && (other.c == c) && (other.m == m); }+/
192     /+pragma(inline, true) bool operator !=(ref const(QModelIndex) other) const/+ noexcept+/
193         { return !(this == other); }+/
194     /+pragma(inline, true) bool operator <(ref const(QModelIndex) other) const/+ noexcept+/
195         {
196             return  r <  other.r
197                 || (r == other.r && (c <  other.c
198                                  || (c == other.c && (i <  other.i
199                                                   || (i == other.i && /+ std:: +/less!(const(QAbstractItemModel))()(m, other.m))))));
200         }+/
201 private:
202     pragma(inline, true) this(int arow, int acolumn, const(void)* ptr, const(QAbstractItemModel) amodel)/+ noexcept+/
203     {
204         this.r = arow;
205         this.c = acolumn;
206         this.i = reinterpret_cast!(quintptr)(ptr);
207         this.m = *cast(QAbstractItemModel*)&amodel;
208     }
209     pragma(inline, true) this(int arow, int acolumn, quintptr id, const(QAbstractItemModel) amodel)/+ noexcept+/
210     {
211         this.r = arow;
212         this.c = acolumn;
213         this.i = id;
214         this.m = *cast(QAbstractItemModel*)&amodel;
215     }
216     int r = -1; int c = -1;
217     quintptr i = 0;
218     /*const*/ QAbstractItemModel m = null;
219     mixin(CREATE_CONVENIENCE_WRAPPERS);
220 }
221 /+ Q_DECLARE_TYPEINFO(QModelIndex, Q_RELOCATABLE_TYPE);
222 
223 #ifndef QT_NO_DEBUG_STREAM
224 Q_CORE_EXPORT QDebug operator<<(QDebug, const QModelIndex &);
225 #endif +/
226 
227 extern(C++, class) struct QPersistentModelIndexData;
228 
229 // qHash is a friend, but we can't use default arguments for friends (§8.3.6.4)
230 /+ size_t qHash(const QPersistentModelIndex &index, size_t seed = 0) noexcept; +/
231 
232 /// Binding for C++ class [QPersistentModelIndex](https://doc.qt.io/qt-6/qpersistentmodelindex.html).
233 @Q_RELOCATABLE_TYPE extern(C++, class) struct /+ Q_CORE_EXPORT +/ QPersistentModelIndex
234 {
235 public:
236 
237     this(ref const(QModelIndex) index);
238     this(ref const(QPersistentModelIndex) other);
239     ~this();
240     /+bool operator <(ref const(QPersistentModelIndex) other) const;+/
241     /+bool operator ==(ref const(QPersistentModelIndex) other) const;+/
242     /+pragma(inline, true) bool operator !=(ref const(QPersistentModelIndex) other) const
243     { return !operator==(other); }+/
244     /+ref QPersistentModelIndex operator =(ref const(QPersistentModelIndex) other);+/
245     /+ inline QPersistentModelIndex(QPersistentModelIndex &&other) noexcept
246         : d(qExchange(other.d, nullptr)) {} +/
247     /+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPersistentModelIndex) +/
248     /+ inline void swap(QPersistentModelIndex &other) noexcept { qSwap(d, other.d); } +/
249     /+bool operator ==(ref const(QModelIndex) other) const;+/
250     /+bool operator !=(ref const(QModelIndex) other) const;+/
251     /+ref QPersistentModelIndex operator =(ref const(QModelIndex) other);+/
252     /+auto opCast(T : QModelIndex)() const;+/
253     int row() const;
254     int column() const;
255     void* internalPointer() const;
256     const(void)* constInternalPointer() const;
257     quintptr internalId() const;
258     QModelIndex parent() const;
259     QModelIndex sibling(int row, int column) const;
260     QVariant data(int role = /+ Qt:: +/qt.core.namespace.ItemDataRole.DisplayRole) const;
261     void multiData(QModelRoleDataSpan roleDataSpan) const;
262     /+ Qt:: +/qt.core.namespace.ItemFlags flags() const;
263     mixin(changeWindowsMangling(q{mangleClassesTailConst}, q{
264     const(QAbstractItemModel) model() const;
265     }));
266     bool isValid() const;
267 private:
268     QPersistentModelIndexData* d;
269     /+ friend size_t qHash(const QPersistentModelIndex &, size_t seed) noexcept; +/
270     /+ friend bool qHashEquals(const QPersistentModelIndex &a, const QPersistentModelIndex &b) noexcept
271     { return a.d == b.d; } +/
272 /+ #ifndef QT_NO_DEBUG_STREAM
273     friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QPersistentModelIndex &);
274 #endif +/
275     mixin(CREATE_CONVENIENCE_WRAPPERS);
276 }
277 /+ Q_DECLARE_SHARED(QPersistentModelIndex)
278 
279 inline size_t qHash(const QPersistentModelIndex &index, size_t seed) noexcept
280 { return qHash(index.d, seed); }
281 
282 
283 #ifndef QT_NO_DEBUG_STREAM
284 Q_CORE_EXPORT QDebug operator<<(QDebug, const QPersistentModelIndex &);
285 #endif +/
286 
287 alias QModelIndexList = QList!(QModelIndex);
288 
289 extern(C++, class) struct QAbstractItemModelPrivate;
290 extern(C++, class) struct QTransposeProxyModelPrivate;
291 
292 
293 /// Binding for C++ class [QAbstractItemModel](https://doc.qt.io/qt-6/qabstractitemmodel.html).
294 abstract class /+ Q_CORE_EXPORT +/ QAbstractItemModel : QObject
295 {
296     mixin(Q_OBJECT);
297 
298     /+ friend class QPersistentModelIndexData; +/
299     /+ friend class QAbstractItemViewPrivate; +/
300     /+ friend class QAbstractProxyModel; +/
301 public:
302 
303     mixin(changeItaniumMangling(q{mangleConstructorBaseObject}, q{
304     /+ explicit +/this(QObject parent = null);
305     }));
306     /+ virtual +/~this();
307 
308     @QInvokable final bool hasIndex(int row, int column, ref const(QModelIndex) parent = globalInitVar!QModelIndex) const;
309     /+ virtual +/ @QInvokable abstract QModelIndex index(int row, int column,
310                                   ref const(QModelIndex) parent = globalInitVar!QModelIndex) const;
311     /+ virtual +/ @QInvokable abstract QModelIndex parent(ref const(QModelIndex) child) const;
312 
313     /+ virtual +/ @QInvokable QModelIndex sibling(int row, int column, ref const(QModelIndex) idx) const;
314     /+ virtual +/ @QInvokable abstract int rowCount(ref const(QModelIndex) parent = globalInitVar!QModelIndex) const;
315     /+ virtual +/ @QInvokable abstract int columnCount(ref const(QModelIndex) parent = globalInitVar!QModelIndex) const;
316     /+ virtual +/ @QInvokable bool hasChildren(ref const(QModelIndex) parent = globalInitVar!QModelIndex) const;
317 
318     /+ virtual +/ @QInvokable abstract QVariant data(ref const(QModelIndex) index, int role = /+ Qt:: +/qt.core.namespace.ItemDataRole.DisplayRole) const;
319     /+ virtual +/ @QInvokable bool setData(ref const(QModelIndex) index, ref const(QVariant) value, int role = /+ Qt:: +/qt.core.namespace.ItemDataRole.EditRole);
320 
321     /+ virtual +/ @QInvokable QVariant headerData(int section, /+ Qt:: +/qt.core.namespace.Orientation orientation,
322                                     int role = /+ Qt:: +/qt.core.namespace.ItemDataRole.DisplayRole) const;
323     /+ virtual +/ bool setHeaderData(int section, /+ Qt:: +/qt.core.namespace.Orientation orientation, ref const(QVariant) value,
324                                    int role = /+ Qt:: +/qt.core.namespace.ItemDataRole.EditRole);
325 
326     /+ virtual +/ QMap!(int, QVariant) itemData(ref const(QModelIndex) index) const;
327     /+ virtual +/ bool setItemData(ref const(QModelIndex) index, ref const(QMap!(int, QVariant)) roles);
328     /+ virtual +/ bool clearItemData(ref const(QModelIndex) index);
329 
330     /+ virtual +/ QStringList mimeTypes() const;
331     /+ virtual +/ QMimeData mimeData(ref const(QModelIndexList) indexes) const;
332     mixin(changeWindowsMangling(q{mangleClassesTailConst}, q{
333     /+ virtual +/ bool canDropMimeData(const(QMimeData) data, /+ Qt:: +/qt.core.namespace.DropAction action,
334                                      int row, int column, ref const(QModelIndex) parent) const;
335     }));
336     mixin(changeWindowsMangling(q{mangleClassesTailConst}, q{
337     /+ virtual +/ bool dropMimeData(const(QMimeData) data, /+ Qt:: +/qt.core.namespace.DropAction action,
338                                   int row, int column, ref const(QModelIndex) parent);
339     }));
340     /+ virtual +/ /+ Qt:: +/qt.core.namespace.DropActions supportedDropActions() const;
341     /+ virtual +/ /+ Qt:: +/qt.core.namespace.DropActions supportedDragActions() const;
342 
343     /+ virtual +/ bool insertRows(int row, int count, ref const(QModelIndex) parent = globalInitVar!QModelIndex);
344     /+ virtual +/ bool insertColumns(int column, int count, ref const(QModelIndex) parent = globalInitVar!QModelIndex);
345     /+ virtual +/ bool removeRows(int row, int count, ref const(QModelIndex) parent = globalInitVar!QModelIndex);
346     /+ virtual +/ bool removeColumns(int column, int count, ref const(QModelIndex) parent = globalInitVar!QModelIndex);
347     /+ virtual +/ bool moveRows(ref const(QModelIndex) sourceParent, int sourceRow, int count,
348                               ref const(QModelIndex) destinationParent, int destinationChild);
349     /+ virtual +/ bool moveColumns(ref const(QModelIndex) sourceParent, int sourceColumn, int count,
350                                  ref const(QModelIndex) destinationParent, int destinationChild);
351 
352     pragma(inline, true) final bool insertRow(int arow, ref const(QModelIndex) aparent = globalInitVar!QModelIndex)
353     { return insertRows(arow, 1, aparent); }
354     pragma(inline, true) final bool insertColumn(int acolumn, ref const(QModelIndex) aparent = globalInitVar!QModelIndex)
355     { return insertColumns(acolumn, 1, aparent); }
356     pragma(inline, true) final bool removeRow(int arow, ref const(QModelIndex) aparent = globalInitVar!QModelIndex)
357     { return removeRows(arow, 1, aparent); }
358     pragma(inline, true) final bool removeColumn(int acolumn, ref const(QModelIndex) aparent = globalInitVar!QModelIndex)
359     { return removeColumns(acolumn, 1, aparent); }
360     pragma(inline, true) final bool moveRow(ref const(QModelIndex) sourceParent, int sourceRow,
361                             ref const(QModelIndex) destinationParent, int destinationChild)
362     { return moveRows(sourceParent, sourceRow, 1, destinationParent, destinationChild); }
363     pragma(inline, true) final bool moveColumn(ref const(QModelIndex) sourceParent, int sourceColumn,
364                                ref const(QModelIndex) destinationParent, int destinationChild)
365     { return moveColumns(sourceParent, sourceColumn, 1, destinationParent, destinationChild); }
366 
367     /+ virtual +/ @QInvokable void fetchMore(ref const(QModelIndex) parent);
368     /+ virtual +/ @QInvokable bool canFetchMore(ref const(QModelIndex) parent) const;
369     /+ virtual +/ @QInvokable /+ Qt:: +/qt.core.namespace.ItemFlags flags(ref const(QModelIndex) index) const;
370     /+ virtual +/ void sort(int column, /+ Qt:: +/qt.core.namespace.SortOrder order = /+ Qt:: +/qt.core.namespace.SortOrder.AscendingOrder);
371     /+ virtual +/ QModelIndex buddy(ref const(QModelIndex) index) const;
372     /+ virtual +/ @QInvokable QModelIndexList match(ref const(QModelIndex) start, int role,
373                                                   ref const(QVariant) value, int hits = 1,
374                                                   /+ Qt:: +/qt.core.namespace.MatchFlags flags =
375                                                   /+ Qt:: +/qt.core.namespace.MatchFlags(/+ Qt:: +/qt.core.namespace.MatchFlag.MatchStartsWith|/+ Qt:: +/qt.core.namespace.MatchFlag.MatchWrap)) const;
376     /+ virtual +/ QSize span(ref const(QModelIndex) index) const;
377 
378     /+ virtual +/ QHash!(int,QByteArray) roleNames() const;
379 
380     /+ using QObject::parent; +/
381 
382     enum LayoutChangeHint
383     {
384         NoLayoutChangeHint,
385         VerticalSortHint,
386         HorizontalSortHint
387     }
388     /+ Q_ENUM(LayoutChangeHint) +/
389 
390     enum /+ class +/ CheckIndexOption {
391         NoOption         = 0x0000,
392         IndexIsValid     = 0x0001,
393         DoNotUseParent   = 0x0002,
394         ParentIsInvalid  = 0x0004,
395     }
396     /+ Q_ENUM(CheckIndexOption) +/
397     /+ Q_DECLARE_FLAGS(CheckIndexOptions, CheckIndexOption) +/
398 alias CheckIndexOptions = QFlags!(CheckIndexOption);
399     /+ [[nodiscard]] +/ final bool checkIndex(ref const(QModelIndex) index, CheckIndexOptions options = CheckIndexOption.NoOption) const;
400 
401     /+ virtual +/ void multiData(ref const(QModelIndex) index, QModelRoleDataSpan roleDataSpan) const;
402 
403 /+ Q_SIGNALS +/public:
404     @QSignal final void dataChanged(ref const(QModelIndex) topLeft, ref const(QModelIndex) bottomRight,
405                          ref const(QList!(int)) roles = globalInitVar!(QList!(int)));
406     @QSignal final void headerDataChanged(/+ Qt:: +/qt.core.namespace.Orientation orientation, int first, int last);
407     @QSignal final void layoutChanged(ref const(QList!(QPersistentModelIndex)) parents = globalInitVar!(QList!(QPersistentModelIndex)), LayoutChangeHint hint = LayoutChangeHint.NoLayoutChangeHint);
408     @QSignal final void layoutAboutToBeChanged(ref const(QList!(QPersistentModelIndex)) parents = globalInitVar!(QList!(QPersistentModelIndex)), LayoutChangeHint hint = LayoutChangeHint.NoLayoutChangeHint);
409 
410     @QSignal final void rowsAboutToBeInserted(ref const(QModelIndex) parent, int first, int last, QPrivateSignal);
411     @QSignal final void rowsInserted(ref const(QModelIndex) parent, int first, int last, QPrivateSignal);
412 
413     @QSignal final void rowsAboutToBeRemoved(ref const(QModelIndex) parent, int first, int last, QPrivateSignal);
414     @QSignal final void rowsRemoved(ref const(QModelIndex) parent, int first, int last, QPrivateSignal);
415 
416     @QSignal final void columnsAboutToBeInserted(ref const(QModelIndex) parent, int first, int last, QPrivateSignal);
417     @QSignal final void columnsInserted(ref const(QModelIndex) parent, int first, int last, QPrivateSignal);
418 
419     @QSignal final void columnsAboutToBeRemoved(ref const(QModelIndex) parent, int first, int last, QPrivateSignal);
420     @QSignal final void columnsRemoved(ref const(QModelIndex) parent, int first, int last, QPrivateSignal);
421 
422     @QSignal final void modelAboutToBeReset(QPrivateSignal);
423     @QSignal final void modelReset(QPrivateSignal);
424 
425     @QSignal final void rowsAboutToBeMoved( ref const(QModelIndex) sourceParent, int sourceStart, int sourceEnd, ref const(QModelIndex) destinationParent, int destinationRow, QPrivateSignal);
426     @QSignal final void rowsMoved( ref const(QModelIndex) parent, int start, int end, ref const(QModelIndex) destination, int row, QPrivateSignal);
427 
428     @QSignal final void columnsAboutToBeMoved( ref const(QModelIndex) sourceParent, int sourceStart, int sourceEnd, ref const(QModelIndex) destinationParent, int destinationColumn, QPrivateSignal);
429     @QSignal final void columnsMoved( ref const(QModelIndex) parent, int start, int end, ref const(QModelIndex) destination, int column, QPrivateSignal);
430 
431 public /+ Q_SLOTS +/:
432     /+ virtual +/ @QSlot bool submit();
433     /+ virtual +/ @QSlot void revert();
434 
435 protected /+ Q_SLOTS +/:
436     /+ virtual +/ @QSlot void resetInternalData();
437 
438 protected:
439     mixin(changeItaniumMangling(q{mangleConstructorBaseObject}, q{
440     this(ref QAbstractItemModelPrivate dd, QObject parent = null);
441     }));
442 
443     pragma(inline, true) final QModelIndex createIndex(int arow, int acolumn, const(void)* adata = null) const
444     { return QModelIndex(arow, acolumn, adata, this); }
445     pragma(inline, true) final QModelIndex createIndex(int arow, int acolumn, quintptr aid) const
446     { return QModelIndex(arow, acolumn, aid, this); }
447 
448     final void encodeData(ref const(QModelIndexList) indexes, ref QDataStream stream) const;
449     final bool decodeData(int row, int column, ref const(QModelIndex) parent, ref QDataStream stream);
450 
451     final void beginInsertRows(ref const(QModelIndex) parent, int first, int last);
452     final void endInsertRows();
453 
454     final void beginRemoveRows(ref const(QModelIndex) parent, int first, int last);
455     final void endRemoveRows();
456 
457     final bool beginMoveRows(ref const(QModelIndex) sourceParent, int sourceFirst, int sourceLast, ref const(QModelIndex) destinationParent, int destinationRow);
458     final void endMoveRows();
459 
460     final void beginInsertColumns(ref const(QModelIndex) parent, int first, int last);
461     final void endInsertColumns();
462 
463     final void beginRemoveColumns(ref const(QModelIndex) parent, int first, int last);
464     final void endRemoveColumns();
465 
466     final bool beginMoveColumns(ref const(QModelIndex) sourceParent, int sourceFirst, int sourceLast, ref const(QModelIndex) destinationParent, int destinationColumn);
467     final void endMoveColumns();
468 
469     final void beginResetModel();
470     final void endResetModel();
471 
472     final void changePersistentIndex(ref const(QModelIndex) from, ref const(QModelIndex) to);
473     final void changePersistentIndexList(ref const(QModelIndexList) from, ref const(QModelIndexList) to);
474     final QModelIndexList persistentIndexList() const;
475 
476 private:
477     /+ Q_DECLARE_PRIVATE(QAbstractItemModel) +/
478     /+ Q_DISABLE_COPY(QAbstractItemModel) +/
479     mixin(CREATE_CONVENIENCE_WRAPPERS);
480 }
481 /+pragma(inline, true) QFlags!(QAbstractItemModel.CheckIndexOptions.enum_type) operator |(QAbstractItemModel.CheckIndexOptions.enum_type f1, QAbstractItemModel.CheckIndexOptions.enum_type f2)/+noexcept+/{return QFlags!(QAbstractItemModel.CheckIndexOptions.enum_type)(f1)|f2;}+/
482 /+pragma(inline, true) QFlags!(QAbstractItemModel.CheckIndexOptions.enum_type) operator |(QAbstractItemModel.CheckIndexOptions.enum_type f1, QFlags!(QAbstractItemModel.CheckIndexOptions.enum_type) f2)/+noexcept+/{return f2|f1;}+/
483 /+pragma(inline, true) QFlags!(QAbstractItemModel.CheckIndexOptions.enum_type) operator &(QAbstractItemModel.CheckIndexOptions.enum_type f1, QAbstractItemModel.CheckIndexOptions.enum_type f2)/+noexcept+/{return QFlags!(QAbstractItemModel.CheckIndexOptions.enum_type)(f1)&f2;}+/
484 /+pragma(inline, true) QFlags!(QAbstractItemModel.CheckIndexOptions.enum_type) operator &(QAbstractItemModel.CheckIndexOptions.enum_type f1, QFlags!(QAbstractItemModel.CheckIndexOptions.enum_type) f2)/+noexcept+/{return f2&f1;}+/
485 /+pragma(inline, true) void operator +(QAbstractItemModel.CheckIndexOptions.enum_type f1, QAbstractItemModel.CheckIndexOptions.enum_type f2)/+noexcept+/;+/
486 /+pragma(inline, true) void operator +(QAbstractItemModel.CheckIndexOptions.enum_type f1, QFlags!(QAbstractItemModel.CheckIndexOptions.enum_type) f2)/+noexcept+/;+/
487 /+pragma(inline, true) void operator +(int f1, QFlags!(QAbstractItemModel.CheckIndexOptions.enum_type) f2)/+noexcept+/;+/
488 /+pragma(inline, true) void operator -(QAbstractItemModel.CheckIndexOptions.enum_type f1, QAbstractItemModel.CheckIndexOptions.enum_type f2)/+noexcept+/;+/
489 /+pragma(inline, true) void operator -(QAbstractItemModel.CheckIndexOptions.enum_type f1, QFlags!(QAbstractItemModel.CheckIndexOptions.enum_type) f2)/+noexcept+/;+/
490 /+pragma(inline, true) void operator -(int f1, QFlags!(QAbstractItemModel.CheckIndexOptions.enum_type) f2)/+noexcept+/;+/
491 /+pragma(inline, true) QIncompatibleFlag operator |(QAbstractItemModel.CheckIndexOptions.enum_type f1, int f2)/+noexcept+/{return QIncompatibleFlag(int(f1)|f2);}+/
492 /+pragma(inline, true) void operator +(int f1, QAbstractItemModel.CheckIndexOptions.enum_type f2)/+noexcept+/;+/
493 /+pragma(inline, true) void operator +(QAbstractItemModel.CheckIndexOptions.enum_type f1, int f2)/+noexcept+/;+/
494 /+pragma(inline, true) void operator -(int f1, QAbstractItemModel.CheckIndexOptions.enum_type f2)/+noexcept+/;+/
495 /+pragma(inline, true) void operator -(QAbstractItemModel.CheckIndexOptions.enum_type f1, int f2)/+noexcept+/;+/
496 
497 /+ Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractItemModel::CheckIndexOptions) +/
498 /// Binding for C++ class [QAbstractTableModel](https://doc.qt.io/qt-6/qabstracttablemodel.html).
499 abstract class /+ Q_CORE_EXPORT +/ QAbstractTableModel : QAbstractItemModel
500 {
501     mixin(Q_OBJECT);
502 
503 public:
504     mixin(changeItaniumMangling(q{mangleConstructorBaseObject}, q{
505     /+ explicit +/this(QObject parent = null);
506     }));
507     ~this();
508 
509     override QModelIndex index(int row, int column, ref const(QModelIndex) parent = globalInitVar!QModelIndex) const;
510     override QModelIndex sibling(int row, int column, ref const(QModelIndex) idx) const;
511     mixin(changeWindowsMangling(q{mangleClassesTailConst}, q{
512     override bool dropMimeData(const(QMimeData) data, /+ Qt:: +/qt.core.namespace.DropAction action,
513                           int row, int column, ref const(QModelIndex) parent);
514     }));
515 
516     override /+ Qt:: +/qt.core.namespace.ItemFlags flags(ref const(QModelIndex) index) const;
517 
518     /+ using QObject::parent; +/
519 
520 protected:
521     mixin(changeItaniumMangling(q{mangleConstructorBaseObject}, q{
522     this(ref QAbstractItemModelPrivate dd, QObject parent);
523     }));
524 
525 /*private:*/
526     /+ Q_DISABLE_COPY(QAbstractTableModel) +/
527     mixin(changeWindowsMangling(q{mangleChangeAccess("private")}, q{
528     override QModelIndex parent(ref const(QModelIndex) child) const;
529     }));
530     mixin(changeWindowsMangling(q{mangleChangeAccess("private")}, q{
531     override bool hasChildren(ref const(QModelIndex) parent) const;
532     }));
533     mixin(CREATE_CONVENIENCE_WRAPPERS);
534 }
535 
536 /// Binding for C++ class [QAbstractListModel](https://doc.qt.io/qt-6/qabstractlistmodel.html).
537 abstract class /+ Q_CORE_EXPORT +/ QAbstractListModel : QAbstractItemModel
538 {
539     mixin(Q_OBJECT);
540 
541 public:
542     mixin(changeItaniumMangling(q{mangleConstructorBaseObject}, q{
543     /+ explicit +/this(QObject parent = null);
544     }));
545     ~this();
546 
547     override QModelIndex index(int row, int column = 0, ref const(QModelIndex) parent = globalInitVar!QModelIndex) const;
548     override QModelIndex sibling(int row, int column, ref const(QModelIndex) idx) const;
549     mixin(changeWindowsMangling(q{mangleClassesTailConst}, q{
550     override bool dropMimeData(const(QMimeData) data, /+ Qt:: +/qt.core.namespace.DropAction action,
551                           int row, int column, ref const(QModelIndex) parent);
552     }));
553 
554     override /+ Qt:: +/qt.core.namespace.ItemFlags flags(ref const(QModelIndex) index) const;
555 
556     /+ using QObject::parent; +/
557 
558 protected:
559     mixin(changeItaniumMangling(q{mangleConstructorBaseObject}, q{
560     this(ref QAbstractItemModelPrivate dd, QObject parent);
561     }));
562 
563 /*private:*/
564     /+ Q_DISABLE_COPY(QAbstractListModel) +/
565     mixin(changeWindowsMangling(q{mangleChangeAccess("private")}, q{
566     override QModelIndex parent(ref const(QModelIndex) child) const;
567     }));
568     mixin(changeWindowsMangling(q{mangleChangeAccess("private")}, q{
569     override int columnCount(ref const(QModelIndex) parent) const;
570     }));
571     mixin(changeWindowsMangling(q{mangleChangeAccess("private")}, q{
572     override bool hasChildren(ref const(QModelIndex) parent) const;
573     }));
574     mixin(CREATE_CONVENIENCE_WRAPPERS);
575 }
576 
577 // inline implementations
578 
579 /+ inline size_t qHash(const QModelIndex &index, size_t seed = 0) noexcept
580 { return size_t((size_t(index.row()) << 4) + size_t(index.column()) + index.internalId()) ^ seed; }
581 
582 
583 Q_DECLARE_METATYPE(QModelIndexList) +/
584