From a6fc30f69d104ca2f4d2901dd39a1c7d7787faae Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Thu, 27 Mar 2025 22:52:18 +0200 Subject: [PATCH] Revert "QDirIterator: clarify the docs wrt. calling hasNext() before next()" This reverts commit c83304af27b403c9ebe64d4c768da25e04acafc1. The original behavior is going to be finally restored by the next commits in this chain. Task-number: QTBUG-135287 Change-Id: Iae38d5d9271a77da9d9b1c938ccc73c7531d89d5 Reviewed-by: Thiago Macieira --- src/corelib/io/qdiriterator.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index f9bf1b2abe1..7d7fe156845 100644 --- a/src/corelib/io/qdiriterator.cpp +++ b/src/corelib/io/qdiriterator.cpp @@ -208,8 +208,8 @@ QDirIterator::~QDirIterator() /*! Advances the iterator to the next entry, and returns the file path of this - new entry. You should first check hasNext() before using this method, to - avoid unexpected results. + new entry. If hasNext() returns \c false, this function does nothing, and + returns an empty QString. 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. @@ -228,8 +228,8 @@ QString QDirIterator::next() \since 6.3 Advances the iterator to the next entry, and returns the file info of this - new entry. You should first check hasNext() before using this method, to - avoid unexpected results. + new entry. If hasNext() returns \c false, this function does nothing, and + returns an empty QFileInfo. 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.