diff options
-rw-r--r-- | src/corelib/doc/snippets/qstringlist/main.cpp | 18 | ||||
-rw-r--r-- | src/corelib/text/qstringlist.cpp | 20 | ||||
-rw-r--r-- | src/corelib/tools/qlist.qdoc | 16 |
3 files changed, 2 insertions, 52 deletions
diff --git a/src/corelib/doc/snippets/qstringlist/main.cpp b/src/corelib/doc/snippets/qstringlist/main.cpp index fa3540d8ce..d2175aafb5 100644 --- a/src/corelib/doc/snippets/qstringlist/main.cpp +++ b/src/corelib/doc/snippets/qstringlist/main.cpp @@ -22,24 +22,6 @@ Widget::Widget(QWidget *parent) fonts << "Courier" << "Verdana"; //! [0b] -//! [1] - for (int i = 0; i < fonts.size(); ++i) - cout << fonts.at(i).toLocal8Bit().constData() << Qt::endl; -//! [1] - -//! [2] - QStringListIterator javaStyleIterator(fonts); - while (javaStyleIterator.hasNext()) - cout << javaStyleIterator.next().toLocal8Bit().constData() << Qt::endl; -//! [2] - -//! [3] - QStringList::const_iterator constIterator; - for (constIterator = fonts.constBegin(); constIterator != fonts.constEnd(); - ++constIterator) - cout << (*constIterator).toLocal8Bit().constData() << Qt::endl; -//! [3] - //! [4] QString str = fonts.join(", "); // str == "Arial, Helvetica, Times, Courier" diff --git a/src/corelib/text/qstringlist.cpp b/src/corelib/text/qstringlist.cpp index 2c0dc77a5a..347a89cfa9 100644 --- a/src/corelib/text/qstringlist.cpp +++ b/src/corelib/text/qstringlist.cpp @@ -84,25 +84,7 @@ QT_BEGIN_NAMESPACE \section1 Iterating Over the Strings - To iterate over a list, you can either use index positions or - QList's Java-style and STL-style iterator types: - - Indexing: - - \snippet qstringlist/main.cpp 1 - - Java-style iterator: - - \snippet qstringlist/main.cpp 2 - - STL-style iterator: - - \snippet qstringlist/main.cpp 3 - - The QStringListIterator class is simply a type definition for - QListIterator<QString>. QStringList also provide the - QMutableStringListIterator class which is a type definition for - QMutableListIterator<QString>. + See \l {Iterating over Containers}. \section1 Manipulating the Strings diff --git a/src/corelib/tools/qlist.qdoc b/src/corelib/tools/qlist.qdoc index e8e5a73596..e1c917bbc4 100644 --- a/src/corelib/tools/qlist.qdoc +++ b/src/corelib/tools/qlist.qdoc @@ -129,21 +129,7 @@ support \c operator==(). These requirements are documented on a per-function basis. - Like the other container classes, QList provides \l{Java-style iterators} - (QListIterator and QMutableListIterator) and \l{STL-style iterators} - (QList::const_iterator and QList::iterator). In practice, iterators are - handy when working with generic algorithms provided by \l{generic - algorithms}{Qt} and the C++ standard library. \l{Java-style iterators} are - provided for backwards compatibility, prefer \l{STL-style iterators} when - writing C++ code. - - \note Iterators over a QList, and references to individual elements - within one, cannot be relied on to remain valid when any non-const method - of the QList is called. Accessing such an iterator or reference after - the call to a non-const method leads to undefined behavior. When stability - for iterator-like functionality is required, you should use indexes instead - of iterators as they are not tied to QList's internal state and thus do - not get invalidated. + For iterating over the items, see \l {Iterating over Containers}. In addition to QList, Qt also provides QVarLengthArray, a very low-level class with little functionality that is optimized for |