doc: Remove obsolete note after moving QFileSystemModel to QtGui

There doesn't seem to be any reason that it should require an instance
of QApplication. However, given that the model is by design
asynchronous, it does need to live in a thread that runs an event loop.
Add a note about that to the "Caching and Performance" section, and
apply some drive-by editing.

Amends fb9ec8ad44decba7b2878370f3711b61614f035a

Task-number: QTBUG-66177
Change-Id: Ibe3095e0264ce033732d1c724f59a871e2a0d3b8
Pick-to: 6.5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 22bde5209a7a3c510d4b90b9eaee413f3ba3dee4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Shawn Rutledge 2024-11-27 18:55:54 +01:00 committed by Qt Cherry-pick Bot
parent 437a7626f4
commit c014312c20

View File

@ -55,8 +55,6 @@ using namespace Qt::StringLiterals;
about the underlying files and directories related to items in the model. about the underlying files and directories related to items in the model.
Directories can be created and removed using mkdir(), rmdir(). Directories can be created and removed using mkdir(), rmdir().
\note QFileSystemModel requires an instance of \l QApplication.
\section1 Example Usage \section1 Example Usage
A directory model that displays the contents of a default directory A directory model that displays the contents of a default directory
@ -80,13 +78,15 @@ using namespace Qt::StringLiterals;
\section1 Caching and Performance \section1 Caching and Performance
QFileSystemModel will not fetch any files or directories until setRootPath() QFileSystemModel uses a separate thread to populate itself, so it will not
is called. This will prevent any unnecessary querying on the file system cause the main thread to hang as the file system is being queried. Calls to
until that point such as listing the drives on Windows. rowCount() will return \c 0 until the model populates a directory. The thread
in which the QFileSystemModel lives needs to run an event loop to process
the incoming data.
QFileSystemModel uses a separate thread to populate itself so it will not QFileSystemModel will not start populating itself until setRootPath() is
cause the main thread to hang as the file system is being queried. called. This prevents any unnecessary querying of the system's root file
Calls to rowCount() will return 0 until the model populates a directory. system, such as enumerating the drives on Windows, until that point.
QFileSystemModel keeps a cache with file information. The cache is QFileSystemModel keeps a cache with file information. The cache is
automatically kept up to date using the QFileSystemWatcher. automatically kept up to date using the QFileSystemWatcher.
@ -1489,6 +1489,8 @@ QFile::Permissions QFileSystemModel::permissions(const QModelIndex &index) const
modify the data available to views. In other words, the "root" of modify the data available to views. In other words, the "root" of
the model is \e not changed to include only files and directories the model is \e not changed to include only files and directories
within the directory specified by \a newPath in the file system. within the directory specified by \a newPath in the file system.
\sa {QTreeView::setRootIndex()}, {QtQuick::}{TreeView::rootIndex}
*/ */
QModelIndex QFileSystemModel::setRootPath(const QString &newPath) QModelIndex QFileSystemModel::setRootPath(const QString &newPath)
{ {