1 /**************************************************************************** 2 ** 3 ** DQt - D bindings for the Qt Toolkit 4 ** 5 ** GNU Lesser General Public License Usage 6 ** This file may be used under the terms of the GNU Lesser 7 ** General Public License version 3 as published by the Free Software 8 ** Foundation and appearing in the file LICENSE.LGPL3 included in the 9 ** packaging of this file. Please review the following information to 10 ** ensure the GNU Lesser General Public License version 3 requirements 11 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 12 ** 13 ****************************************************************************/ 14 module qt.core.abstractitemmodel; 15 extern(C++): 16 17 import qt.config; 18 import qt.core.bytearray; 19 import qt.core.datastream; 20 import qt.core.flags; 21 import qt.core.global; 22 import qt.core.hash; 23 import qt.core.list; 24 import qt.core.map; 25 import qt.core.metatype; 26 import qt.core.mimedata; 27 import qt.core.namespace; 28 import qt.core.object; 29 import qt.core.size; 30 import qt.core.stringlist; 31 import qt.core.typeinfo; 32 import qt.core.variant; 33 import qt.core.vector; 34 import qt.helpers; 35 36 /+ QT_REQUIRE_CONFIG(itemmodel); 37 38 39 40 class QAbstractItemModel; 41 class QPersistentModelIndex; +/ 42 43 @(QMetaType.Type.QModelIndex) @Q_MOVABLE_TYPE extern(C++, class) struct /+ Q_CORE_EXPORT +/ QModelIndex 44 { 45 private: 46 /+ friend class QAbstractItemModel; +/ 47 public: 48 /+pragma(inline, true) this()/+ noexcept+/ 49 { 50 this.r = -1; 51 this.c = -1; 52 this.i = 0; 53 this.m = null; 54 }+/ 55 // compiler-generated copy/move ctors/assignment operators are fine! 56 pragma(inline, true) int row() const/+ noexcept+/ { return r; } 57 pragma(inline, true) int column() const/+ noexcept+/ { return c; } 58 pragma(inline, true) quintptr internalId() const/+ noexcept+/ { return i; } 59 pragma(inline, true) void* internalPointer() const/+ noexcept+/ { return reinterpret_cast!(void*)(i); } 60 pragma(inline, true) QModelIndex parent() const 61 { return m ? m.parent(this) : QModelIndex(); } 62 pragma(inline, true) QModelIndex sibling(int arow, int acolumn) const 63 { auto r = m ? (r == arow && c == acolumn) ? this : m.sibling(arow, acolumn, this) : QModelIndex(); return *cast(QModelIndex*)&r; } 64 pragma(inline, true) QModelIndex siblingAtColumn(int acolumn) const 65 { auto r = m ? (c == acolumn) ? this : m.sibling(r, acolumn, this) : QModelIndex(); return *cast(QModelIndex*)&r; } 66 pragma(inline, true) QModelIndex siblingAtRow(int arow) const 67 { auto r = m ? (r == arow) ? this : m.sibling(arow, c, this) : QModelIndex(); return *cast(QModelIndex*)&r; } 68 /+ #if QT_DEPRECATED_SINCE(5, 8) +/ 69 /+ QT_DEPRECATED_X("Use QAbstractItemModel::index") +/ pragma(inline, true) QModelIndex child(int arow, int acolumn) const 70 { return m ? m.index(arow, acolumn, this) : QModelIndex(); } 71 /+ #endif +/ 72 pragma(inline, true) QVariant data(int arole = /+ Qt:: +/qt.core.namespace.ItemDataRole.DisplayRole) const 73 { return m ? m.data(this, arole) : QVariant(); } 74 pragma(inline, true) /+ Qt:: +/qt.core.namespace.ItemFlags flags() const 75 { return m ? m.flags(this) : /+ Qt:: +/qt.core.namespace.ItemFlags(); } 76 pragma(inline, true) const(QAbstractItemModel) model() const/+ noexcept+/ { return m; } 77 pragma(inline, true) bool isValid() const/+ noexcept+/ { return (r >= 0) && (c >= 0) && (m !is null); } 78 /+pragma(inline, true) bool operator ==(ref const(QModelIndex) other) const/+ noexcept+/ 79 { return (other.r == r) && (other.i == i) && (other.c == c) && (other.m == m); }+/ 80 /+pragma(inline, true) bool operator !=(ref const(QModelIndex) other) const/+ noexcept+/ 81 { return !(this == other); }+/ 82 /+pragma(inline, true) bool operator <(ref const(QModelIndex) other) const/+ noexcept+/ 83 { 84 return r < other.r 85 || (r == other.r && (c < other.c 86 || (c == other.c && (i < other.i 87 || (i == other.i && /+ std:: +/less!(const(QAbstractItemModel))()(m, other.m)))))); 88 }+/ 89 private: 90 pragma(inline, true) this(int arow, int acolumn, void* ptr, const(QAbstractItemModel) amodel)/+ noexcept+/ 91 { 92 this.r = arow; 93 this.c = acolumn; 94 this.i = reinterpret_cast!(quintptr)(ptr); 95 this.m = *cast(QAbstractItemModel*)&amodel; 96 } 97 pragma(inline, true) this(int arow, int acolumn, quintptr id, const(QAbstractItemModel) amodel)/+ noexcept+/ 98 { 99 this.r = arow; 100 this.c = acolumn; 101 this.i = id; 102 this.m = *cast(QAbstractItemModel*)&amodel; 103 } 104 int r = -1; int c = -1; 105 quintptr i = 0; 106 /*const*/ QAbstractItemModel m = null; 107 } 108 /+ Q_DECLARE_TYPEINFO(QModelIndex, Q_MOVABLE_TYPE); 109 110 #ifndef QT_NO_DEBUG_STREAM 111 Q_CORE_EXPORT QDebug operator<<(QDebug, const QModelIndex &); 112 #endif +/ 113 114 extern(C++, class) struct QPersistentModelIndexData; 115 116 // qHash is a friend, but we can't use default arguments for friends (§8.3.6.4) 117 /+ uint qHash(const QPersistentModelIndex &index, uint seed = 0) noexcept; +/ 118 119 @(QMetaType.Type.QPersistentModelIndex) @Q_MOVABLE_TYPE extern(C++, class) struct /+ Q_CORE_EXPORT +/ QPersistentModelIndex 120 { 121 public: 122 123 this(ref const(QModelIndex) index); 124 @disable this(this); 125 this(ref const(QPersistentModelIndex) other); 126 ~this(); 127 /+bool operator <(ref const(QPersistentModelIndex) other) const;+/ 128 /+bool operator ==(ref const(QPersistentModelIndex) other) const;+/ 129 /+pragma(inline, true) bool operator !=(ref const(QPersistentModelIndex) other) const 130 { return !operator==(other); }+/ 131 /+ref QPersistentModelIndex operator =(ref const(QPersistentModelIndex) other);+/ 132 /+ inline QPersistentModelIndex(QPersistentModelIndex &&other) noexcept 133 : d(other.d) { other.d = nullptr; } +/ 134 /+ inline QPersistentModelIndex &operator=(QPersistentModelIndex &&other) noexcept 135 { qSwap(d, other.d); return *this; } +/ 136 /+ inline void swap(QPersistentModelIndex &other) noexcept { qSwap(d, other.d); } +/ 137 /+bool operator ==(ref const(QModelIndex) other) const;+/ 138 /+bool operator !=(ref const(QModelIndex) other) const;+/ 139 /+ref QPersistentModelIndex operator =(ref const(QModelIndex) other);+/ 140 /+auto opCast(T : const(QModelIndex))() const;+/ 141 int row() const; 142 int column() const; 143 void* internalPointer() const; 144 quintptr internalId() const; 145 QModelIndex parent() const; 146 QModelIndex sibling(int row, int column) const; 147 /+ #if QT_DEPRECATED_SINCE(5, 8) +/ 148 /+ QT_DEPRECATED_X("Use QAbstractItemModel::index") +/ QModelIndex child(int row, int column) const; 149 /+ #endif +/ 150 QVariant data(int role = /+ Qt:: +/qt.core.namespace.ItemDataRole.DisplayRole) const; 151 /+ Qt:: +/qt.core.namespace.ItemFlags flags() const; 152 mixin(mangleWindows("?model@QPersistentModelIndex@@QEBAPEBVQAbstractItemModel@@XZ", q{ 153 const(QAbstractItemModel) model() const; 154 })); 155 bool isValid() const; 156 private: 157 QPersistentModelIndexData* d; 158 /+ friend uint qHash(const QPersistentModelIndex &, uint seed) noexcept; +/ 159 /+ #ifndef QT_NO_DEBUG_STREAM 160 friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QPersistentModelIndex &); 161 #endif +/ 162 } 163 /+ Q_DECLARE_SHARED(QPersistentModelIndex) 164 165 inline uint qHash(const QPersistentModelIndex &index, uint seed) noexcept 166 { return qHash(index.d, seed); } 167 168 169 #ifndef QT_NO_DEBUG_STREAM 170 Q_CORE_EXPORT QDebug operator<<(QDebug, const QPersistentModelIndex &); 171 #endif 172 173 template<typename T> class QList; +/ 174 alias QModelIndexList = QList!(QModelIndex); 175 176 /+ class QMimeData; +/ 177 extern(C++, class) struct QAbstractItemModelPrivate; 178 extern(C++, class) struct QTransposeProxyModelPrivate; 179 /+ template <class Key, class T> class QMap; +/ 180 181 182 class /+ Q_CORE_EXPORT +/ QAbstractItemModel : QObject 183 { 184 mixin(Q_OBJECT); 185 186 /+ friend class QPersistentModelIndexData; +/ 187 /+ friend class QAbstractItemViewPrivate; +/ 188 /+ friend class QIdentityProxyModel; +/ 189 /+ friend class QTransposeProxyModelPrivate; +/ 190 public: 191 192 /+ explicit +/this(QObject parent = null); 193 /+ virtual +/~this(); 194 195 @QInvokable final bool hasIndex(int row, int column, ref const(QModelIndex) parent = globalInitVar!QModelIndex) const; 196 /+ virtual +/ @QInvokable abstract QModelIndex index(int row, int column, 197 ref const(QModelIndex) parent = globalInitVar!QModelIndex) const; 198 /+ virtual +/ @QInvokable abstract QModelIndex parent(ref const(QModelIndex) child) const; 199 200 /+ virtual +/ @QInvokable QModelIndex sibling(int row, int column, ref const(QModelIndex) idx) const; 201 /+ virtual +/ @QInvokable abstract int rowCount(ref const(QModelIndex) parent = globalInitVar!QModelIndex) const; 202 /+ virtual +/ @QInvokable abstract int columnCount(ref const(QModelIndex) parent = globalInitVar!QModelIndex) const; 203 /+ virtual +/ @QInvokable bool hasChildren(ref const(QModelIndex) parent = globalInitVar!QModelIndex) const; 204 205 /+ virtual +/ @QInvokable abstract QVariant data(ref const(QModelIndex) index, int role = /+ Qt:: +/qt.core.namespace.ItemDataRole.DisplayRole) const; 206 /+ virtual +/ @QInvokable bool setData(ref const(QModelIndex) index, ref const(QVariant) value, int role = /+ Qt:: +/qt.core.namespace.ItemDataRole.EditRole); 207 208 /+ virtual +/ @QInvokable QVariant headerData(int section, /+ Qt:: +/qt.core.namespace.Orientation orientation, 209 int role = /+ Qt:: +/qt.core.namespace.ItemDataRole.DisplayRole) const; 210 /+ virtual +/ bool setHeaderData(int section, /+ Qt:: +/qt.core.namespace.Orientation orientation, ref const(QVariant) value, 211 int role = /+ Qt:: +/qt.core.namespace.ItemDataRole.EditRole); 212 213 mixin(mangleWindows("?itemData@QAbstractItemModel@@UEBA?AV?$QMap@HVQVariant@@@@AEBVQModelIndex@@@Z", q{ 214 /+ virtual +/ QMap!(int, QVariant) itemData(ref const(QModelIndex) index) const; 215 })); 216 mixin(mangleWindows("?setItemData@QAbstractItemModel@@UEAA_NAEBVQModelIndex@@AEBV?$QMap@HVQVariant@@@@@Z", q{ 217 /+ virtual +/ bool setItemData(ref const(QModelIndex) index, ref const(QMap!(int, QVariant)) roles); 218 })); 219 /+ #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) 220 virtual bool clearItemData(const QModelIndex &index); 221 #endif +/ 222 223 /+ virtual +/ QStringList mimeTypes() const; 224 /+ virtual +/ QMimeData mimeData(ref const(QModelIndexList) indexes) const; 225 mixin(mangleWindows("?canDropMimeData@QAbstractItemModel@@UEBA_NPEBVQMimeData@@W4DropAction@Qt@@HHAEBVQModelIndex@@@Z", q{ 226 /+ virtual +/ bool canDropMimeData(const(QMimeData) data, /+ Qt:: +/qt.core.namespace.DropAction action, 227 int row, int column, ref const(QModelIndex) parent) const; 228 })); 229 mixin(mangleWindows("?dropMimeData@QAbstractItemModel@@UEAA_NPEBVQMimeData@@W4DropAction@Qt@@HHAEBVQModelIndex@@@Z", q{ 230 /+ virtual +/ bool dropMimeData(const(QMimeData) data, /+ Qt:: +/qt.core.namespace.DropAction action, 231 int row, int column, ref const(QModelIndex) parent); 232 })); 233 /+ virtual +/ /+ Qt:: +/qt.core.namespace.DropActions supportedDropActions() const; 234 235 /+ virtual +/ /+ Qt:: +/qt.core.namespace.DropActions supportedDragActions() const; 236 /+ #if QT_DEPRECATED_SINCE(5, 0) 237 QT_DEPRECATED void setSupportedDragActions(Qt::DropActions actions) 238 { doSetSupportedDragActions(actions); } 239 #endif +/ 240 241 /+ virtual +/ bool insertRows(int row, int count, ref const(QModelIndex) parent = globalInitVar!QModelIndex); 242 /+ virtual +/ bool insertColumns(int column, int count, ref const(QModelIndex) parent = globalInitVar!QModelIndex); 243 /+ virtual +/ bool removeRows(int row, int count, ref const(QModelIndex) parent = globalInitVar!QModelIndex); 244 /+ virtual +/ bool removeColumns(int column, int count, ref const(QModelIndex) parent = globalInitVar!QModelIndex); 245 /+ virtual +/ bool moveRows(ref const(QModelIndex) sourceParent, int sourceRow, int count, 246 ref const(QModelIndex) destinationParent, int destinationChild); 247 /+ virtual +/ bool moveColumns(ref const(QModelIndex) sourceParent, int sourceColumn, int count, 248 ref const(QModelIndex) destinationParent, int destinationChild); 249 250 pragma(inline, true) final bool insertRow(int arow, ref const(QModelIndex) aparent = globalInitVar!QModelIndex) 251 { return insertRows(arow, 1, aparent); } 252 pragma(inline, true) final bool insertColumn(int acolumn, ref const(QModelIndex) aparent = globalInitVar!QModelIndex) 253 { return insertColumns(acolumn, 1, aparent); } 254 pragma(inline, true) final bool removeRow(int arow, ref const(QModelIndex) aparent = globalInitVar!QModelIndex) 255 { return removeRows(arow, 1, aparent); } 256 pragma(inline, true) final bool removeColumn(int acolumn, ref const(QModelIndex) aparent = globalInitVar!QModelIndex) 257 { return removeColumns(acolumn, 1, aparent); } 258 pragma(inline, true) final bool moveRow(ref const(QModelIndex) sourceParent, int sourceRow, 259 ref const(QModelIndex) destinationParent, int destinationChild) 260 { return moveRows(sourceParent, sourceRow, 1, destinationParent, destinationChild); } 261 pragma(inline, true) final bool moveColumn(ref const(QModelIndex) sourceParent, int sourceColumn, 262 ref const(QModelIndex) destinationParent, int destinationChild) 263 { return moveColumns(sourceParent, sourceColumn, 1, destinationParent, destinationChild); } 264 265 /+ virtual +/ @QInvokable void fetchMore(ref const(QModelIndex) parent); 266 /+ virtual +/ @QInvokable bool canFetchMore(ref const(QModelIndex) parent) const; 267 /+ virtual +/ @QInvokable /+ Qt:: +/qt.core.namespace.ItemFlags flags(ref const(QModelIndex) index) const; 268 /+ virtual +/ void sort(int column, /+ Qt:: +/qt.core.namespace.SortOrder order = /+ Qt:: +/qt.core.namespace.SortOrder.AscendingOrder); 269 /+ virtual +/ QModelIndex buddy(ref const(QModelIndex) index) const; 270 /+ virtual +/ @QInvokable QModelIndexList match(ref const(QModelIndex) start, int role, 271 ref const(QVariant) value, int hits = 1, 272 /+ Qt:: +/qt.core.namespace.MatchFlags flags = 273 /+ Qt:: +/qt.core.namespace.MatchFlags(/+ Qt:: +/qt.core.namespace.MatchFlag.MatchStartsWith|/+ Qt:: +/qt.core.namespace.MatchFlag.MatchWrap)) const; 274 /+ virtual +/ QSize span(ref const(QModelIndex) index) const; 275 276 mixin(mangleWindows("?roleNames@QAbstractItemModel@@UEBA?AV?$QHash@HVQByteArray@@@@XZ", q{ 277 /+ virtual +/ QHash!(int,QByteArray) roleNames() const; 278 })); 279 280 /+ using QObject::parent; +/ 281 282 enum LayoutChangeHint 283 { 284 NoLayoutChangeHint, 285 VerticalSortHint, 286 HorizontalSortHint 287 } 288 /+ Q_ENUM(LayoutChangeHint) +/ 289 290 enum /+ class +/ CheckIndexOption { 291 NoOption = 0x0000, 292 IndexIsValid = 0x0001, 293 DoNotUseParent = 0x0002, 294 ParentIsInvalid = 0x0004, 295 } 296 /+ Q_ENUM(CheckIndexOption) +/ 297 /+ Q_DECLARE_FLAGS(CheckIndexOptions, CheckIndexOption) +/ 298 alias CheckIndexOptions = QFlags!(CheckIndexOption); 299 /+ Q_REQUIRED_RESULT +/ final bool checkIndex(ref const(QModelIndex) index, CheckIndexOptions options = CheckIndexOption.NoOption) const; 300 301 /+ Q_SIGNALS +/public: 302 @QSignal final void dataChanged(ref const(QModelIndex) topLeft, ref const(QModelIndex) bottomRight, ref const(QVector!(int)) roles = globalInitVar!(QVector!(int))); 303 @QSignal final void headerDataChanged(/+ Qt:: +/qt.core.namespace.Orientation orientation, int first, int last); 304 @QSignal final void layoutChanged(ref const(QList!(QPersistentModelIndex)) parents = globalInitVar!(QList!(QPersistentModelIndex)), QAbstractItemModel.LayoutChangeHint hint = QAbstractItemModel.LayoutChangeHint.NoLayoutChangeHint); 305 @QSignal final void layoutAboutToBeChanged(ref const(QList!(QPersistentModelIndex)) parents = globalInitVar!(QList!(QPersistentModelIndex)), QAbstractItemModel.LayoutChangeHint hint = QAbstractItemModel.LayoutChangeHint.NoLayoutChangeHint); 306 307 @QSignal final void rowsAboutToBeInserted(ref const(QModelIndex) parent, int first, int last, QPrivateSignal); 308 @QSignal final void rowsInserted(ref const(QModelIndex) parent, int first, int last, QPrivateSignal); 309 310 @QSignal final void rowsAboutToBeRemoved(ref const(QModelIndex) parent, int first, int last, QPrivateSignal); 311 @QSignal final void rowsRemoved(ref const(QModelIndex) parent, int first, int last, QPrivateSignal); 312 313 @QSignal final void columnsAboutToBeInserted(ref const(QModelIndex) parent, int first, int last, QPrivateSignal); 314 @QSignal final void columnsInserted(ref const(QModelIndex) parent, int first, int last, QPrivateSignal); 315 316 @QSignal final void columnsAboutToBeRemoved(ref const(QModelIndex) parent, int first, int last, QPrivateSignal); 317 @QSignal final void columnsRemoved(ref const(QModelIndex) parent, int first, int last, QPrivateSignal); 318 319 @QSignal final void modelAboutToBeReset(QPrivateSignal); 320 @QSignal final void modelReset(QPrivateSignal); 321 322 @QSignal final void rowsAboutToBeMoved( ref const(QModelIndex) sourceParent, int sourceStart, int sourceEnd, ref const(QModelIndex) destinationParent, int destinationRow, QPrivateSignal); 323 @QSignal final void rowsMoved( ref const(QModelIndex) parent, int start, int end, ref const(QModelIndex) destination, int row, QPrivateSignal); 324 325 @QSignal final void columnsAboutToBeMoved( ref const(QModelIndex) sourceParent, int sourceStart, int sourceEnd, ref const(QModelIndex) destinationParent, int destinationColumn, QPrivateSignal); 326 @QSignal final void columnsMoved( ref const(QModelIndex) parent, int start, int end, ref const(QModelIndex) destination, int column, QPrivateSignal); 327 328 public /+ Q_SLOTS +/: 329 /+ virtual +/ @QSlot bool submit(); 330 /+ virtual +/ @QSlot void revert(); 331 332 protected /+ Q_SLOTS +/: 333 /+ #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) 334 virtual 335 #endif +/ 336 @QSlot final void resetInternalData(); 337 338 protected: 339 this(ref QAbstractItemModelPrivate dd, QObject parent = null); 340 341 pragma(inline, true) final QModelIndex createIndex(int arow, int acolumn, void* adata = null) const 342 { return QModelIndex(arow, acolumn, adata, this); } 343 pragma(inline, true) final QModelIndex createIndex(int arow, int acolumn, quintptr aid) const 344 { return QModelIndex(arow, acolumn, aid, this); } 345 346 final void encodeData(ref const(QModelIndexList) indexes, ref QDataStream stream) const; 347 final bool decodeData(int row, int column, ref const(QModelIndex) parent, ref QDataStream stream); 348 349 final void beginInsertRows(ref const(QModelIndex) parent, int first, int last); 350 final void endInsertRows(); 351 352 final void beginRemoveRows(ref const(QModelIndex) parent, int first, int last); 353 final void endRemoveRows(); 354 355 final bool beginMoveRows(ref const(QModelIndex) sourceParent, int sourceFirst, int sourceLast, ref const(QModelIndex) destinationParent, int destinationRow); 356 final void endMoveRows(); 357 358 final void beginInsertColumns(ref const(QModelIndex) parent, int first, int last); 359 final void endInsertColumns(); 360 361 final void beginRemoveColumns(ref const(QModelIndex) parent, int first, int last); 362 final void endRemoveColumns(); 363 364 final bool beginMoveColumns(ref const(QModelIndex) sourceParent, int sourceFirst, int sourceLast, ref const(QModelIndex) destinationParent, int destinationColumn); 365 final void endMoveColumns(); 366 367 368 /+ #if QT_DEPRECATED_SINCE(5,0) 369 QT_DEPRECATED void reset() 370 { 371 beginResetModel(); 372 endResetModel(); 373 } 374 #endif +/ 375 376 final void beginResetModel(); 377 final void endResetModel(); 378 379 final void changePersistentIndex(ref const(QModelIndex) from, ref const(QModelIndex) to); 380 final void changePersistentIndexList(ref const(QModelIndexList) from, ref const(QModelIndexList) to); 381 final QModelIndexList persistentIndexList() const; 382 383 /+ #if QT_DEPRECATED_SINCE(5,0) 384 QT_DEPRECATED void setRoleNames(const QHash<int,QByteArray> &theRoleNames) 385 { 386 doSetRoleNames(theRoleNames); 387 } 388 #endif +/ 389 390 private: 391 final void doSetRoleNames(ref const(QHash!(int,QByteArray)) roleNames); 392 final void doSetSupportedDragActions(/+ Qt:: +/qt.core.namespace.DropActions actions); 393 394 /+ Q_DECLARE_PRIVATE(QAbstractItemModel) +/ 395 /+ Q_DISABLE_COPY(QAbstractItemModel) +/ 396 } 397 /+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;}+/ 398 /+pragma(inline, true) QFlags!(QAbstractItemModel.CheckIndexOptions.enum_type) operator |(QAbstractItemModel.CheckIndexOptions.enum_type f1, QFlags!(QAbstractItemModel.CheckIndexOptions.enum_type) f2)/+noexcept+/{return f2|f1;}+/ 399 /+pragma(inline, true) QIncompatibleFlag operator |(QAbstractItemModel.CheckIndexOptions.enum_type f1, int f2)/+noexcept+/{return QIncompatibleFlag(int(f1)|f2);}+/ 400 401 /+ Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractItemModel::CheckIndexOptions) +/ 402 class /+ Q_CORE_EXPORT +/ QAbstractTableModel : QAbstractItemModel 403 { 404 mixin(Q_OBJECT); 405 406 public: 407 /+ explicit +/this(QObject parent = null); 408 ~this(); 409 410 override QModelIndex index(int row, int column, ref const(QModelIndex) parent = globalInitVar!QModelIndex) const; 411 override QModelIndex sibling(int row, int column, ref const(QModelIndex) idx) const; 412 override bool dropMimeData(const(QMimeData) data, /+ Qt:: +/qt.core.namespace.DropAction action, 413 int row, int column, ref const(QModelIndex) parent); 414 415 override /+ Qt:: +/qt.core.namespace.ItemFlags flags(ref const(QModelIndex) index) const; 416 417 /+ using QObject::parent; +/ 418 419 protected: 420 this(ref QAbstractItemModelPrivate dd, QObject parent); 421 422 /*private:*/ 423 /+ Q_DISABLE_COPY(QAbstractTableModel) +/ 424 override QModelIndex parent(ref const(QModelIndex) child) const; 425 override bool hasChildren(ref const(QModelIndex) parent) const; 426 } 427 428 class /+ Q_CORE_EXPORT +/ QAbstractListModel : QAbstractItemModel 429 { 430 mixin(Q_OBJECT); 431 432 public: 433 /+ explicit +/this(QObject parent = null); 434 ~this(); 435 436 override QModelIndex index(int row, int column = 0, ref const(QModelIndex) parent = globalInitVar!QModelIndex) const; 437 override QModelIndex sibling(int row, int column, ref const(QModelIndex) idx) const; 438 override bool dropMimeData(const(QMimeData) data, /+ Qt:: +/qt.core.namespace.DropAction action, 439 int row, int column, ref const(QModelIndex) parent); 440 441 override /+ Qt:: +/qt.core.namespace.ItemFlags flags(ref const(QModelIndex) index) const; 442 443 /+ using QObject::parent; +/ 444 445 protected: 446 this(ref QAbstractItemModelPrivate dd, QObject parent); 447 448 /*private:*/ 449 /+ Q_DISABLE_COPY(QAbstractListModel) +/ 450 override QModelIndex parent(ref const(QModelIndex) child) const; 451 override int columnCount(ref const(QModelIndex) parent) const; 452 override bool hasChildren(ref const(QModelIndex) parent) const; 453 } 454 455 // inline implementations 456 457 /+ #if QT_DEPRECATED_SINCE(5, 8) 458 #endif 459 460 inline uint qHash(const QModelIndex &index) noexcept 461 { return uint((uint(index.row()) << 4) + index.column() + index.internalId()); } 462 463 464 Q_DECLARE_METATYPE(QModelIndexList) +/ 465