Remove foreach snippets from the documentation

We don't recommend foreach anymore, and have in fact
adapted two snippets already to use for(), but missed
the documentation text.

In any case, it feels a bit weird to give an example
how to iterate over QStringList in each of these methods,
so we might as well just remove this part.

Change-Id: If8744e48961661ad518f5f24781c38f371d981bc
Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 3b9f6b54b1cda08079ae97956478a4af55133803)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit fef7baaf119f64f63cca542c72a7a80f91917dd7)
This commit is contained in:
Kai Köhne 2024-01-04 09:10:41 +01:00 committed by Qt Cherry-pick Bot
parent 95017918c3
commit 866733484e
4 changed files with 0 additions and 41 deletions

View File

@ -13,12 +13,6 @@ connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::Qu
//! [1] //! [1]
//! [2]
foreach (const QString &path, app.libraryPaths())
do_something(path);
//! [2]
//! [3] //! [3]
// Called once QCoreApplication exists // Called once QCoreApplication exists
static void preRoutineMyDebugTool() static void preRoutineMyDebugTool()

View File

@ -2965,11 +2965,6 @@ Q_GLOBAL_STATIC(QRecursiveMutex, libraryPathMutex)
directory (and its existence) may change when the directory of directory (and its existence) may change when the directory of
the application executable becomes known. the application executable becomes known.
If you want to iterate over the list, you can use the \l foreach
pseudo-keyword:
\snippet code/src_corelib_kernel_qcoreapplication.cpp 2
\sa setLibraryPaths(), addLibraryPath(), removeLibraryPath(), QLibrary, \sa setLibraryPaths(), addLibraryPath(), removeLibraryPath(), QLibrary,
{How to Create Qt Plugins} {How to Create Qt Plugins}
*/ */

View File

@ -74,26 +74,4 @@ appname -session id
*/ // wrap snippet 2 */ // wrap snippet 2
void wrapper0() {
//! [3]
const QStringList commands = mySession.restartCommand();
for (const QString &command : commands)
do_something(command);
//! [3]
} // wrapper0
void wrapper1() {
//! [4]
const QStringList commands = mySession.discardCommand();
for (const QString &command : mySession.discardCommand())
do_something(command);
//! [4]
} // wrapper1
} // src_gui_kernel_qguiapplication } // src_gui_kernel_qguiapplication

View File

@ -281,10 +281,6 @@ void QSessionManager::setRestartCommand(const QStringList &command)
/*! /*!
Returns the currently set restart command. Returns the currently set restart command.
To iterate over the list, you can use the \l foreach pseudo-keyword:
\snippet code/src_gui_kernel_qguiapplication.cpp 3
\sa setRestartCommand(), restartHint() \sa setRestartCommand(), restartHint()
*/ */
QStringList QSessionManager::restartCommand() const QStringList QSessionManager::restartCommand() const
@ -307,10 +303,6 @@ void QSessionManager::setDiscardCommand(const QStringList &command)
/*! /*!
Returns the currently set discard command. Returns the currently set discard command.
To iterate over the list, you can use the \l foreach pseudo-keyword:
\snippet code/src_gui_kernel_qguiapplication.cpp 4
\sa setDiscardCommand(), restartCommand(), setRestartCommand() \sa setDiscardCommand(), restartCommand(), setRestartCommand()
*/ */
QStringList QSessionManager::discardCommand() const QStringList QSessionManager::discardCommand() const