diff options
author | Marc Mutz <[email protected]> | 2024-06-20 17:56:14 +0200 |
---|---|---|
committer | Marc Mutz <[email protected]> | 2024-07-06 09:31:41 +0200 |
commit | d1a5e602df5978cee6bd263db77745f8047e508e (patch) | |
tree | 9e36f445179c81ef3c8cb2716f5eabb300abd4d1 /src | |
parent | 32442c2b52381f5e4164ae217453a8e8391d9349 (diff) |
[doc] Q(Persistent)ModelIndex: document behavior of data() on invalid Q(P)MIs
We return a default-constructed QVariant. What else could we possibly
return? Right: nothing else.
So document it and add a test.
Pick-to: 6.8 6.7 6.5 6.2 5.15
Change-Id: If9808703b8ddfd15ceb013996741af8cd4efea12
Reviewed-by: Volker Hilsheimer <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index 5e8216f598d..66d7c943413 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -606,7 +606,8 @@ QModelIndex QPersistentModelIndex::sibling(int row, int column) const /*! Returns the data for the given \a role for the item referred to by the - index. + index, or a default-constructed QVariant if this persistent model index + is \l{isValid()}{invalid}. \sa Qt::ItemDataRole, QAbstractItemModel::setData() */ @@ -1315,7 +1316,8 @@ void QAbstractItemModel::resetInternalData() \fn QVariant QModelIndex::data(int role) const Returns the data for the given \a role for the item referred to by the - index. + index, or a default-constructed QVariant if this model index is + \l{isValid()}{invalid}. */ /*! |