QDirIterator: add note about always calling hasNext()

... before using next/nextFileInfo(). That's both more logical and
safer; this is analogous to always checking `iterator != end` before
using said iterator.

Change-Id: I87583f645087d34fc3e76e77f1ac168f76b6868e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ahmad Samir 2025-03-27 22:52:58 +02:00
parent a6fc30f69d
commit bbe79a3b98

View File

@ -209,7 +209,8 @@ QDirIterator::~QDirIterator()
/*!
Advances the iterator to the next entry, and returns the file path of this
new entry. If hasNext() returns \c false, this function does nothing, and
returns an empty QString.
returns an empty QString. Ideally you should always call hasNext() before
calling this method.
You can call fileName() or filePath() to get the current entry's file name
or path, or fileInfo() to get a QFileInfo for the current entry.
@ -229,7 +230,8 @@ QString QDirIterator::next()
Advances the iterator to the next entry, and returns the file info of this
new entry. If hasNext() returns \c false, this function does nothing, and
returns an empty QFileInfo.
returns an empty QFileInfo. Ideally you should always call hasNext() before
calling this method.
You can call fileName() or filePath() to get the current entry's file name
or path, or fileInfo() to get a QFileInfo for the current entry.