diff options
Diffstat (limited to 'src/corelib/tools')
32 files changed, 677 insertions, 703 deletions
diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc index 5a4a278ad0..28fd9881d6 100644 --- a/src/corelib/tools/qalgorithms.qdoc +++ b/src/corelib/tools/qalgorithms.qdoc @@ -60,14 +60,14 @@ a particular value. If you need that functionality, you can use qFill(): - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 0 + \snippet code/doc_src_qalgorithms.cpp 0 qFill() takes a begin iterator, an end iterator, and a value. In the example above, we pass \c list.begin() and \c list.end() as the begin and end iterators, but this doesn't have to be the case: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 1 + \snippet code/doc_src_qalgorithms.cpp 1 Different algorithms can have different requirements for the iterators they accept. For example, qFill() accepts two @@ -98,13 +98,13 @@ name_table array and return the corresponding Unicode value from the \c value_table if the entity is recognized: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 2 + \snippet code/doc_src_qalgorithms.cpp 2 This kind of code is for advanced users only; for most applications, a QMap- or QHash-based approach would work just as well: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 3 + \snippet code/doc_src_qalgorithms.cpp 3 \section1 Types of Iterators @@ -185,7 +185,7 @@ position \a begin2 + 1; and so on. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 4 + \snippet code/doc_src_qalgorithms.cpp 4 \sa qCopyBackward(), {input iterators}, {output iterators} */ @@ -201,7 +201,7 @@ at position \a end2 - 2; and so on. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 5 + \snippet code/doc_src_qalgorithms.cpp 5 \sa qCopy(), {bidirectional iterators} */ @@ -214,7 +214,7 @@ items compare equal; otherwise returns false. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 6 + \snippet code/doc_src_qalgorithms.cpp 6 This function requires the item type (in the example above, QString) to implement \c operator==(). @@ -228,7 +228,7 @@ Fills the range [\a begin, \a end) with \a value. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 7 + \snippet code/doc_src_qalgorithms.cpp 7 \sa qCopy(), {forward iterators} */ @@ -249,7 +249,7 @@ value isn't found. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 8 + \snippet code/doc_src_qalgorithms.cpp 8 This function requires the item type (in the example above, QString) to implement \c operator==(). @@ -278,7 +278,7 @@ Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 9 + \snippet code/doc_src_qalgorithms.cpp 9 This function requires the item type (in the example above, \c int) to implement \c operator==(). @@ -302,7 +302,7 @@ of \a value in the variable passed as a reference in argument \a n. Exchanges the values of variables \a var1 and \a var2. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 10 + \snippet code/doc_src_qalgorithms.cpp 10 */ /*! \fn void qSort(RandomAccessIterator begin, RandomAccessIterator end) @@ -312,7 +312,7 @@ of \a value in the variable passed as a reference in argument \a n. using the quicksort algorithm. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 11 + \snippet code/doc_src_qalgorithms.cpp 11 The sort algorithm is efficient on large data sets. It operates in \l {linear-logarithmic time}, O(\e{n} log \e{n}). @@ -338,13 +338,13 @@ of \a value in the variable passed as a reference in argument \a n. For example, here's how to sort the strings in a QStringList in case-insensitive alphabetical order: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 12 + \snippet code/doc_src_qalgorithms.cpp 12 To sort values in reverse order, pass \l{qGreater()}{qGreater<T>()} as the \a lessThan parameter. For example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 13 + \snippet code/doc_src_qalgorithms.cpp 13 If neither of the two items is "less than" the other, the items are taken to be equal. It is then undefined which one of the two @@ -356,7 +356,7 @@ of \a value in the variable passed as a reference in argument \a n. following code shows how to sort a list of strings case insensitively using QMap: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 14 + \snippet code/doc_src_qalgorithms.cpp 14 \sa QMap */ @@ -382,7 +382,7 @@ of \a value in the variable passed as a reference in argument \a n. property is often useful when sorting user-visible data. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 15 + \snippet code/doc_src_qalgorithms.cpp 15 The sort algorithm is efficient on large data sets. It operates in \l {linear-logarithmic time}, O(\e{n} log \e{n}). @@ -405,7 +405,7 @@ of \a value in the variable passed as a reference in argument \a n. For example, here's how to sort the strings in a QStringList in case-insensitive alphabetical order: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 16 + \snippet code/doc_src_qalgorithms.cpp 16 Note that earlier versions of Qt allowed using a lessThan function that took its arguments by non-const reference. From 4.3 and on this is no longer possible, @@ -415,7 +415,7 @@ of \a value in the variable passed as a reference in argument \a n. \l{qGreater()}{qGreater<T>()} as the \a lessThan parameter. For example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 17 + \snippet code/doc_src_qalgorithms.cpp 17 If neither of the two items is "less than" the other, the items are taken to be equal. The item that appeared before the other in the @@ -444,7 +444,7 @@ of \a value in the variable passed as a reference in argument \a n. ascending order; see qSort(). Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 18 + \snippet code/doc_src_qalgorithms.cpp 18 This function requires the item type (in the example above, \c{int}) to implement \c operator<(). @@ -452,7 +452,7 @@ of \a value in the variable passed as a reference in argument \a n. qLowerBound() can be used in conjunction with qUpperBound() to iterate over all occurrences of the same value: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 19 + \snippet code/doc_src_qalgorithms.cpp 19 \sa qUpperBound(), qBinaryFind() */ @@ -494,7 +494,7 @@ of \a value in the variable passed as a reference in argument \a n. ascending order; see qSort(). Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 20 + \snippet code/doc_src_qalgorithms.cpp 20 This function requires the item type (in the example above, \c{int}) to implement \c operator<(). @@ -502,7 +502,7 @@ of \a value in the variable passed as a reference in argument \a n. qUpperBound() can be used in conjunction with qLowerBound() to iterate over all occurrences of the same value: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 21 + \snippet code/doc_src_qalgorithms.cpp 21 \sa qLowerBound(), qBinaryFind() */ @@ -545,7 +545,7 @@ of \a value in the variable passed as a reference in argument \a n. finer control. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 22 + \snippet code/doc_src_qalgorithms.cpp 22 This function requires the item type (in the example above, QString) to implement \c operator<(). @@ -587,7 +587,7 @@ of \a value in the variable passed as a reference in argument \a n. example, \c{QWidget *}). Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 23 + \snippet code/doc_src_qalgorithms.cpp 23 Notice that qDeleteAll() doesn't remove the items from the container; it merely calls \c delete on them. In the example @@ -618,7 +618,7 @@ of \a value in the variable passed as a reference in argument \a n. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 24 + \snippet code/doc_src_qalgorithms.cpp 24 \sa {qGreater()}{qGreater<T>()} */ @@ -631,7 +631,7 @@ of \a value in the variable passed as a reference in argument \a n. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 25 + \snippet code/doc_src_qalgorithms.cpp 25 \sa {qLess()}{qLess<T>()} */ diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp index 4cb08a7310..0e74e15a27 100644 --- a/src/corelib/tools/qbitarray.cpp +++ b/src/corelib/tools/qbitarray.cpp @@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE The following code constructs a QBitArray containing 200 bits initialized to false (0): - \snippet doc/src/snippets/code/src_corelib_tools_qbitarray.cpp 0 + \snippet code/src_corelib_tools_qbitarray.cpp 0 To initialize the bits to true, either pass \c true as second argument to the constructor, or call fill() later on. @@ -75,13 +75,13 @@ QT_BEGIN_NAMESPACE bit that can be used on the left side of an assignment. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qbitarray.cpp 1 + \snippet code/src_corelib_tools_qbitarray.cpp 1 For technical reasons, it is more efficient to use testBit() and setBit() to access bits in the array than operator[](). For example: - \snippet doc/src/snippets/code/src_corelib_tools_qbitarray.cpp 2 + \snippet code/src_corelib_tools_qbitarray.cpp 2 QBitArray supports \c{&} (\link operator&() AND\endlink), \c{|} (\link operator|() OR\endlink), \c{^} (\link operator^() @@ -90,7 +90,7 @@ QT_BEGIN_NAMESPACE as the built-in C++ bitwise operators of the same name. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qbitarray.cpp 3 + \snippet code/src_corelib_tools_qbitarray.cpp 3 For historical reasons, QBitArray distinguishes between a null bit array and an empty bit array. A \e null bit array is a bit @@ -99,7 +99,7 @@ QT_BEGIN_NAMESPACE array is always empty, but an empty bit array isn't necessarily null: - \snippet doc/src/snippets/code/src_corelib_tools_qbitarray.cpp 4 + \snippet code/src_corelib_tools_qbitarray.cpp 4 All functions except isNull() treat null bit arrays the same as empty bit arrays; for example, QBitArray() compares equal to @@ -228,7 +228,7 @@ void QBitArray::resize(int size) Returns true if this bit array is null; otherwise returns false. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbitarray.cpp 5 + \snippet code/src_corelib_tools_qbitarray.cpp 5 Qt makes a distinction between null bit arrays and empty bit arrays for historical reasons. For most applications, what @@ -245,7 +245,7 @@ void QBitArray::resize(int size) the bit array is resized to \a size beforehand. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbitarray.cpp 6 + \snippet code/src_corelib_tools_qbitarray.cpp 6 \sa resize() */ @@ -372,7 +372,7 @@ void QBitArray::fill(bool value, int begin, int end) \a i < size()). Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbitarray.cpp 7 + \snippet code/src_corelib_tools_qbitarray.cpp 7 The return value is of type QBitRef, a helper class for QBitArray. When you get an object of type QBitRef, you can assign to @@ -451,7 +451,7 @@ void QBitArray::fill(bool value, int begin, int end) taken to be 0. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbitarray.cpp 8 + \snippet code/src_corelib_tools_qbitarray.cpp 8 \sa operator&(), operator|=(), operator^=(), operator~() */ @@ -480,7 +480,7 @@ QBitArray &QBitArray::operator&=(const QBitArray &other) taken to be 0. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbitarray.cpp 9 + \snippet code/src_corelib_tools_qbitarray.cpp 9 \sa operator|(), operator&=(), operator^=(), operator~() */ @@ -506,7 +506,7 @@ QBitArray &QBitArray::operator|=(const QBitArray &other) taken to be 0. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbitarray.cpp 10 + \snippet code/src_corelib_tools_qbitarray.cpp 10 \sa operator^(), operator&=(), operator|=(), operator~() */ @@ -527,7 +527,7 @@ QBitArray &QBitArray::operator^=(const QBitArray &other) array. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbitarray.cpp 11 + \snippet code/src_corelib_tools_qbitarray.cpp 11 \sa operator&(), operator|(), operator^() */ @@ -559,7 +559,7 @@ QBitArray QBitArray::operator~() const taken to be 0. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbitarray.cpp 12 + \snippet code/src_corelib_tools_qbitarray.cpp 12 \sa QBitArray::operator&=(), operator|(), operator^() */ @@ -582,7 +582,7 @@ QBitArray operator&(const QBitArray &a1, const QBitArray &a2) taken to be 0. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbitarray.cpp 13 + \snippet code/src_corelib_tools_qbitarray.cpp 13 \sa QBitArray::operator|=(), operator&(), operator^() */ @@ -605,7 +605,7 @@ QBitArray operator|(const QBitArray &a1, const QBitArray &a2) taken to be 0. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbitarray.cpp 14 + \snippet code/src_corelib_tools_qbitarray.cpp 14 \sa QBitArray::operator^=(), operator&(), operator|() */ @@ -668,7 +668,7 @@ QBitArray operator^(const QBitArray &a1, const QBitArray &a2) Writes bit array \a ba to stream \a out. - \sa \link datastreamformat.html Format of the QDataStream operators \endlink + \sa {Serializing Qt Data Types}{Format of the QDataStream operators} */ QDataStream &operator<<(QDataStream &out, const QBitArray &ba) @@ -685,7 +685,7 @@ QDataStream &operator<<(QDataStream &out, const QBitArray &ba) Reads a bit array into \a ba from stream \a in. - \sa \link datastreamformat.html Format of the QDataStream operators \endlink + \sa {Serializing Qt Data Types}{Format of the QDataStream operators} */ QDataStream &operator>>(QDataStream &in, QBitArray &ba) diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 31cf65b78d..42150efd63 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -648,7 +648,7 @@ static inline char qToLower(char c) char *} to its constructor. For example, the following code creates a byte array of size 5 containing the data "Hello": - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 0 + \snippet code/src_corelib_tools_qbytearray.cpp 0 Although the size() is 5, the byte array also maintains an extra '\\0' character at the end so that if a function is used that @@ -668,11 +668,11 @@ static inline char qToLower(char c) arrays, operator[]() returns a reference to a byte that can be used on the left side of an assignment. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 1 + \snippet code/src_corelib_tools_qbytearray.cpp 1 For read-only access, an alternative syntax is to use at(): - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 2 + \snippet code/src_corelib_tools_qbytearray.cpp 2 at() can be faster than operator[](), because it never causes a \l{deep copy} to occur. @@ -700,7 +700,7 @@ static inline char qToLower(char c) the byte data: append(), prepend(), insert(), replace(), and remove(). For example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 3 + \snippet code/src_corelib_tools_qbytearray.cpp 3 The replace() and remove() functions' first two arguments are the position from which to start erasing and the number of bytes that @@ -728,7 +728,7 @@ static inline char qToLower(char c) For example, here's a typical loop that finds all occurrences of a particular substring: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 4 + \snippet code/src_corelib_tools_qbytearray.cpp 4 If you simply want to check whether a QByteArray contains a particular character or substring, use contains(). If you want to @@ -752,7 +752,7 @@ static inline char qToLower(char c) array is always empty, but an empty byte array isn't necessarily null: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 5 + \snippet code/src_corelib_tools_qbytearray.cpp 5 All functions except isNull() treat null byte arrays the same as empty byte arrays. For example, data() returns a pointer to a @@ -949,7 +949,7 @@ QByteArray &QByteArray::operator=(const char *str) automaticall unless the \l{deep copy} is created. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 6 + \snippet code/src_corelib_tools_qbytearray.cpp 6 \sa isEmpty(), resize() */ @@ -959,7 +959,7 @@ QByteArray &QByteArray::operator=(const char *str) Returns true if the byte array has size 0; otherwise returns false. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 7 + \snippet code/src_corelib_tools_qbytearray.cpp 7 \sa size() */ @@ -1046,7 +1046,7 @@ QByteArray &QByteArray::operator=(const char *str) '\\0' terminator. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 8 + \snippet code/src_corelib_tools_qbytearray.cpp 8 The pointer remains valid as long as the byte array isn't reallocated or destroyed. For read-only access, constData() is @@ -1059,11 +1059,11 @@ QByteArray &QByteArray::operator=(const char *str) data(), but it will corrupt the heap and cause a crash because it does not allocate a byte for the '\\0' at the end: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 46 + \snippet code/src_corelib_tools_qbytearray.cpp 46 This one allocates the correct amount of space: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 47 + \snippet code/src_corelib_tools_qbytearray.cpp 47 Note: A QByteArray can store any byte values including '\\0's, but most functions that take \c{char *} arguments assume that the @@ -1129,7 +1129,7 @@ QByteArray &QByteArray::operator=(const char *str) place. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 9 + \snippet code/src_corelib_tools_qbytearray.cpp 9 The return value is of type QByteRef, a helper class for QByteArray. When you get an object of type QByteRef, you can use @@ -1188,7 +1188,7 @@ QByteArray &QByteArray::operator=(const char *str) If \a pos is beyond the end of the array, nothing happens. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 10 + \snippet code/src_corelib_tools_qbytearray.cpp 10 \sa chop(), resize(), left() */ @@ -1206,7 +1206,7 @@ void QByteArray::truncate(int pos) array. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 11 + \snippet code/src_corelib_tools_qbytearray.cpp 11 \sa truncate(), resize(), left() */ @@ -1224,7 +1224,7 @@ void QByteArray::chop(int n) returns a reference to this byte array. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 12 + \snippet code/src_corelib_tools_qbytearray.cpp 12 Note: QByteArray is an \l{implicitly shared} class. Consequently, if \e this is an empty QByteArray, then \e this will just share @@ -1284,7 +1284,7 @@ void QByteArray::chop(int n) Returns true if this byte array is null; otherwise returns false. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 13 + \snippet code/src_corelib_tools_qbytearray.cpp 13 Qt makes a distinction between null byte arrays and empty byte arrays for historical reasons. For most applications, what @@ -1428,7 +1428,7 @@ void QByteArray::resize(int size) size \a size beforehand. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 14 + \snippet code/src_corelib_tools_qbytearray.cpp 14 \sa resize() */ @@ -1493,7 +1493,7 @@ QByteArray QByteArray::nulTerminated() const reference to this byte array. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 15 + \snippet code/src_corelib_tools_qbytearray.cpp 15 This is the same as insert(0, \a ba). @@ -1573,7 +1573,7 @@ QByteArray &QByteArray::prepend(char ch) Appends the byte array \a ba onto the end of this byte array. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 16 + \snippet code/src_corelib_tools_qbytearray.cpp 16 This is the same as insert(size(), \a ba). @@ -1710,7 +1710,7 @@ static inline QByteArray &qbytearray_insert(QByteArray *ba, reference to this byte array. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 17 + \snippet code/src_corelib_tools_qbytearray.cpp 17 \sa append(), prepend(), replace(), remove() */ @@ -1793,7 +1793,7 @@ QByteArray &QByteArray::insert(int i, char ch) array is truncated at position \a pos. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 18 + \snippet code/src_corelib_tools_qbytearray.cpp 18 \sa insert(), replace() */ @@ -1817,7 +1817,7 @@ QByteArray &QByteArray::remove(int pos, int len) array \a after, and returns a reference to this byte array. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 19 + \snippet code/src_corelib_tools_qbytearray.cpp 19 \sa insert(), remove() */ @@ -1855,7 +1855,7 @@ QByteArray &QByteArray::replace(int pos, int len, const char *after) \overload Replaces \a len bytes from index position \a pos with \a alen bytes - from the string \a after. \a after is allowed to have '\0' characters. + from the string \a after. \a after is allowed to have '\\0' characters. \since 4.7 */ @@ -1881,7 +1881,7 @@ QByteArray &QByteArray::replace(int pos, int len, const char *after, int alen) byte array \a after. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 20 + \snippet code/src_corelib_tools_qbytearray.cpp 20 */ QByteArray &QByteArray::replace(const QByteArray &before, const QByteArray &after) @@ -2214,7 +2214,7 @@ QByteArray QByteArray::repeated(int times) const position \a from. Returns -1 if \a ba could not be found. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 21 + \snippet code/src_corelib_tools_qbytearray.cpp 21 \sa lastIndexOf(), contains(), count() */ @@ -2284,7 +2284,7 @@ int QByteArray::indexOf(const char *c, int from) const position \a from. Returns -1 if \a ch could not be found. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 22 + \snippet code/src_corelib_tools_qbytearray.cpp 22 \sa lastIndexOf(), contains() */ @@ -2346,7 +2346,7 @@ static int lastIndexOfHelper(const char *haystack, int l, const char *needle, in starts at the last byte. Returns -1 if \a ba could not be found. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 23 + \snippet code/src_corelib_tools_qbytearray.cpp 23 \sa indexOf(), contains(), count() */ @@ -2406,7 +2406,7 @@ int QByteArray::lastIndexOf(const char *str, int from) const last (size() - 1) byte. Returns -1 if \a ch could not be found. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 24 + \snippet code/src_corelib_tools_qbytearray.cpp 24 \sa indexOf(), contains() */ @@ -2493,7 +2493,7 @@ int QByteArray::count(char ch) const otherwise returns false. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 25 + \snippet code/src_corelib_tools_qbytearray.cpp 25 \sa endsWith(), left() */ @@ -2538,7 +2538,7 @@ bool QByteArray::startsWith(char ch) const otherwise returns false. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 26 + \snippet code/src_corelib_tools_qbytearray.cpp 26 \sa startsWith(), right() */ @@ -2586,7 +2586,7 @@ bool QByteArray::endsWith(char ch) const size(). Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 27 + \snippet code/src_corelib_tools_qbytearray.cpp 27 \sa right(), mid(), startsWith(), truncate() */ @@ -2608,7 +2608,7 @@ QByteArray QByteArray::left(int len) const size(). Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 28 + \snippet code/src_corelib_tools_qbytearray.cpp 28 \sa endsWith(), left(), mid() */ @@ -2631,7 +2631,7 @@ QByteArray QByteArray::right(int len) const pos until the end of the byte array. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 29 + \snippet code/src_corelib_tools_qbytearray.cpp 29 \sa left(), right() */ @@ -2658,7 +2658,7 @@ QByteArray QByteArray::mid(int pos, int len) const interpreted as a Latin-1 encoded string. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 30 + \snippet code/src_corelib_tools_qbytearray.cpp 30 \sa toUpper(), {8-bit Character Comparisons} */ @@ -2680,7 +2680,7 @@ QByteArray QByteArray::toLower() const interpreted as a Latin-1 encoded string. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 31 + \snippet code/src_corelib_tools_qbytearray.cpp 31 \sa toLower(), {8-bit Character Comparisons} */ @@ -3090,7 +3090,7 @@ QDataStream &operator>>(QDataStream &in, QByteArray &ba) characters '\\t', '\\n', '\\v', '\\f', '\\r', and ' '. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 32 + \snippet code/src_corelib_tools_qbytearray.cpp 32 \sa trimmed() */ @@ -3128,7 +3128,7 @@ QByteArray QByteArray::simplified() const characters '\\t', '\\n', '\\v', '\\f', '\\r', and ' '. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 33 + \snippet code/src_corelib_tools_qbytearray.cpp 33 Unlike simplified(), trimmed() leaves internal whitespace alone. @@ -3170,7 +3170,7 @@ QByteArray QByteArray::trimmed() const after position \a width are removed, and the copy is returned. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 34 + \snippet code/src_corelib_tools_qbytearray.cpp 34 \sa rightJustified() */ @@ -3207,7 +3207,7 @@ QByteArray QByteArray::leftJustified(int width, char fill, bool truncate) const position \a width. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 35 + \snippet code/src_corelib_tools_qbytearray.cpp 35 \sa leftJustified() */ @@ -3314,7 +3314,7 @@ qulonglong QByteArray::toULongLong(bool *ok, int base) const If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to false; otherwise *\a{ok} is set to true. - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 36 + \snippet code/src_corelib_tools_qbytearray.cpp 36 \note The conversion of the number is performed in the default C locale, irrespective of the user's locale. @@ -3380,7 +3380,7 @@ uint QByteArray::toUInt(bool *ok, int base) const If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to false; otherwise *\a{ok} is set to true. - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 37 + \snippet code/src_corelib_tools_qbytearray.cpp 37 \note The conversion of the number is performed in the default C locale, irrespective of the user's locale. @@ -3501,7 +3501,7 @@ ushort QByteArray::toUShort(bool *ok, int base) const If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to false; otherwise *\a{ok} is set to true. - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 38 + \snippet code/src_corelib_tools_qbytearray.cpp 38 \note The conversion of the number is performed in the default C locale, irrespective of the user's locale. @@ -3536,7 +3536,7 @@ float QByteArray::toFloat(bool *ok) const /*! Returns a copy of the byte array, encoded as Base64. - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 39 + \snippet code/src_corelib_tools_qbytearray.cpp 39 The algorithm used to encode Base64-encoded data is defined in \l{RFC 2045}. @@ -3588,7 +3588,7 @@ QByteArray QByteArray::toBase64() const be any value between 2 and 36. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 40 + \snippet code/src_corelib_tools_qbytearray.cpp 40 \note The format of the number is not localized; the default C locale is used irrespective of the user's locale. @@ -3734,7 +3734,7 @@ QByteArray &QByteArray::setNum(double n, char f, int prec) any value between 2 and 36. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 41 + \snippet code/src_corelib_tools_qbytearray.cpp 41 \note The format of the number is not localized; the default C locale is used irrespective of the user's locale. @@ -3806,7 +3806,7 @@ QByteArray QByteArray::number(qulonglong n, int base) decimal point. With 'g' and 'G', \a prec is the maximum number of significant digits (trailing zeroes are omitted). - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 42 + \snippet code/src_corelib_tools_qbytearray.cpp 42 \note The format of the number is not localized; the default C locale is used irrespective of the user's locale. @@ -3843,7 +3843,7 @@ QByteArray QByteArray::number(double n, char f, int prec) Here is an example of how to read data using a QDataStream on raw data in memory without copying the raw data into a QByteArray: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 43 + \snippet code/src_corelib_tools_qbytearray.cpp 43 \warning A byte array created with fromRawData() is \e not null-terminated, unless the raw data contains a 0 character at @@ -3908,7 +3908,7 @@ QByteArray &QByteArray::setRawData(const char *data, uint size) For example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 44 + \snippet code/src_corelib_tools_qbytearray.cpp 44 The algorithm used to decode Base64-encoded data is defined in \l{RFC 2045}. @@ -3960,7 +3960,7 @@ QByteArray QByteArray::fromBase64(const QByteArray &base64) For example: - \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 45 + \snippet code/src_corelib_tools_qbytearray.cpp 45 \sa toHex() */ diff --git a/src/corelib/tools/qcache.qdoc b/src/corelib/tools/qcache.qdoc index 80d47ff703..86eec28e4b 100644 --- a/src/corelib/tools/qcache.qdoc +++ b/src/corelib/tools/qcache.qdoc @@ -39,11 +39,11 @@ definition of a cache that stores objects of type Employee associated with an integer key: - \snippet doc/src/snippets/code/doc_src_qcache.cpp 0 + \snippet code/doc_src_qcache.cpp 0 Here's how to insert an object in the cache: - \snippet doc/src/snippets/code/doc_src_qcache.cpp 1 + \snippet code/doc_src_qcache.cpp 1 The advantage of using QCache over some other key-based data structure (such as QMap or QHash) is that QCache automatically @@ -59,7 +59,7 @@ By default, QCache's maxCost() is 100. You can specify a different value in the QCache constructor: - \snippet doc/src/snippets/code/doc_src_qcache.cpp 2 + \snippet code/doc_src_qcache.cpp 2 Each time you call insert(), you can specify a cost as third argument (after the key and a pointer to the object to insert). diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index fa5eed4f86..630deccadd 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -824,7 +824,7 @@ QString QDate::toString(Qt::DateFormat f) const range 0 to 9999. This restriction may apply to locale-aware formats as well, depending on the locale settings. - \sa QDateTime::toString() QTime::toString() + \sa QDateTime::toString(), QTime::toString() */ QString QDate::toString(const QString& format) const @@ -836,7 +836,7 @@ QString QDate::toString(const QString& format) const #endif //QT_NO_DATESTRING /*! - \fn bool setYMD(int y, int m, int d) + \fn bool QDate::setYMD(int y, int m, int d) \deprecated in 5.0, use setDate() instead. @@ -906,7 +906,7 @@ void QDate::getDate(int *year, int *month, int *day) Returns a null date if the current date is invalid or the new date is out-of-range. - \sa addMonths() addYears() daysTo() + \sa addMonths(), addYears(), daysTo() */ QDate QDate::addDays(qint64 ndays) const @@ -938,7 +938,7 @@ QDate QDate::addDays(qint64 ndays) const resulting month/year, this function will return a date that is the latest valid date. - \sa addDays() addYears() + \sa addDays(), addYears() */ QDate QDate::addMonths(int nmonths) const @@ -1029,7 +1029,7 @@ QDate QDate::addYears(int nyears) const Returns 0 if either date is invalid. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qdatetime.cpp 0 + \snippet code/src_corelib_tools_qdatetime.cpp 0 \sa addDays() */ @@ -1217,7 +1217,7 @@ QDate QDate::fromString(const QString& s, Qt::DateFormat f) of characters that are enclosed in single quotes will also be treated as text and will not be used as an expression. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qdatetime.cpp 1 + \snippet code/src_corelib_tools_qdatetime.cpp 1 If the format is not satisfied, an invalid QDate is returned. The expressions that don't expect leading zeroes (d, M) will be @@ -1227,7 +1227,7 @@ QDate QDate::fromString(const QString& s, Qt::DateFormat f) string could have meant January 30 but the M will grab two digits, resulting in an invalid date: - \snippet doc/src/snippets/code/src_corelib_tools_qdatetime.cpp 2 + \snippet code/src_corelib_tools_qdatetime.cpp 2 For any field that is not represented in the format the following defaults are used: @@ -1241,7 +1241,7 @@ QDate QDate::fromString(const QString& s, Qt::DateFormat f) The following examples demonstrate the default values: - \snippet doc/src/snippets/code/src_corelib_tools_qdatetime.cpp 3 + \snippet code/src_corelib_tools_qdatetime.cpp 3 \sa QDateTime::fromString(), QTime::fromString(), QDate::toString(), QDateTime::toString(), QTime::toString() @@ -1269,7 +1269,7 @@ QDate QDate::fromString(const QString &string, const QString &format) day) is valid; otherwise returns false. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qdatetime.cpp 4 + \snippet code/src_corelib_tools_qdatetime.cpp 4 \sa isNull(), setDate() */ @@ -1300,7 +1300,7 @@ bool QDate::isLeapYear(int y) return (y % 4 == 0 && y % 100 != 0) || y % 400 == 0; } -/*! \fn static QDate QDate::fromJulianDay(int jd) +/*! \fn static QDate QDate::fromJulianDay(qint64 jd) Converts the Julian day \a jd to a QDate. @@ -1582,7 +1582,7 @@ QString QTime::toString(Qt::DateFormat format) const If the datetime is invalid, an empty string will be returned. If \a format is empty, the default format "hh:mm:ss" is used. - \sa QDate::toString() QDateTime::toString() + \sa QDate::toString(), QDateTime::toString() */ QString QTime::toString(const QString& format) const { @@ -1623,7 +1623,7 @@ bool QTime::setHMS(int h, int m, int s, int ms) Example: - \snippet doc/src/snippets/code/src_corelib_tools_qdatetime.cpp 5 + \snippet code/src_corelib_tools_qdatetime.cpp 5 \sa addMSecs(), secsTo(), QDateTime::addSecs() */ @@ -1845,7 +1845,7 @@ QTime QTime::fromString(const QString& s, Qt::DateFormat f) of characters that are enclosed in single quotes will also be treated as text and not be used as an expression. - \snippet doc/src/snippets/code/src_corelib_tools_qdatetime.cpp 6 + \snippet code/src_corelib_tools_qdatetime.cpp 6 If the format is not satisfied an invalid QTime is returned. Expressions that do not expect leading zeroes to be given (h, m, s @@ -1855,15 +1855,15 @@ QTime QTime::fromString(const QString& s, Qt::DateFormat f) could have meant 00:07:10, but the m will grab two digits, resulting in an invalid time: - \snippet doc/src/snippets/code/src_corelib_tools_qdatetime.cpp 7 + \snippet code/src_corelib_tools_qdatetime.cpp 7 Any field that is not represented in the format will be set to zero. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qdatetime.cpp 8 + \snippet code/src_corelib_tools_qdatetime.cpp 8 - \sa QDateTime::fromString() QDate::fromString() QDate::toString() - QDateTime::toString() QTime::toString() + \sa QDateTime::fromString(), QDate::fromString(), QDate::toString(), + QDateTime::toString(), QTime::toString() */ QTime QTime::fromString(const QString &string, const QString &format) @@ -1894,7 +1894,7 @@ QTime QTime::fromString(const QString &string, const QString &format) Example: - \snippet doc/src/snippets/code/src_corelib_tools_qdatetime.cpp 9 + \snippet code/src_corelib_tools_qdatetime.cpp 9 */ bool QTime::isValid(int h, int m, int s, int ms) @@ -1906,7 +1906,7 @@ bool QTime::isValid(int h, int m, int s, int ms) /*! Sets this time to the current time. This is practical for timing: - \snippet doc/src/snippets/code/src_corelib_tools_qdatetime.cpp 10 + \snippet code/src_corelib_tools_qdatetime.cpp 10 \sa restart(), elapsed(), currentTime() */ @@ -2077,7 +2077,7 @@ int QTime::elapsed() const time zone before 1970, even if the system's time zone database supports that information. - \sa QDate QTime QDateTimeEdit + \sa QDate, QTime, QDateTimeEdit */ /*! @@ -2432,7 +2432,7 @@ void QDateTime::setTime_t(uint secsSince1Jan1970UTC) range 0 to 9999. This restriction may apply to locale-aware formats as well, depending on the locale settings. - \sa QDate::toString() QTime::toString() Qt::DateFormat + \sa QDate::toString(), QTime::toString(), Qt::DateFormat */ QString QDateTime::toString(Qt::DateFormat f) const @@ -2574,7 +2574,7 @@ QString QDateTime::toString(Qt::DateFormat f) const If the datetime is invalid, an empty string will be returned. - \sa QDate::toString() QTime::toString() + \sa QDate::toString(), QTime::toString() */ QString QDateTime::toString(const QString& format) const { @@ -2718,7 +2718,7 @@ qint64 QDateTime::daysTo(const QDateTime &other) const Returns 0 if either time is invalid. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qdatetime.cpp 11 + \snippet code/src_corelib_tools_qdatetime.cpp 11 \sa addSecs(), daysTo(), QTime::secsTo() */ @@ -3420,7 +3420,7 @@ QDateTime QDateTime::fromString(const QString& s, Qt::DateFormat f) of characters that are enclosed in singlequotes will also be treated as text and not be used as an expression. - \snippet doc/src/snippets/code/src_corelib_tools_qdatetime.cpp 12 + \snippet code/src_corelib_tools_qdatetime.cpp 12 If the format is not satisfied an invalid QDateTime is returned. The expressions that don't have leading zeroes (d, M, h, m, s, z) will be @@ -3428,7 +3428,7 @@ QDateTime QDateTime::fromString(const QString& s, Qt::DateFormat f) put them outside the range and/or leave too few digits for other sections. - \snippet doc/src/snippets/code/src_corelib_tools_qdatetime.cpp 13 + \snippet code/src_corelib_tools_qdatetime.cpp 13 This could have meant 1 January 00:30.00 but the M will grab two digits. @@ -3448,10 +3448,10 @@ QDateTime QDateTime::fromString(const QString& s, Qt::DateFormat f) For example: - \snippet doc/src/snippets/code/src_corelib_tools_qdatetime.cpp 14 + \snippet code/src_corelib_tools_qdatetime.cpp 14 - \sa QDate::fromString() QTime::fromString() QDate::toString() - QDateTime::toString() QTime::toString() + \sa QDate::fromString(), QTime::fromString(), QDate::toString(), + QDateTime::toString(), QTime::toString() */ QDateTime QDateTime::fromString(const QString &string, const QString &format) diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 1d6514eb3d..e237b81cfa 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -55,7 +55,7 @@ \class QEasingCurve \since 4.6 \ingroup animation - \brief The QEasingCurve class provides easing curves for controlling animation. + \captionief The QEasingCurve class provides easing curves for controlling animation. Easing curves describe a function that controls how the speed of the interpolation between 0 and 1 should be. Easing curves allow transitions from @@ -112,183 +112,173 @@ The type of easing curve. - \value Linear \inlineimage qeasingcurve-linear.png - \br - Easing curve for a linear (t) function: + \value Linear \image qeasingcurve-linear.png + \caption Easing curve for a linear (t) function: velocity is constant. - \value InQuad \inlineimage qeasingcurve-inquad.png - \br - Easing curve for a quadratic (t^2) function: + \value InQuad \image qeasingcurve-inquad.png + \caption Easing curve for a quadratic (t^2) function: accelerating from zero velocity. - \value OutQuad \inlineimage qeasingcurve-outquad.png - \br - Easing curve for a quadratic (t^2) function: + \value OutQuad \image qeasingcurve-outquad.png + \caption Easing curve for a quadratic (t^2) function: decelerating to zero velocity. - \value InOutQuad \inlineimage qeasingcurve-inoutquad.png - \br - Easing curve for a quadratic (t^2) function: + \value InOutQuad \image qeasingcurve-inoutquad.png + \caption Easing curve for a quadratic (t^2) function: acceleration until halfway, then deceleration. - \value OutInQuad \inlineimage qeasingcurve-outinquad.png - \br - Easing curve for a quadratic (t^2) function: + \value OutInQuad \image qeasingcurve-outinquad.png + \caption Easing curve for a quadratic (t^2) function: deceleration until halfway, then acceleration. - \value InCubic \inlineimage qeasingcurve-incubic.png - \br - Easing curve for a cubic (t^3) function: + \value InCubic \image qeasingcurve-incubic.png + \caption Easing curve for a cubic (t^3) function: accelerating from zero velocity. - \value OutCubic \inlineimage qeasingcurve-outcubic.png - \br - Easing curve for a cubic (t^3) function: + \value OutCubic \image qeasingcurve-outcubic.png + \caption Easing curve for a cubic (t^3) function: decelerating to zero velocity. - \value InOutCubic \inlineimage qeasingcurve-inoutcubic.png - \br - Easing curve for a cubic (t^3) function: + \value InOutCubic \image qeasingcurve-inoutcubic.png + \caption Easing curve for a cubic (t^3) function: acceleration until halfway, then deceleration. - \value OutInCubic \inlineimage qeasingcurve-outincubic.png - \br - Easing curve for a cubic (t^3) function: + \value OutInCubic \image qeasingcurve-outincubic.png + \caption Easing curve for a cubic (t^3) function: deceleration until halfway, then acceleration. - \value InQuart \inlineimage qeasingcurve-inquart.png - \br - Easing curve for a quartic (t^4) function: + \value InQuart \image qeasingcurve-inquart.png + \caption Easing curve for a quartic (t^4) function: accelerating from zero velocity. - \value OutQuart \inlineimage qeasingcurve-outquart.png - \br + \value OutQuart \image qeasingcurve-outquart.png + \caption Easing curve for a quartic (t^4) function: decelerating to zero velocity. - \value InOutQuart \inlineimage qeasingcurve-inoutquart.png - \br + \value InOutQuart \image qeasingcurve-inoutquart.png + \caption Easing curve for a quartic (t^4) function: acceleration until halfway, then deceleration. - \value OutInQuart \inlineimage qeasingcurve-outinquart.png - \br + \value OutInQuart \image qeasingcurve-outinquart.png + \caption Easing curve for a quartic (t^4) function: deceleration until halfway, then acceleration. - \value InQuint \inlineimage qeasingcurve-inquint.png - \br + \value InQuint \image qeasingcurve-inquint.png + \caption Easing curve for a quintic (t^5) easing in: accelerating from zero velocity. - \value OutQuint \inlineimage qeasingcurve-outquint.png - \br + \value OutQuint \image qeasingcurve-outquint.png + \caption Easing curve for a quintic (t^5) function: decelerating to zero velocity. - \value InOutQuint \inlineimage qeasingcurve-inoutquint.png - \br + \value InOutQuint \image qeasingcurve-inoutquint.png + \caption Easing curve for a quintic (t^5) function: acceleration until halfway, then deceleration. - \value OutInQuint \inlineimage qeasingcurve-outinquint.png - \br + \value OutInQuint \image qeasingcurve-outinquint.png + \caption Easing curve for a quintic (t^5) function: deceleration until halfway, then acceleration. - \value InSine \inlineimage qeasingcurve-insine.png - \br + \value InSine \image qeasingcurve-insine.png + \caption Easing curve for a sinusoidal (sin(t)) function: accelerating from zero velocity. - \value OutSine \inlineimage qeasingcurve-outsine.png - \br + \value OutSine \image qeasingcurve-outsine.png + \caption Easing curve for a sinusoidal (sin(t)) function: decelerating from zero velocity. - \value InOutSine \inlineimage qeasingcurve-inoutsine.png - \br + \value InOutSine \image qeasingcurve-inoutsine.png + \caption Easing curve for a sinusoidal (sin(t)) function: acceleration until halfway, then deceleration. - \value OutInSine \inlineimage qeasingcurve-outinsine.png - \br + \value OutInSine \image qeasingcurve-outinsine.png + \caption Easing curve for a sinusoidal (sin(t)) function: deceleration until halfway, then acceleration. - \value InExpo \inlineimage qeasingcurve-inexpo.png - \br + \value InExpo \image qeasingcurve-inexpo.png + \caption Easing curve for an exponential (2^t) function: accelerating from zero velocity. - \value OutExpo \inlineimage qeasingcurve-outexpo.png - \br + \value OutExpo \image qeasingcurve-outexpo.png + \caption Easing curve for an exponential (2^t) function: decelerating from zero velocity. - \value InOutExpo \inlineimage qeasingcurve-inoutexpo.png - \br + \value InOutExpo \image qeasingcurve-inoutexpo.png + \caption Easing curve for an exponential (2^t) function: acceleration until halfway, then deceleration. - \value OutInExpo \inlineimage qeasingcurve-outinexpo.png - \br + \value OutInExpo \image qeasingcurve-outinexpo.png + \caption Easing curve for an exponential (2^t) function: deceleration until halfway, then acceleration. - \value InCirc \inlineimage qeasingcurve-incirc.png - \br + \value InCirc \image qeasingcurve-incirc.png + \caption Easing curve for a circular (sqrt(1-t^2)) function: accelerating from zero velocity. - \value OutCirc \inlineimage qeasingcurve-outcirc.png - \br + \value OutCirc \image qeasingcurve-outcirc.png + \caption Easing curve for a circular (sqrt(1-t^2)) function: decelerating from zero velocity. - \value InOutCirc \inlineimage qeasingcurve-inoutcirc.png - \br + \value InOutCirc \image qeasingcurve-inoutcirc.png + \caption Easing curve for a circular (sqrt(1-t^2)) function: acceleration until halfway, then deceleration. - \value OutInCirc \inlineimage qeasingcurve-outincirc.png - \br + \value OutInCirc \image qeasingcurve-outincirc.png + \caption Easing curve for a circular (sqrt(1-t^2)) function: deceleration until halfway, then acceleration. - \value InElastic \inlineimage qeasingcurve-inelastic.png - \br + \value InElastic \image qeasingcurve-inelastic.png + \caption Easing curve for an elastic (exponentially decaying sine wave) function: accelerating from zero velocity. The peak amplitude can be set with the \e amplitude parameter, and the period of decay by the \e period parameter. - \value OutElastic \inlineimage qeasingcurve-outelastic.png - \br + \value OutElastic \image qeasingcurve-outelastic.png + \caption Easing curve for an elastic (exponentially decaying sine wave) function: decelerating from zero velocity. The peak amplitude can be set with the \e amplitude parameter, and the period of decay by the \e period parameter. - \value InOutElastic \inlineimage qeasingcurve-inoutelastic.png - \br + \value InOutElastic \image qeasingcurve-inoutelastic.png + \caption Easing curve for an elastic (exponentially decaying sine wave) function: acceleration until halfway, then deceleration. - \value OutInElastic \inlineimage qeasingcurve-outinelastic.png - \br + \value OutInElastic \image qeasingcurve-outinelastic.png + \caption Easing curve for an elastic (exponentially decaying sine wave) function: deceleration until halfway, then acceleration. - \value InBack \inlineimage qeasingcurve-inback.png - \br + \value InBack \image qeasingcurve-inback.png + \caption Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity. - \value OutBack \inlineimage qeasingcurve-outback.png - \br + \value OutBack \image qeasingcurve-outback.png + \caption Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing out: decelerating to zero velocity. - \value InOutBack \inlineimage qeasingcurve-inoutback.png - \br + \value InOutBack \image qeasingcurve-inoutback.png + \caption Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration. - \value OutInBack \inlineimage qeasingcurve-outinback.png - \br + \value OutInBack \image qeasingcurve-outinback.png + \caption Easing curve for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration. - \value InBounce \inlineimage qeasingcurve-inbounce.png - \br + \value InBounce \image qeasingcurve-inbounce.png + \caption Easing curve for a bounce (exponentially decaying parabolic bounce) function: accelerating from zero velocity. - \value OutBounce \inlineimage qeasingcurve-outbounce.png - \br + \value OutBounce \image qeasingcurve-outbounce.png + \caption Easing curve for a bounce (exponentially decaying parabolic bounce) function: decelerating from zero velocity. - \value InOutBounce \inlineimage qeasingcurve-inoutbounce.png - \br + \value InOutBounce \image qeasingcurve-inoutbounce.png + \caption Easing curve for a bounce (exponentially decaying parabolic bounce) function easing in/out: acceleration until halfway, then deceleration. - \value OutInBounce \inlineimage qeasingcurve-outinbounce.png - \br + \value OutInBounce \image qeasingcurve-outinbounce.png + \caption Easing curve for a bounce (exponentially decaying parabolic bounce) function easing out/in: deceleration until halfway, then acceleration. @@ -312,7 +302,7 @@ This is a typedef for a pointer to a function with the following signature: - \snippet doc/src/snippets/code/src_corelib_tools_qeasingcurve.cpp 0 + \snippet code/src_corelib_tools_qeasingcurve.cpp 0 */ #include "qeasingcurve.h" @@ -1467,7 +1457,7 @@ QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing) /*! \fn QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing) - \relates QQuaternion + \relates QEasingCurve Reads an easing curve from the given \a stream into the given \a easing curve and returns a reference to the stream. diff --git a/src/corelib/tools/qelapsedtimer.cpp b/src/corelib/tools/qelapsedtimer.cpp index e8f2ce174e..76b0d796f0 100644 --- a/src/corelib/tools/qelapsedtimer.cpp +++ b/src/corelib/tools/qelapsedtimer.cpp @@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE spent in a slow operation. The simplest example of such a case is for debugging purposes, as in the following example: - \snippet doc/src/snippets/qelapsedtimer/main.cpp 0 + \snippet qelapsedtimer/main.cpp 0 In this example, the timer is started by a call to start() and the elapsed timer is calculated by the elapsed() function. @@ -76,14 +76,14 @@ QT_BEGIN_NAMESPACE subclasses are good examples of such need. In that case, the code could be as follows: - \snippet doc/src/snippets/qelapsedtimer/main.cpp 1 + \snippet qelapsedtimer/main.cpp 1 Another use-case is to execute a certain operation for a specific timeslice. For this, QElapsedTimer provides the hasExpired() convenience function, which can be used to determine if a certain number of milliseconds has already elapsed: - \snippet doc/src/snippets/qelapsedtimer/main.cpp 2 + \snippet qelapsedtimer/main.cpp 2 \section1 Reference clocks diff --git a/src/corelib/tools/qelapsedtimer_generic.cpp b/src/corelib/tools/qelapsedtimer_generic.cpp index 05214f0698..a20b6b5662 100644 --- a/src/corelib/tools/qelapsedtimer_generic.cpp +++ b/src/corelib/tools/qelapsedtimer_generic.cpp @@ -70,7 +70,7 @@ bool QElapsedTimer::isMonotonic() Starts this timer. Once started, a timer value can be checked with elapsed() or msecsSinceReference(). Normally, a timer is started just before a lengthy operation, such as: - \snippet doc/src/snippets/qelapsedtimer/main.cpp 0 + \snippet qelapsedtimer/main.cpp 0 Also, starting a timer makes it valid again. @@ -91,7 +91,7 @@ void QElapsedTimer::start() parameter to a slow operation (for example, an iteration count) so that this operation takes at least 250 milliseconds: - \snippet doc/src/snippets/qelapsedtimer/main.cpp 3 + \snippet qelapsedtimer/main.cpp 3 \sa start(), invalidate(), elapsed() */ diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 20202a4896..a2851d15bd 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -694,21 +694,21 @@ void QHashData::checkSanity() \endlist Here's an example QHash with QString keys and \c int values: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 0 + \snippet code/src_corelib_tools_qhash.cpp 0 To insert a (key, value) pair into the hash, you can use operator[](): - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 1 + \snippet code/src_corelib_tools_qhash.cpp 1 This inserts the following three (key, value) pairs into the QHash: ("one", 1), ("three", 3), and ("seven", 7). Another way to insert items into the hash is to use insert(): - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 2 + \snippet code/src_corelib_tools_qhash.cpp 2 To look up a value, use operator[]() or value(): - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 3 + \snippet code/src_corelib_tools_qhash.cpp 3 If there is no item with the specified key in the hash, these functions return a \l{default-constructed value}. @@ -716,12 +716,12 @@ void QHashData::checkSanity() If you want to check whether the hash contains a particular key, use contains(): - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 4 + \snippet code/src_corelib_tools_qhash.cpp 4 There is also a value() overload that uses its second argument as a default value if there is no item with the specified key: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 5 + \snippet code/src_corelib_tools_qhash.cpp 5 In general, we recommend that you use contains() and value() rather than operator[]() for looking up a key in a hash. The @@ -730,7 +730,7 @@ void QHashData::checkSanity() const). For example, the following code snippet will create 1000 items in memory: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 6 + \snippet code/src_corelib_tools_qhash.cpp 6 To avoid this problem, replace \c hash[i] with \c hash.value(i) in the code above. @@ -751,11 +751,11 @@ void QHashData::checkSanity() QHash::iterator). Here's how to iterate over a QHash<QString, int> using a Java-style iterator: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 7 + \snippet code/src_corelib_tools_qhash.cpp 7 Here's the same code, but using an STL-style iterator: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 8 + \snippet code/src_corelib_tools_qhash.cpp 8 QHash is unordered, so an iterator's sequence cannot be assumed to be predictable. If ordering by key is required, use a QMap. @@ -764,7 +764,7 @@ void QHashData::checkSanity() insert() with a key that already exists in the QHash, the previous value is erased. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 9 + \snippet code/src_corelib_tools_qhash.cpp 9 However, you can store multiple values per key by using insertMulti() instead of insert() (or using the convenience @@ -772,19 +772,19 @@ void QHashData::checkSanity() the values for a single key, you can use values(const Key &key), which returns a QList<T>: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 10 + \snippet code/src_corelib_tools_qhash.cpp 10 The items that share the same key are available from most recently to least recently inserted. A more efficient approach is to call find() to get the iterator for the first item with a key and iterate from there: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 11 + \snippet code/src_corelib_tools_qhash.cpp 11 If you only need to extract the values from a hash (not the keys), you can also use \l{foreach}: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 12 + \snippet code/src_corelib_tools_qhash.cpp 12 Items can be removed from the hash in several ways. One way is to call remove(); this will remove any item with the given key. @@ -975,7 +975,7 @@ void QHashData::checkSanity() This function is useful for code that needs to build a huge hash and wants to avoid repeated reallocation. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 14 + \snippet code/src_corelib_tools_qhash.cpp 14 Ideally, \a size should be slightly more than the maximum number of items expected in the hash. \a size doesn't have to be prime, @@ -1284,7 +1284,7 @@ void QHashData::checkSanity() be called while iterating, and won't affect the order of items in the hash. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 15 + \snippet code/src_corelib_tools_qhash.cpp 15 \sa remove(), take(), find() */ @@ -1303,7 +1303,7 @@ void QHashData::checkSanity() the iterator. For example, here's some code that iterates over all the items with the same key: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 16 + \snippet code/src_corelib_tools_qhash.cpp 16 \sa value(), values(), QMultiHash::find() */ @@ -1460,7 +1460,7 @@ void QHashData::checkSanity() start iterating. Here's a typical loop that prints all the (key, value) pairs stored in a hash: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 17 + \snippet code/src_corelib_tools_qhash.cpp 17 Unlike QMap, which orders its items by key, QHash stores its items in an arbitrary order. The only guarantee is that items that @@ -1473,22 +1473,22 @@ void QHashData::checkSanity() Here's an example that increments every value stored in the QHash by 2: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 18 + \snippet code/src_corelib_tools_qhash.cpp 18 Here's an example that removes all the items whose key is a string that starts with an underscore character: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 19 + \snippet code/src_corelib_tools_qhash.cpp 19 The call to QHash::erase() removes the item pointed to by the iterator from the hash, and returns an iterator to the next item. Here's another way of removing an item while iterating: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 20 + \snippet code/src_corelib_tools_qhash.cpp 20 It might be tempting to write code like this: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 21 + \snippet code/src_corelib_tools_qhash.cpp 21 However, this will potentially crash in \c{++i}, because \c i is a dangling iterator after the call to erase(). @@ -1514,7 +1514,7 @@ void QHashData::checkSanity() called on an uninitialized iterator. Use operator=() to assign a value to it before using it. - \sa QHash::begin() QHash::end() + \sa QHash::begin(), QHash::end() */ /*! \fn QHash::iterator::iterator(void *node) @@ -1540,7 +1540,7 @@ void QHashData::checkSanity() You can change the value of an item by using value() on the left side of an assignment, for example: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 22 + \snippet code/src_corelib_tools_qhash.cpp 22 \sa key(), operator*() */ @@ -1684,7 +1684,7 @@ void QHashData::checkSanity() QHash::find() before you can start iterating. Here's a typical loop that prints all the (key, value) pairs stored in a hash: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 23 + \snippet code/src_corelib_tools_qhash.cpp 23 Unlike QMap, which orders its items by key, QHash stores its items in an arbitrary order. The only guarantee is that items that @@ -1710,7 +1710,7 @@ void QHashData::checkSanity() called on an uninitialized iterator. Use operator=() to assign a value to it before using it. - \sa QHash::constBegin() QHash::constEnd() + \sa QHash::constBegin(), QHash::constEnd() */ /*! \fn QHash::const_iterator::const_iterator(void *node) @@ -1897,7 +1897,7 @@ void QHashData::checkSanity() operator+=(). Example: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 24 + \snippet code/src_corelib_tools_qhash.cpp 24 Unlike QHash, QMultiHash provides no operator[]. Use value() or replace() if you want to access the most recently inserted item @@ -1906,7 +1906,7 @@ void QHashData::checkSanity() If you want to retrieve all the values for a single key, you can use values(const Key &key), which returns a QList<T>: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 25 + \snippet code/src_corelib_tools_qhash.cpp 25 The items that share the same key are available from most recently to least recently inserted. @@ -1915,7 +1915,7 @@ void QHashData::checkSanity() the STL-style iterator for the first item with a key and iterate from there: - \snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 26 + \snippet code/src_corelib_tools_qhash.cpp 26 QMultiHash's key and value data types must be \l{assignable data types}. You cannot, for example, store a QWidget as a value; diff --git a/src/corelib/tools/qiterator.qdoc b/src/corelib/tools/qiterator.qdoc index e19a751755..508664ec45 100644 --- a/src/corelib/tools/qiterator.qdoc +++ b/src/corelib/tools/qiterator.qdoc @@ -50,7 +50,7 @@ the list (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 0 + \snippet code/doc_src_qiterator.cpp 0 The next() function returns the next item in the list and advances the iterator. Unlike STL-style iterators, Java-style @@ -61,11 +61,11 @@ position between the second and third item, and returns the second item; and so on. - \img javaiterators1.png + \image javaiterators1.png Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 1 + \snippet code/doc_src_qiterator.cpp 1 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. @@ -98,7 +98,7 @@ beginning of the list (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 2 + \snippet code/doc_src_qiterator.cpp 2 The next() function returns the next item in the list and advances the iterator. Unlike STL-style iterators, Java-style @@ -109,11 +109,11 @@ position between the second and third item, and returns the second item; and so on. - \img javaiterators1.png + \image javaiterators1.png Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 3 + \snippet code/doc_src_qiterator.cpp 3 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. @@ -150,7 +150,7 @@ of the vector (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 4 + \snippet code/doc_src_qiterator.cpp 4 The next() function returns the next item in the vector and advances the iterator. Unlike STL-style iterators, Java-style @@ -161,11 +161,11 @@ position between the second and third item, returning the second item; and so on. - \img javaiterators1.png + \image javaiterators1.png Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 5 + \snippet code/doc_src_qiterator.cpp 5 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. @@ -197,7 +197,7 @@ the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 6 + \snippet code/doc_src_qiterator.cpp 6 The next() function returns the next item in the set and advances the iterator. Unlike STL-style iterators, Java-style @@ -208,11 +208,11 @@ position between the second and third item, returning the second item; and so on. - \img javaiterators1.png + \image javaiterators1.png Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 7 + \snippet code/doc_src_qiterator.cpp 7 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. @@ -251,7 +251,7 @@ of the list (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 8 + \snippet code/doc_src_qiterator.cpp 8 The next() function returns the next item in the list and advances the iterator. Unlike STL-style iterators, Java-style @@ -262,11 +262,11 @@ position between the second and third item, returning the second item; and so on. - \img javaiterators1.png + \image javaiterators1.png Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 9 + \snippet code/doc_src_qiterator.cpp 9 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. @@ -277,7 +277,7 @@ insert(). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 10 + \snippet code/doc_src_qiterator.cpp 10 The example traverses a list, replacing negative numbers with their absolute values, and eliminating zeroes. @@ -312,7 +312,7 @@ beginning of the list (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 11 + \snippet code/doc_src_qiterator.cpp 11 The next() function returns the next item in the list and advances the iterator. Unlike STL-style iterators, Java-style @@ -323,11 +323,11 @@ position between the second and third item, returning the second item; and so on. - \img javaiterators1.png + \image javaiterators1.png Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 12 + \snippet code/doc_src_qiterator.cpp 12 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. @@ -338,7 +338,7 @@ insert(). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 13 + \snippet code/doc_src_qiterator.cpp 13 The example traverses a list, replacing negative numbers with their absolute values, and eliminating zeroes. @@ -378,7 +378,7 @@ beginning of the list (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 14 + \snippet code/doc_src_qiterator.cpp 14 The next() function returns the next item in the vector and advances the iterator. Unlike STL-style iterators, Java-style @@ -389,11 +389,11 @@ position between the second and third item, returning the second item; and so on. - \img javaiterators1.png + \image javaiterators1.png Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 15 + \snippet code/doc_src_qiterator.cpp 15 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. @@ -404,7 +404,7 @@ insert(). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 16 + \snippet code/doc_src_qiterator.cpp 16 The example traverses a vector, replacing negative numbers with their absolute values, and eliminating zeroes. @@ -440,7 +440,7 @@ of the set (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 17 + \snippet code/doc_src_qiterator.cpp 17 The next() function returns the next item in the set and advances the iterator. Unlike STL-style iterators, Java-style @@ -451,11 +451,11 @@ position between the second and third item, returning the second item; and so on. - \img javaiterators1.png + \image javaiterators1.png Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 18 + \snippet code/doc_src_qiterator.cpp 18 If you want to remove items as you iterate over the set, use remove(). @@ -755,7 +755,7 @@ traversal functions (next(), previous(), findNext(), findPrevious()). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 19 + \snippet code/doc_src_qiterator.cpp 19 \sa insert(), setValue() */ @@ -766,7 +766,7 @@ traversal functions (next(), previous(), findNext(), findPrevious()). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 20 + \snippet code/doc_src_qiterator.cpp 20 \sa insert(), setValue() */ @@ -777,7 +777,7 @@ traversal functions (next(), previous(), findNext(), findPrevious()). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 21 + \snippet code/doc_src_qiterator.cpp 21 \sa insert(), setValue() */ @@ -788,7 +788,7 @@ traversal functions (next(), previous(), findNext(), findPrevious()). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 22 + \snippet code/doc_src_qiterator.cpp 22 \sa value() */ @@ -802,7 +802,7 @@ findPrevious(). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 23 + \snippet code/doc_src_qiterator.cpp 23 \sa value(), remove(), insert() */ @@ -816,7 +816,7 @@ findPrevious(). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 24 + \snippet code/doc_src_qiterator.cpp 24 \sa value(), remove(), insert() */ @@ -830,7 +830,7 @@ findPrevious(). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 25 + \snippet code/doc_src_qiterator.cpp 25 \sa value(), remove(), insert() */ @@ -889,7 +889,7 @@ the map (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 26 + \snippet code/doc_src_qiterator.cpp 26 The next() function returns the next item in the map and advances the iterator. The key() and value() functions return the @@ -902,16 +902,16 @@ next() advances the iterator to the position between the second and third item; and so on. - \img javaiterators1.png + \image javaiterators1.png Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 27 + \snippet code/doc_src_qiterator.cpp 27 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. For example: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 28 + \snippet code/doc_src_qiterator.cpp 28 Multiple iterators can be used on the same map. If the map is modified while a QMapIterator is active, the QMapIterator will @@ -941,7 +941,7 @@ the hash (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 29 + \snippet code/doc_src_qiterator.cpp 29 The next() function returns the next item in the hash and advances the iterator. The key() and value() functions return the @@ -954,16 +954,16 @@ next() advances the iterator to the position between the second and third item; and so on. - \img javaiterators1.png + \image javaiterators1.png Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 30 + \snippet code/doc_src_qiterator.cpp 30 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. For example: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 31 + \snippet code/doc_src_qiterator.cpp 31 Multiple iterators can be used on the same hash. If the hash is modified while a QHashIterator is active, the QHashIterator will @@ -994,7 +994,7 @@ of the map (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 32 + \snippet code/doc_src_qiterator.cpp 32 The next() function returns the next item in the map and advances the iterator. The key() and value() functions return the @@ -1007,16 +1007,16 @@ next() advances the iterator to the position between the second and third item; and so on. - \img javaiterators1.png + \image javaiterators1.png Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 33 + \snippet code/doc_src_qiterator.cpp 33 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. For example: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 34 + \snippet code/doc_src_qiterator.cpp 34 If you want to remove items as you iterate over the map, use remove(). If you want to modify the value of an item, use @@ -1024,7 +1024,7 @@ Example: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 35 + \snippet code/doc_src_qiterator.cpp 35 The example removes all (key, value) pairs where the key and the value are the same. @@ -1059,7 +1059,7 @@ of the hash (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 36 + \snippet code/doc_src_qiterator.cpp 36 The next() function returns the next item in the hash and advances the iterator. The key() and value() functions return the @@ -1072,16 +1072,16 @@ next() advances the iterator to the position between the second and third item; and so on. - \img javaiterators1.png + \image javaiterators1.png Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 37 + \snippet code/doc_src_qiterator.cpp 37 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. For example: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 38 + \snippet code/doc_src_qiterator.cpp 38 If you want to remove items as you iterate over the hash, use remove(). If you want to modify the value of an item, use @@ -1089,7 +1089,7 @@ Example: - \snippet doc/src/snippets/code/doc_src_qiterator.cpp 39 + \snippet code/doc_src_qiterator.cpp 39 The example removes all (key, value) pairs where the key and the value are the same. diff --git a/src/corelib/tools/qlinkedlist.cpp b/src/corelib/tools/qlinkedlist.cpp index 1502f70d56..3682818099 100644 --- a/src/corelib/tools/qlinkedlist.cpp +++ b/src/corelib/tools/qlinkedlist.cpp @@ -81,13 +81,13 @@ const QLinkedListData QLinkedListData::shared_null = { Here's an example of a QLinkedList that stores integers and a QLinkedList that stores QTime values: - \snippet doc/src/snippets/code/src_corelib_tools_qlinkedlist.cpp 0 + \snippet code/src_corelib_tools_qlinkedlist.cpp 0 QLinkedList stores a list of items. The default constructor creates an empty list. To insert items into the list, you can use operator<<(): - \snippet doc/src/snippets/code/src_corelib_tools_qlinkedlist.cpp 1 + \snippet code/src_corelib_tools_qlinkedlist.cpp 1 If you want to get the first or last item in a linked list, use first() or last(). If you want to remove an item from either end @@ -99,7 +99,7 @@ const QLinkedListData QLinkedListData::shared_null = { list and do something with it. For this, QLinkedList provides takeFirst() and takeLast(). Here's a loop that removes the items from a list one at a time and calls \c delete on them: - \snippet doc/src/snippets/code/src_corelib_tools_qlinkedlist.cpp 2 + \snippet code/src_corelib_tools_qlinkedlist.cpp 2 QLinkedList's value type must be an \l {assignable data type}. This covers most data types that are commonly used, but the compiler @@ -230,7 +230,7 @@ const QLinkedListData QLinkedListData::shared_null = { Inserts \a value at the end of the list. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlinkedlist.cpp 3 + \snippet code/src_corelib_tools_qlinkedlist.cpp 3 This is the same as list.insert(end(), \a value). @@ -242,7 +242,7 @@ const QLinkedListData QLinkedListData::shared_null = { Inserts \a value at the beginning of the list. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlinkedlist.cpp 4 + \snippet code/src_corelib_tools_qlinkedlist.cpp 4 This is the same as list.insert(begin(), \a value). @@ -254,7 +254,7 @@ const QLinkedListData QLinkedListData::shared_null = { Removes all occurrences of \a value in the list. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlinkedlist.cpp 5 + \snippet code/src_corelib_tools_qlinkedlist.cpp 5 This function requires the value type to have an implementation of \c operator==(). @@ -270,7 +270,7 @@ const QLinkedListData QLinkedListData::shared_null = { success; otherwise returns false. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlinkedlist.cpp 6 + \snippet code/src_corelib_tools_qlinkedlist.cpp 6 This function requires the value type to have an implementation of \c operator==(). @@ -635,35 +635,35 @@ const QLinkedListData QLinkedListData::shared_null = { QLinkedList::insert() before you can start iterating. Here's a typical loop that prints all the items stored in a list: - \snippet doc/src/snippets/code/src_corelib_tools_qlinkedlist.cpp 7 + \snippet code/src_corelib_tools_qlinkedlist.cpp 7 STL-style iterators can be used as arguments to \l{generic algorithms}. For example, here's how to find an item in the list using the qFind() algorithm: - \snippet doc/src/snippets/code/src_corelib_tools_qlinkedlist.cpp 8 + \snippet code/src_corelib_tools_qlinkedlist.cpp 8 Let's see a few examples of things we can do with a QLinkedList::iterator that we cannot do with a QLinkedList::const_iterator. Here's an example that increments every value stored in a QLinkedList\<int\> by 2: - \snippet doc/src/snippets/code/src_corelib_tools_qlinkedlist.cpp 9 + \snippet code/src_corelib_tools_qlinkedlist.cpp 9 Here's an example that removes all the items that start with an underscore character in a QLinkedList\<QString\>: - \snippet doc/src/snippets/code/src_corelib_tools_qlinkedlist.cpp 10 + \snippet code/src_corelib_tools_qlinkedlist.cpp 10 The call to QLinkedList::erase() removes the item pointed to by the iterator from the list, and returns an iterator to the next item. Here's another way of removing an item while iterating: - \snippet doc/src/snippets/code/src_corelib_tools_qlinkedlist.cpp 11 + \snippet code/src_corelib_tools_qlinkedlist.cpp 11 It might be tempting to write code like this: - \snippet doc/src/snippets/code/src_corelib_tools_qlinkedlist.cpp 12 + \snippet code/src_corelib_tools_qlinkedlist.cpp 12 However, this will potentially crash in \c{++i}, because \c i is a dangling iterator after the call to erase(). @@ -686,7 +686,7 @@ const QLinkedListData QLinkedListData::shared_null = { on an uninitialized iterator. Use operator=() to assign a value to it before using it. - \sa QLinkedList::begin() QLinkedList::end() + \sa QLinkedList::begin(), QLinkedList::end() */ /*! \fn QLinkedList::iterator::iterator(Node *node) @@ -736,7 +736,7 @@ const QLinkedListData QLinkedListData::shared_null = { You can change the value of an item by using operator*() on the left side of an assignment, for example: - \snippet doc/src/snippets/code/src_corelib_tools_qlinkedlist.cpp 13 + \snippet code/src_corelib_tools_qlinkedlist.cpp 13 \sa operator->() */ @@ -868,13 +868,13 @@ const QLinkedListData QLinkedListData::shared_null = { QLinkedList::insert() before you can start iterating. Here's a typical loop that prints all the items stored in a list: - \snippet doc/src/snippets/code/src_corelib_tools_qlinkedlist.cpp 14 + \snippet code/src_corelib_tools_qlinkedlist.cpp 14 STL-style iterators can be used as arguments to \l{generic algorithms}. For example, here's how to find an item in the list using the qFind() algorithm: - \snippet doc/src/snippets/code/src_corelib_tools_qlinkedlist.cpp 15 + \snippet code/src_corelib_tools_qlinkedlist.cpp 15 Multiple iterators can be used on the same list. If you add items to the list, existing iterators will remain valid. If you remove @@ -892,7 +892,7 @@ const QLinkedListData QLinkedListData::shared_null = { on an uninitialized iterator. Use operator=() to assign a value to it before using it. - \sa QLinkedList::constBegin() QLinkedList::constEnd() + \sa QLinkedList::constBegin(), QLinkedList::constEnd() */ /*! \fn QLinkedList::const_iterator::const_iterator(Node *node) @@ -1082,7 +1082,7 @@ const QLinkedListData QLinkedListData::shared_null = { Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlinkedlist.cpp 16 + \snippet code/src_corelib_tools_qlinkedlist.cpp 16 \sa toStdList() */ @@ -1094,7 +1094,7 @@ const QLinkedListData QLinkedListData::shared_null = { Returns a std::list object with the data contained in this QLinkedList. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlinkedlist.cpp 17 + \snippet code/src_corelib_tools_qlinkedlist.cpp 17 \sa fromStdList() */ diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp index c87b3e7d24..b3514d35ef 100644 --- a/src/corelib/tools/qlist.cpp +++ b/src/corelib/tools/qlist.cpp @@ -375,7 +375,7 @@ void **QListData::erase(void **xi) Here's an example of a QList that stores integers and a QList that stores QDate values: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 0 + \snippet code/src_corelib_tools_qlistdata.cpp 0 Qt includes a QStringList class that inherits QList\<QString\> and adds a few convenience functions, such as QStringList::join() @@ -386,7 +386,7 @@ void **QListData::erase(void **xi) empty list. To insert items into the list, you can use operator<<(): - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 1 + \snippet code/src_corelib_tools_qlistdata.cpp 1 QList provides these basic functions to add, move, and remove items: insert(), replace(), removeAt(), move(), and swap(). In @@ -398,13 +398,13 @@ void **QListData::erase(void **xi) non-const lists, operator[]() returns a reference to the item and can be used on the left side of an assignment: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 2 + \snippet code/src_corelib_tools_qlistdata.cpp 2 Because QList is implemented as an array of pointers, this operation is very fast (\l{constant time}). For read-only access, an alternative syntax is to use at(): - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 3 + \snippet code/src_corelib_tools_qlistdata.cpp 3 at() can be faster than operator[](), because it never causes a \l{deep copy} to occur. @@ -414,7 +414,7 @@ void **QListData::erase(void **xi) and takeLast(). Here's a loop that removes the items from a list one at a time and calls \c delete on them: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 4 + \snippet code/src_corelib_tools_qlistdata.cpp 4 Inserting and removing items at either ends of the list is very fast (\l{constant time} in most cases), because QList @@ -427,7 +427,7 @@ void **QListData::erase(void **xi) backward. Both return the index of a matching item if they find it; otherwise, they return -1. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 5 + \snippet code/src_corelib_tools_qlistdata.cpp 5 If you simply want to check whether a list contains a particular value, use contains(). If you want to find out how many times a @@ -652,7 +652,7 @@ void **QListData::erase(void **xi) Inserts \a value at the end of the list. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 6 + \snippet code/src_corelib_tools_qlistdata.cpp 6 This is the same as list.insert(size(), \a value). @@ -680,7 +680,7 @@ void **QListData::erase(void **xi) Inserts \a value at the beginning of the list. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 7 + \snippet code/src_corelib_tools_qlistdata.cpp 7 This is the same as list.insert(0, \a value). @@ -698,7 +698,7 @@ void **QListData::erase(void **xi) value is appended to the list. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 8 + \snippet code/src_corelib_tools_qlistdata.cpp 8 \sa append(), prepend(), replace(), removeAt() */ @@ -729,7 +729,7 @@ void **QListData::erase(void **xi) number of entries removed. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 9 + \snippet code/src_corelib_tools_qlistdata.cpp 9 This function requires the value type to have an implementation of \c operator==(). @@ -745,7 +745,7 @@ void **QListData::erase(void **xi) true on success; otherwise returns false. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 10 + \snippet code/src_corelib_tools_qlistdata.cpp 10 This function requires the value type to have an implementation of \c operator==(). @@ -805,7 +805,7 @@ void **QListData::erase(void **xi) Moves the item at index position \a from to index position \a to. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 11 + \snippet code/src_corelib_tools_qlistdata.cpp 11 This is the same as insert(\a{to}, takeAt(\a{from})).This function assumes that both \a from and \a to are at least 0 but less than @@ -823,7 +823,7 @@ void **QListData::erase(void **xi) \a i and \a j are at least 0 and less than size(). Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 12 + \snippet code/src_corelib_tools_qlistdata.cpp 12 \sa move() */ @@ -835,7 +835,7 @@ void **QListData::erase(void **xi) -1 if no item matched. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 13 + \snippet code/src_corelib_tools_qlistdata.cpp 13 This function requires the value type to have an implementation of \c operator==(). @@ -855,7 +855,7 @@ void **QListData::erase(void **xi) Returns -1 if no item matched. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 14 + \snippet code/src_corelib_tools_qlistdata.cpp 14 This function requires the value type to have an implementation of \c operator==(). @@ -1237,14 +1237,14 @@ void **QListData::erase(void **xi) start iterating. Here's a typical loop that prints all the items stored in a list: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 15 + \snippet code/src_corelib_tools_qlistdata.cpp 15 Let's see a few examples of things we can do with a QList::iterator that we cannot do with a QList::const_iterator. Here's an example that increments every value stored in a QList\<int\> by 2: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 16 + \snippet code/src_corelib_tools_qlistdata.cpp 16 Most QList functions accept an integer index rather than an iterator. For that reason, iterators are rarely useful in @@ -1254,7 +1254,7 @@ void **QListData::erase(void **xi) For example, here's how to delete all the widgets stored in a QList\<QWidget *\>: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 17 + \snippet code/src_corelib_tools_qlistdata.cpp 17 Multiple iterators can be used on the same list. However, be aware that any non-const function call performed on the QList @@ -1299,7 +1299,7 @@ void **QListData::erase(void **xi) on an uninitialized iterator. Use operator=() to assign a value to it before using it. - \sa QList::begin() QList::end() + \sa QList::begin(), QList::end() */ /*! \fn QList::iterator::iterator(Node *node) @@ -1319,7 +1319,7 @@ void **QListData::erase(void **xi) You can change the value of an item by using operator*() on the left side of an assignment, for example: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 18 + \snippet code/src_corelib_tools_qlistdata.cpp 18 \sa operator->() */ @@ -1493,7 +1493,7 @@ void **QListData::erase(void **xi) QList::insert() before you can start iterating. Here's a typical loop that prints all the items stored in a list: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 19 + \snippet code/src_corelib_tools_qlistdata.cpp 19 Most QList functions accept an integer index rather than an iterator. For that reason, iterators are rarely useful in @@ -1503,7 +1503,7 @@ void **QListData::erase(void **xi) For example, here's how to delete all the widgets stored in a QList\<QWidget *\>: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 20 + \snippet code/src_corelib_tools_qlistdata.cpp 20 Multiple iterators can be used on the same list. However, be aware that any non-const function call performed on the QList @@ -1522,7 +1522,7 @@ void **QListData::erase(void **xi) on an uninitialized iterator. Use operator=() to assign a value to it before using it. - \sa QList::constBegin() QList::constEnd() + \sa QList::constBegin(), QList::constEnd() */ /*! \typedef QList::const_iterator::iterator_category @@ -1738,7 +1738,7 @@ void **QListData::erase(void **xi) Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 21 + \snippet code/src_corelib_tools_qlistdata.cpp 21 \sa fromSet(), toVector(), QVector::toList() */ @@ -1749,7 +1749,7 @@ void **QListData::erase(void **xi) Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 22 + \snippet code/src_corelib_tools_qlistdata.cpp 22 \sa toSet(), fromVector(), QVector::fromList() */ @@ -1761,7 +1761,7 @@ void **QListData::erase(void **xi) Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 23 + \snippet code/src_corelib_tools_qlistdata.cpp 23 \sa fromVector(), toSet(), QSet::toList(), qSort() */ @@ -1774,7 +1774,7 @@ void **QListData::erase(void **xi) Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 24 + \snippet code/src_corelib_tools_qlistdata.cpp 24 \sa toVector(), fromSet(), QSet::fromList() */ @@ -1786,7 +1786,7 @@ void **QListData::erase(void **xi) Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 25 + \snippet code/src_corelib_tools_qlistdata.cpp 25 \sa toStdList(), QVector::fromStdVector() */ @@ -1796,7 +1796,7 @@ void **QListData::erase(void **xi) Returns a std::list object with the data contained in this QList. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 26 + \snippet code/src_corelib_tools_qlistdata.cpp 26 \sa fromStdList(), QVector::toStdVector() */ diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index b9f199e50e..791e8d0513 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -681,7 +681,7 @@ QLocale::QLocale() The language and country that are actually used can be queried using language() and country(). - \sa setDefault() language() country() + \sa setDefault(), language(), country() */ QLocale::QLocale(Language language, Country country) @@ -720,7 +720,7 @@ QLocale::QLocale(Language language, Country country) The language, script and country that are actually used can be queried using language(), script() and country(). - \sa setDefault() language() script() country() + \sa setDefault(), language(), script(), country() */ QLocale::QLocale(Language language, Script script, Country country) @@ -883,7 +883,7 @@ QString QLocale::createSeparatedList(const QStringList &list) const should be set at application startup, before any non-GUI threads are created. - \sa system() c() + \sa system(), c() */ void QLocale::setDefault(const QLocale &locale) @@ -1202,7 +1202,7 @@ float QLocale::toFloat(const QString &s, bool *ok) const the "C" locale if the string cannot be interpreted in this locale. - \snippet doc/src/snippets/code/src_corelib_tools_qlocale.cpp 3 + \snippet code/src_corelib_tools_qlocale.cpp 3 Notice that the last conversion returns 1234.0, because '.' is the thousands group separator in the German locale. diff --git a/src/corelib/tools/qlocale.qdoc b/src/corelib/tools/qlocale.qdoc index 32822c2e6e..ed80984de3 100644 --- a/src/corelib/tools/qlocale.qdoc +++ b/src/corelib/tools/qlocale.qdoc @@ -42,7 +42,7 @@ Example: - \snippet doc/src/snippets/code/src_corelib_tools_qlocale.cpp 0 + \snippet code/src_corelib_tools_qlocale.cpp 0 QLocale supports the concept of a default locale, which is determined from the system's locale settings at application @@ -63,7 +63,7 @@ The following example illustrates how to use QLocale directly: - \snippet doc/src/snippets/code/src_corelib_tools_qlocale.cpp 1 + \snippet code/src_corelib_tools_qlocale.cpp 1 When a language/country pair is specified in the constructor, one of three things can happen: @@ -83,7 +83,7 @@ An alternative method for constructing a QLocale object is by specifying the locale name. - \snippet doc/src/snippets/code/src_corelib_tools_qlocale.cpp 2 + \snippet code/src_corelib_tools_qlocale.cpp 2 This constructor converts the locale name to a language/country pair; it does not use the system locale database. @@ -662,7 +662,7 @@ will fail if they encounter group separators in their input. The default is to accept numbers containing correctly placed group separators. - \sa setNumberOptions() numberOptions() + \sa setNumberOptions(), numberOptions() */ /*! diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index 90521d343c..8002e7c1f0 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -388,21 +388,21 @@ void QMapDataBase::freeData(QMapDataBase *d) \endlist Here's an example QMap with QString keys and \c int values: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 0 + \snippet code/src_corelib_tools_qmap.cpp 0 To insert a (key, value) pair into the map, you can use operator[](): - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 1 + \snippet code/src_corelib_tools_qmap.cpp 1 This inserts the following three (key, value) pairs into the QMap: ("one", 1), ("three", 3), and ("seven", 7). Another way to insert items into the map is to use insert(): - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 2 + \snippet code/src_corelib_tools_qmap.cpp 2 To look up a value, use operator[]() or value(): - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 3 + \snippet code/src_corelib_tools_qmap.cpp 3 If there is no item with the specified key in the map, these functions return a \l{default-constructed value}. @@ -410,12 +410,12 @@ void QMapDataBase::freeData(QMapDataBase *d) If you want to check whether the map contains a certain key, use contains(): - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 4 + \snippet code/src_corelib_tools_qmap.cpp 4 There is also a value() overload that uses its second argument as a default value if there is no item with the specified key: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 5 + \snippet code/src_corelib_tools_qmap.cpp 5 In general, we recommend that you use contains() and value() rather than operator[]() for looking up a key in a map. The @@ -424,7 +424,7 @@ void QMapDataBase::freeData(QMapDataBase *d) const). For example, the following code snippet will create 1000 items in memory: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 6 + \snippet code/src_corelib_tools_qmap.cpp 6 To avoid this problem, replace \c map[i] with \c map.value(i) in the code above. @@ -436,11 +436,11 @@ void QMapDataBase::freeData(QMapDataBase *d) QMap::iterator). Here's how to iterate over a QMap<QString, int> using a Java-style iterator: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 7 + \snippet code/src_corelib_tools_qmap.cpp 7 Here's the same code, but using an STL-style iterator this time: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 8 + \snippet code/src_corelib_tools_qmap.cpp 8 The items are traversed in ascending key order. @@ -448,7 +448,7 @@ void QMapDataBase::freeData(QMapDataBase *d) insert() with a key that already exists in the QMap, the previous value will be erased. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 9 + \snippet code/src_corelib_tools_qmap.cpp 9 However, you can store multiple values per key by using insertMulti() instead of insert() (or using the convenience @@ -456,19 +456,19 @@ void QMapDataBase::freeData(QMapDataBase *d) single key, you can use values(const Key &key), which returns a QList<T>: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 10 + \snippet code/src_corelib_tools_qmap.cpp 10 The items that share the same key are available from most recently to least recently inserted. Another approach is to call find() to get the STL-style iterator for the first item with a key and iterate from there: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 11 + \snippet code/src_corelib_tools_qmap.cpp 11 If you only need to extract the values from a map (not the keys), you can also use \l{foreach}: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 12 + \snippet code/src_corelib_tools_qmap.cpp 12 Items can be removed from the map in several ways. One way is to call remove(); this will remove any item with the given key. @@ -484,7 +484,7 @@ void QMapDataBase::freeData(QMapDataBase *d) < y} nor \c{y < x} is true. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 13 + \snippet code/src_corelib_tools_qmap.cpp 13 In the example, we start by comparing the employees' names. If they're equal, we compare their dates of birth to break the tie. @@ -881,7 +881,7 @@ void QMapDataBase::freeData(QMapDataBase *d) the iterator. For example, here's some code that iterates over all the items with the same key: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 14 + \snippet code/src_corelib_tools_qmap.cpp 14 \sa constFind(), value(), values(), lowerBound(), upperBound(), QMultiMap::find() */ @@ -911,7 +911,7 @@ void QMapDataBase::freeData(QMapDataBase *d) key. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 15 + \snippet code/src_corelib_tools_qmap.cpp 15 If the map contains multiple items with key \a key, this function returns an iterator that points to the most recently @@ -919,7 +919,7 @@ void QMapDataBase::freeData(QMapDataBase *d) the iterator. For example, here's some code that iterates over all the items with the same key: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 16 + \snippet code/src_corelib_tools_qmap.cpp 16 \sa qLowerBound(), upperBound(), find() */ @@ -937,7 +937,7 @@ void QMapDataBase::freeData(QMapDataBase *d) nearest item with a greater key. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 17 + \snippet code/src_corelib_tools_qmap.cpp 17 \sa qUpperBound(), lowerBound(), find() */ @@ -1042,7 +1042,7 @@ void QMapDataBase::freeData(QMapDataBase *d) start iterating. Here's a typical loop that prints all the (key, value) pairs stored in a map: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 18 + \snippet code/src_corelib_tools_qmap.cpp 18 Unlike QHash, which stores its items in an arbitrary order, QMap stores its items ordered by key. Items that share the same key @@ -1055,22 +1055,22 @@ void QMapDataBase::freeData(QMapDataBase *d) Here's an example that increments every value stored in the QMap by 2: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 19 + \snippet code/src_corelib_tools_qmap.cpp 19 Here's an example that removes all the items whose key is a string that starts with an underscore character: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 20 + \snippet code/src_corelib_tools_qmap.cpp 20 The call to QMap::erase() removes the item pointed to by the iterator from the map, and returns an iterator to the next item. Here's another way of removing an item while iterating: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 21 + \snippet code/src_corelib_tools_qmap.cpp 21 It might be tempting to write code like this: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 22 + \snippet code/src_corelib_tools_qmap.cpp 22 However, this will potentially crash in \c{++i}, because \c i is a dangling iterator after the call to erase(). @@ -1122,7 +1122,7 @@ void QMapDataBase::freeData(QMapDataBase *d) called on an uninitialized iterator. Use operator=() to assign a value to it before using it. - \sa QMap::begin() QMap::end() + \sa QMap::begin(), QMap::end() */ /*! \fn QMap::iterator::iterator(QMapData::Node *node) @@ -1148,7 +1148,7 @@ void QMapDataBase::freeData(QMapDataBase *d) You can change the value of an item by using value() on the left side of an assignment, for example: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 23 + \snippet code/src_corelib_tools_qmap.cpp 23 \sa key(), operator*() */ @@ -1289,7 +1289,7 @@ void QMapDataBase::freeData(QMapDataBase *d) QMap::find() before you can start iterating. Here's a typical loop that prints all the (key, value) pairs stored in a map: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 24 + \snippet code/src_corelib_tools_qmap.cpp 24 Unlike QHash, which stores its items in an arbitrary order, QMap stores its items ordered by key. Items that share the same key @@ -1344,7 +1344,7 @@ void QMapDataBase::freeData(QMapDataBase *d) called on an uninitialized iterator. Use operator=() to assign a value to it before using it. - \sa QMap::constBegin() QMap::constEnd() + \sa QMap::constBegin(), QMap::constEnd() */ /*! \fn QMap::const_iterator::const_iterator(QMapData::Node *node) @@ -1530,7 +1530,7 @@ void QMapDataBase::freeData(QMapDataBase *d) operator+=(). Example: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 25 + \snippet code/src_corelib_tools_qmap.cpp 25 Unlike QMap, QMultiMap provides no operator[]. Use value() or replace() if you want to access the most recently inserted item @@ -1539,7 +1539,7 @@ void QMapDataBase::freeData(QMapDataBase *d) If you want to retrieve all the values for a single key, you can use values(const Key &key), which returns a QList<T>: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 26 + \snippet code/src_corelib_tools_qmap.cpp 26 The items that share the same key are available from most recently to least recently inserted. @@ -1548,7 +1548,7 @@ void QMapDataBase::freeData(QMapDataBase *d) the iterator for the first item with a key and iterate from there: - \snippet doc/src/snippets/code/src_corelib_tools_qmap.cpp 27 + \snippet code/src_corelib_tools_qmap.cpp 27 QMultiMap's key and value data types must be \l{assignable data types}. This covers most data types you are likely to encounter, diff --git a/src/corelib/tools/qpair.qdoc b/src/corelib/tools/qpair.qdoc index fdf1eafc23..ddaf82497e 100644 --- a/src/corelib/tools/qpair.qdoc +++ b/src/corelib/tools/qpair.qdoc @@ -40,12 +40,12 @@ Here's an example of a QPair that stores one QString and one \c double value: - \snippet doc/src/snippets/code/doc_src_qpair.cpp 0 + \snippet code/doc_src_qpair.cpp 0 The components are accessible as public data members called \l first and \l second. For example: - \snippet doc/src/snippets/code/doc_src_qpair.cpp 1 + \snippet code/doc_src_qpair.cpp 1 QPair's template data types (T1 and T2) must be \l{assignable data types}. You cannot, for example, store a QWidget as a value; @@ -95,12 +95,6 @@ \sa qMakePair() */ -/*! - \fn QPair<T1, T2> &QPair::operator=(const QPair<T1, T2> &other) - - Assigns \a other to this pair. -*/ - /*! \fn bool operator==(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2) \relates QPair @@ -186,7 +180,7 @@ Returns a QPair\<T1, T2\> that contains \a value1 and \a value2. Example: - \snippet doc/src/snippets/code/doc_src_qpair.cpp 2 + \snippet code/doc_src_qpair.cpp 2 This is equivalent to QPair<T1, T2>(\a value1, \a value2), but usually requires less typing. diff --git a/src/corelib/tools/qpoint.cpp b/src/corelib/tools/qpoint.cpp index ecbe9deb9f..edc103f0b2 100644 --- a/src/corelib/tools/qpoint.cpp +++ b/src/corelib/tools/qpoint.cpp @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE Given a point \e p, the following statements are all equivalent: - \snippet doc/src/snippets/code/src_corelib_tools_qpoint.cpp 0 + \snippet code/src_corelib_tools_qpoint.cpp 0 A QPoint object can also be used as a vector: Addition and subtraction are defined as for vectors (each component is added @@ -126,7 +126,7 @@ QT_BEGIN_NAMESPACE Sets the x coordinate of this point to the given \a x coordinate. - \sa x() setY() + \sa x(), setY() */ /*! @@ -134,7 +134,7 @@ QT_BEGIN_NAMESPACE Sets the y coordinate of this point to the given \a y coordinate. - \sa y() setX() + \sa y(), setX() */ @@ -145,9 +145,9 @@ QT_BEGIN_NAMESPACE Using a reference makes it possible to directly manipulate x. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qpoint.cpp 1 + \snippet code/src_corelib_tools_qpoint.cpp 1 - \sa x() setX() + \sa x(), setX() */ /*! @@ -158,7 +158,7 @@ QT_BEGIN_NAMESPACE Using a reference makes it possible to directly manipulate y. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qpoint.cpp 2 + \snippet code/src_corelib_tools_qpoint.cpp 2 \sa y(), setY() */ @@ -170,7 +170,7 @@ QT_BEGIN_NAMESPACE Adds the given \a point to this point and returns a reference to this point. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qpoint.cpp 3 + \snippet code/src_corelib_tools_qpoint.cpp 3 \sa operator-=() */ @@ -181,7 +181,7 @@ QT_BEGIN_NAMESPACE Subtracts the given \a point from this point and returns a reference to this point. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qpoint.cpp 4 + \snippet code/src_corelib_tools_qpoint.cpp 4 \sa operator+=() */ @@ -204,7 +204,7 @@ QT_BEGIN_NAMESPACE Multiplies this point's coordinates by the given \a factor, and returns a reference to this point. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qpoint.cpp 5 + \snippet code/src_corelib_tools_qpoint.cpp 5 Note that the result is rounded to the nearest integer as points are held as integers. Use QPointF for floating point accuracy. @@ -331,7 +331,7 @@ QT_BEGIN_NAMESPACE Divides both x and y by the given \a divisor, and returns a reference to this point. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qpoint.cpp 6 + \snippet code/src_corelib_tools_qpoint.cpp 6 Note that the result is rounded to the nearest integer as points are held as integers. Use QPointF for floating point accuracy. @@ -408,12 +408,12 @@ QDataStream &operator>>(QDataStream &s, QPoint &p) traditionally known as the "Manhattan length" of the vector from the origin to the point. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qpoint.cpp 7 + \snippet code/src_corelib_tools_qpoint.cpp 7 This is a useful, and quick to calculate, approximation to the true length: - \snippet doc/src/snippets/code/src_corelib_tools_qpoint.cpp 8 + \snippet code/src_corelib_tools_qpoint.cpp 8 The tradition of "Manhattan length" arises because such distances apply to travelers who can only travel on a rectangular grid, like @@ -451,7 +451,7 @@ QDebug operator<<(QDebug d, const QPointF &p) Given a point \e p, the following statements are all equivalent: - \snippet doc/src/snippets/code/src_corelib_tools_qpoint.cpp 9 + \snippet code/src_corelib_tools_qpoint.cpp 9 A QPointF object can also be used as a vector: Addition and subtraction are defined as for vectors (each component is added @@ -534,7 +534,7 @@ QDebug operator<<(QDebug d, const QPointF &p) Sets the x coordinate of this point to the given \a x coordinate. - \sa x() setY() + \sa x(), setY() */ /*! @@ -552,7 +552,7 @@ QDebug operator<<(QDebug d, const QPointF &p) Using a reference makes it possible to directly manipulate x. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qpoint.cpp 10 + \snippet code/src_corelib_tools_qpoint.cpp 10 \sa x(), setX() */ @@ -564,9 +564,9 @@ QDebug operator<<(QDebug d, const QPointF &p) Using a reference makes it possible to directly manipulate y. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qpoint.cpp 11 + \snippet code/src_corelib_tools_qpoint.cpp 11 - \sa y() setY() + \sa y(), setY() */ /*! @@ -575,7 +575,7 @@ QDebug operator<<(QDebug d, const QPointF &p) Adds the given \a point to this point and returns a reference to this point. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qpoint.cpp 12 + \snippet code/src_corelib_tools_qpoint.cpp 12 \sa operator-=() */ @@ -586,7 +586,7 @@ QDebug operator<<(QDebug d, const QPointF &p) Subtracts the given \a point from this point and returns a reference to this point. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qpoint.cpp 13 + \snippet code/src_corelib_tools_qpoint.cpp 13 \sa operator+=() */ @@ -597,7 +597,7 @@ QDebug operator<<(QDebug d, const QPointF &p) Multiplies this point's coordinates by the given \a factor, and returns a reference to this point. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qpoint.cpp 14 + \snippet code/src_corelib_tools_qpoint.cpp 14 \sa operator/=() */ @@ -608,7 +608,7 @@ QDebug operator<<(QDebug d, const QPointF &p) Divides both x and y by the given \a divisor, and returns a reference to this point. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qpoint.cpp 15 + \snippet code/src_corelib_tools_qpoint.cpp 15 \sa operator*=() */ diff --git a/src/corelib/tools/qqueue.cpp b/src/corelib/tools/qqueue.cpp index 06d996a542..c5aa4c6bad 100644 --- a/src/corelib/tools/qqueue.cpp +++ b/src/corelib/tools/qqueue.cpp @@ -57,7 +57,7 @@ the head item without removing it. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qqueue.cpp 0 + \snippet code/src_corelib_tools_qqueue.cpp 0 The example will output 1, 2, 3 in that order. diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp index aeab97803d..22bf39bc77 100644 --- a/src/corelib/tools/qrect.cpp +++ b/src/corelib/tools/qrect.cpp @@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE height integers, or from a QPoint and a QSize. The following code creates two identical rectangles. - \snippet doc/src/snippets/code/src_corelib_tools_qrect.cpp 0 + \snippet code/src_corelib_tools_qrect.cpp 0 There is a third constructor that creates a QRect using the top-left and bottom-right coordinates, but we recommend that you @@ -1243,7 +1243,7 @@ QDebug operator<<(QDebug dbg, const QRect &r) { height integers, or from a QPoint and a QSize. The following code creates two identical rectangles. - \snippet doc/src/snippets/code/src_corelib_tools_qrect.cpp 1 + \snippet code/src_corelib_tools_qrect.cpp 1 There is also a third constructor creating a QRectF from a QRect, and a corresponding toRect() function that returns a QRect object @@ -1791,7 +1791,7 @@ QRectF QRectF::normalized() const \a y1), and the coordinates of its bottom-right corner to (\a x2, \a y2). - \sa getCoords() setRect() + \sa getCoords(), setRect() */ /*! diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp index 1db0fcf44c..79ceba5ceb 100644 --- a/src/corelib/tools/qregexp.cpp +++ b/src/corelib/tools/qregexp.cpp @@ -437,7 +437,7 @@ int qFindString(const QChar *haystack, int haystackLen, int from, When the number of matches cannot be determined in advance, a common idiom is to use cap() in a loop. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 0 + \snippet code/src_corelib_tools_qregexp.cpp 0 \target assertions \section1 Assertions @@ -532,7 +532,7 @@ int qFindString(const QChar *haystack, int haystackLen, int from, To test a string against a wildcard expression, use exactMatch(). For example: - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 1 + \snippet code/src_corelib_tools_qregexp.cpp 1 \target perl-users \section1 Notes for Perl Users @@ -555,7 +555,7 @@ int qFindString(const QChar *haystack, int haystackLen, int from, applied to all the quantifiers in the pattern. For example, to match the Perl regexp \b{ro+?m} requires: - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 2 + \snippet code/src_corelib_tools_qregexp.cpp 2 The equivalent of Perl's \c{/i} option is setCaseSensitivity(Qt::CaseInsensitive). @@ -584,7 +584,7 @@ int qFindString(const QChar *haystack, int haystackLen, int from, the other hand, C++'s rules for literal strings can be used to achieve the same: - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 3 + \snippet code/src_corelib_tools_qregexp.cpp 3 Both zero-width positive and zero-width negative lookahead assertions (?=pattern) and (?!pattern) are supported with the same @@ -603,12 +603,12 @@ int qFindString(const QChar *haystack, int haystackLen, int from, \target code-examples \section1 Code Examples - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 4 + \snippet code/src_corelib_tools_qregexp.cpp 4 The third string matches '\underline{6}'. This is a simple validation regexp for integers in the range 0 to 99. - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 5 + \snippet code/src_corelib_tools_qregexp.cpp 5 The second string matches '\underline{This_is-OK}'. We've used the character set abbreviation '\\S' (non-whitespace) and the anchors @@ -618,25 +618,25 @@ int qFindString(const QChar *haystack, int haystackLen, int from, 'letter' or 'correspondence' but only match whole words i.e. not 'email' - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 6 + \snippet code/src_corelib_tools_qregexp.cpp 6 The second string matches "Please write the \underline{letter}". The word 'letter' is also captured (because of the parentheses). We can see what text we've captured like this: - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 7 + \snippet code/src_corelib_tools_qregexp.cpp 7 This will capture the text from the first set of capturing parentheses (counting capturing left parentheses from left to right). The parentheses are counted from 1 since cap(0) is the whole matched regexp (equivalent to '&' in most regexp engines). - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 8 + \snippet code/src_corelib_tools_qregexp.cpp 8 Here we've passed the QRegExp to QString's replace() function to replace the matched text with new text. - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 9 + \snippet code/src_corelib_tools_qregexp.cpp 9 We've used the indexIn() function to repeatedly match the regexp in the string. Note that instead of moving forward by one character @@ -650,7 +650,7 @@ int qFindString(const QChar *haystack, int haystackLen, int from, One common use of regexps is to split lines of delimited data into their component fields. - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 10 + \snippet code/src_corelib_tools_qregexp.cpp 10 In this example our input lines have the format company name, web address and country. Unfortunately the regexp is rather long and @@ -660,13 +660,13 @@ int qFindString(const QChar *haystack, int haystackLen, int from, QString::split() function can take a separator string or regexp as an argument and split a string accordingly. - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 11 + \snippet code/src_corelib_tools_qregexp.cpp 11 Here field[0] is the company, field[1] the web address and so on. To imitate the matching of a shell we can use wildcard mode. - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 12 + \snippet code/src_corelib_tools_qregexp.cpp 12 Wildcard matching can be convenient because of its simplicity, but any wildcard regexp can be defined using full regexps, e.g. @@ -4255,7 +4255,7 @@ bool QRegExp::exactMatch(const QString &str) const QString::replace(). Example: - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 13 + \snippet code/src_corelib_tools_qregexp.cpp 13 Although const, this function sets matchedLength(), capturedTexts() and pos(). @@ -4332,14 +4332,6 @@ int QRegExp::matchedLength() const #ifndef QT_NO_REGEXP_CAPTURE /*! - \fn int QRegExp::numCaptures() const - \obsolete - Returns the number of captures contained in the regular expression. - - \sa captureCount() - */ - -/*! \since 4.6 Returns the number of captures contained in the regular expression. */ @@ -4357,17 +4349,17 @@ int QRegExp::captureCount() const (capturing) subexpression of the regexp. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 14 + \snippet code/src_corelib_tools_qregexp.cpp 14 The above example also captures elements that may be present but which we have no interest in. This problem can be solved by using non-capturing parentheses: - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 15 + \snippet code/src_corelib_tools_qregexp.cpp 15 Note that if you want to iterate over the list, you should iterate over a copy, e.g. - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 16 + \snippet code/src_corelib_tools_qregexp.cpp 16 Some regexps can match an indeterminate number of times. For example if the input string is "Offsets: 12 14 99 231 7" and the @@ -4420,7 +4412,7 @@ QStringList QRegExp::capturedTexts() match has index 0 and the parenthesized subexpressions have indexes starting from 1 (excluding non-capturing parentheses). - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 17 + \snippet code/src_corelib_tools_qregexp.cpp 17 The order of elements matched by cap() is as follows. The first element, cap(0), is the entire matching string. Each subsequent @@ -4449,7 +4441,7 @@ QString QRegExp::cap(int nth) of the whole match. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 18 + \snippet code/src_corelib_tools_qregexp.cpp 18 For zero-length matches, pos() always returns -1. (For example, if cap(4) would return an empty string, pos(4) returns -1.) This is @@ -4504,11 +4496,11 @@ QString QRegExp::errorString() Example: - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 19 + \snippet code/src_corelib_tools_qregexp.cpp 19 This function is useful to construct regexp patterns dynamically: - \snippet doc/src/snippets/code/src_corelib_tools_qregexp.cpp 20 + \snippet code/src_corelib_tools_qregexp.cpp 20 \sa setPatternSyntax() */ diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index 393b2bbb7d..ff423901e8 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -122,23 +122,23 @@ QT_BEGIN_NAMESPACE You can set the pattern string by passing a string to the QRegularExpression constructor: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 0 + \snippet code/src_corelib_tools_qregularexpression.cpp 0 This sets the pattern string to \c{a pattern}. You can also use the setPattern() function to set a pattern on an existing QRegularExpression object: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 1 + \snippet code/src_corelib_tools_qregularexpression.cpp 1 Note that due to C++ literal strings rules, you must escape all backslashes inside the pattern string with another backslash: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 2 + \snippet code/src_corelib_tools_qregularexpression.cpp 2 The pattern() function returns the pattern that is currently set for a QRegularExpression object: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 3 + \snippet code/src_corelib_tools_qregularexpression.cpp 3 \section1 Pattern options @@ -149,17 +149,17 @@ QT_BEGIN_NAMESPACE You can set the options by passing them to the QRegularExpression constructor, as in: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 4 + \snippet code/src_corelib_tools_qregularexpression.cpp 4 Alternatively, you can use the setPatternOptions() function on an existing QRegularExpressionObject: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 5 + \snippet code/src_corelib_tools_qregularexpression.cpp 5 It is possible to get the pattern options currently set on a QRegularExpression object by using the patternOptions() function: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 6 + \snippet code/src_corelib_tools_qregularexpression.cpp 6 Please refer to the QRegularExpression::PatternOption enum documentation for more information about each pattern option. @@ -187,20 +187,20 @@ QT_BEGIN_NAMESPACE QRegularExpressionMatch object that can be used to inspect the results of the match. For instance: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 7 + \snippet code/src_corelib_tools_qregularexpression.cpp 7 If a match is successful, the (implicit) capturing group number 0 can be used to retrieve the substring matched by the entire pattern (see also the section about \l{extracting captured substrings}): - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 8 + \snippet code/src_corelib_tools_qregularexpression.cpp 8 It's also possible to start a match at an arbitrary offset inside the subject string by passing the offset as an argument of the match() function. In the following example \c{"12 abc"} is not matched because the match is started at offset 1: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 9 + \snippet code/src_corelib_tools_qregularexpression.cpp 9 \target extracting captured substrings \section2 Extracting captured substrings @@ -210,7 +210,7 @@ QT_BEGIN_NAMESPACE \l{QRegularExpressionMatch::}{captured()} function will return the string captured by the n-th capturing group: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 10 + \snippet code/src_corelib_tools_qregularexpression.cpp 10 Capturing groups in the pattern are numbered starting from 1, and the implicit capturing group 0 is used to capture the substring that matched @@ -221,12 +221,12 @@ QT_BEGIN_NAMESPACE \l{QRegularExpressionMatch::}{capturedStart()} and the \l{QRegularExpressionMatch::}{capturedEnd()} functions: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 11 + \snippet code/src_corelib_tools_qregularexpression.cpp 11 All of these functions have an overload taking a QString as a parameter in order to extract \e{named} captured substrings. For instance: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 12 + \snippet code/src_corelib_tools_qregularexpression.cpp 12 \target global matching \section1 Global matching @@ -240,7 +240,7 @@ QT_BEGIN_NAMESPACE which is a Java-like forward iterator that can be used to iterate over the results. For instance: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 13 + \snippet code/src_corelib_tools_qregularexpression.cpp 13 Since it's a Java-like iterator, the QRegularExpressionMatchIterator will point immediately before the first result. Every result is returned as a @@ -250,7 +250,7 @@ QT_BEGIN_NAMESPACE \l{QRegularExpressionMatchIterator::}{next()} will return the next result and advance the iterator. Continuing from the previous example: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 14 + \snippet code/src_corelib_tools_qregularexpression.cpp 14 You can also use \l{QRegularExpressionMatchIterator::}{peekNext()} to get the next result without advancing the iterator. @@ -326,17 +326,17 @@ QT_BEGIN_NAMESPACE This behaviour is implemented by the PartialPreferCompleteMatch match type. For instance: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 15 + \snippet code/src_corelib_tools_qregularexpression.cpp 15 If matching the same regular expression against the subject string leads to a complete match, it is reported as usual: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 16 + \snippet code/src_corelib_tools_qregularexpression.cpp 16 Another example with a different pattern, showing the behaviour of preferring a complete match over a partial one: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 17 + \snippet code/src_corelib_tools_qregularexpression.cpp 17 In this case, the subpattern \c{abc\\w+X} partially matches the subject string; however, the subpattern \c{def} matches the subject string @@ -346,7 +346,7 @@ QT_BEGIN_NAMESPACE match), then the QRegularExpressionMatch object will report the first one that is found. For instance: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 18 + \snippet code/src_corelib_tools_qregularexpression.cpp 18 \section2 Incremental/multi-segment matching @@ -369,13 +369,13 @@ QT_BEGIN_NAMESPACE as soon as it is found, and other match alternatives are not tried (even if they could lead to a complete match). For instance: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 19 + \snippet code/src_corelib_tools_qregularexpression.cpp 19 This happens because when matching the first branch of the alternation operator a partial match is found, and therefore matching stops, without trying the second branch. Another example: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 20 + \snippet code/src_corelib_tools_qregularexpression.cpp 20 This shows what could seem a counterintuitve behaviour of quantifiers: since \c{?} is greedy, then the engine tries first to continue the match @@ -383,7 +383,7 @@ QT_BEGIN_NAMESPACE subject string, and therefore a partial match is reported. This is even more surprising in the following example: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 21 + \snippet code/src_corelib_tools_qregularexpression.cpp 21 It's easy to understand this behaviour if we remember that the engine expects the subject string to be only a substring of the whole text we're @@ -404,13 +404,13 @@ QT_BEGIN_NAMESPACE syntax errors in the pattern string. The isValid() function will return true if the regular expression is valid, or false otherwise: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 22 + \snippet code/src_corelib_tools_qregularexpression.cpp 22 You can get more information about the specific error by calling the errorString() function; moreover, the patternErrorOffset() function will return the offset inside the pattern string - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 23 + \snippet code/src_corelib_tools_qregularexpression.cpp 23 If a match is attempted with an invalid QRegularExpression, then the returned QRegularExpressionMatch object will be invalid as well (that is, @@ -455,19 +455,19 @@ QT_BEGIN_NAMESPACE putting the pattern between the \c{^} and the \c{$} anchors is enough in most cases: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 24 + \snippet code/src_corelib_tools_qregularexpression.cpp 24 However, remember that the \c{$} anchor not only matches at the end of the string, but also at a newline character right before the end of the string; that is, the previous pattern matches against the string "this pattern must - match exactly\n". Also, the behaviour of both the \c{^} and the \c{$} + match exactly\\n". Also, the behaviour of both the \c{^} and the \c{$} anchors changes if the MultiLineOption is set either explicitely (as a pattern option) or implicitly (as a directive inside the pattern string). Therefore, in the most general case, you should wrap the pattern between the \c{\A} and the \c{\z} anchors: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 25 + \snippet code/src_corelib_tools_qregularexpression.cpp 25 Note the usage of the non-capturing group in order to preserve the meaning of the branch operator inside the pattern. @@ -566,7 +566,7 @@ QT_BEGIN_NAMESPACE returns each substring captured, either by the capturing group's index or by its name: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 29 + \snippet code/src_corelib_tools_qregularexpression.cpp 29 For each captured substring it is possible to query its starting and ending offsets in the subject string by calling the capturedStart() and the @@ -616,7 +616,7 @@ QT_BEGIN_NAMESPACE For instance: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 30 + \snippet code/src_corelib_tools_qregularexpression.cpp 30 Moreover, QRegularExpressionMatchIterator offers a peekNext() function to get the next result \e{without} advancing the iterator. @@ -1590,11 +1590,11 @@ bool QRegularExpression::operator==(const QRegularExpression &re) const meaning when used as a regular expression pattern string, and returns the escaped string. For instance: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 26 + \snippet code/src_corelib_tools_qregularexpression.cpp 26 This is very convenient in order to build patterns from arbitrary strings: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 27 + \snippet code/src_corelib_tools_qregularexpression.cpp 27 \note This function implements Perl's quotemeta algorithm and escapes with a backslash all characters in \a str, except for the characters in the @@ -1721,7 +1721,7 @@ QRegularExpression::MatchOptions QRegularExpressionMatch::matchOptions() const including the implicit capturing group 0. This can be used to extract all the substrings that were captured: - \snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 28 + \snippet code/src_corelib_tools_qregularexpression.cpp 28 Note that some of the capturing groups with an index less than lastCapturedIndex() could have not matched, and therefore captured nothing. diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp index 5ecca89229..bf2cac453b 100644 --- a/src/corelib/tools/qscopedpointer.cpp +++ b/src/corelib/tools/qscopedpointer.cpp @@ -61,12 +61,12 @@ QT_BEGIN_NAMESPACE Consider this function which does heap allocations, and have various exit points: - \snippet doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp 0 + \snippet code/src_corelib_tools_qscopedpointer.cpp 0 It's encumbered by the manual delete calls. With QScopedPointer, the code can be simplified to: - \snippet doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp 1 + \snippet code/src_corelib_tools_qscopedpointer.cpp 1 The code the compiler generates for QScopedPointer is the same as when writing it manually. Code that makes use of \a delete are candidates for @@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE The const qualification on a regular C++ pointer can also be expressed with a QScopedPointer: - \snippet doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp 2 + \snippet code/src_corelib_tools_qscopedpointer.cpp 2 \section1 Custom cleanup handlers @@ -99,7 +99,7 @@ QT_BEGIN_NAMESPACE You can pass your own classes as handlers, provided that they have a public static function \c{void cleanup(T *pointer)}. - \snippet doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp 5 + \snippet code/src_corelib_tools_qscopedpointer.cpp 5 \section1 Forward Declared Pointers @@ -111,7 +111,7 @@ QT_BEGIN_NAMESPACE points to a forward declared class must have non-inline constructors, destructors and assignment operators: - \snippet doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp 4 + \snippet code/src_corelib_tools_qscopedpointer.cpp 4 Otherwise, the compiler output a warning about not being able to destruct \c MyPrivateClass. @@ -168,7 +168,7 @@ QT_BEGIN_NAMESPACE Returns \c true if this object is not \c null. This function is suitable for use in \tt if-constructs, like: - \snippet doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp 3 + \snippet code/src_corelib_tools_qscopedpointer.cpp 3 \sa isNull() */ diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc index b03cce884d..51d9caad70 100644 --- a/src/corelib/tools/qset.qdoc +++ b/src/corelib/tools/qset.qdoc @@ -40,19 +40,19 @@ Here's an example QSet with QString values: - \snippet doc/src/snippets/code/doc_src_qset.cpp 0 + \snippet code/doc_src_qset.cpp 0 To insert a value into the set, use insert(): - \snippet doc/src/snippets/code/doc_src_qset.cpp 1 + \snippet code/doc_src_qset.cpp 1 Another way to insert items into the set is to use operator<<(): - \snippet doc/src/snippets/code/doc_src_qset.cpp 2 + \snippet code/doc_src_qset.cpp 2 To test whether an item belongs to the set or not, use contains(): - \snippet doc/src/snippets/code/doc_src_qset.cpp 3 + \snippet code/doc_src_qset.cpp 3 If you want to navigate through all the values stored in a QSet, you can use an iterator. QSet supports both \l{Java-style @@ -60,18 +60,18 @@ iterators} (QSet::iterator and QSet::const_iterator). Here's how to iterate over a QSet<QWidget *> using a Java-style iterator: - \snippet doc/src/snippets/code/doc_src_qset.cpp 4 + \snippet code/doc_src_qset.cpp 4 Here's the same code, but using an STL-style iterator: - \snippet doc/src/snippets/code/doc_src_qset.cpp 5 + \snippet code/doc_src_qset.cpp 5 QSet is unordered, so an iterator's sequence cannot be assumed to be predictable. If ordering by key is required, use a QMap. To navigate through a QSet, you can also use \l{foreach}: - \snippet doc/src/snippets/code/doc_src_qset.cpp 6 + \snippet code/doc_src_qset.cpp 6 Items can be removed from the set using remove(). There is also a clear() function that removes all items. @@ -194,7 +194,7 @@ This function is useful for code that needs to build a huge set and wants to avoid repeated reallocation. For example: - \snippet doc/src/snippets/code/doc_src_qset.cpp 7 + \snippet code/doc_src_qset.cpp 7 Ideally, \a size should be slightly more than the maximum number of elements expected in the set. \a size doesn't have to be prime, @@ -618,18 +618,18 @@ start iterating. Here's a typical loop that prints all the items stored in a set: - \snippet doc/src/snippets/code/doc_src_qset.cpp 8 + \snippet code/doc_src_qset.cpp 8 Here's a loop that removes certain items (all those that start with 'J') from a set while iterating: - \snippet doc/src/snippets/code/doc_src_qset.cpp 9 + \snippet code/doc_src_qset.cpp 9 STL-style iterators can be used as arguments to \l{generic algorithms}. For example, here's how to find an item in the set using the qFind() algorithm: - \snippet doc/src/snippets/code/doc_src_qset.cpp 10 + \snippet code/doc_src_qset.cpp 10 Multiple iterators can be used on the same set. However, you may not attempt to modify the container while iterating on it. @@ -661,13 +661,13 @@ start iterating. Here's a typical loop that prints all the items stored in a set: - \snippet doc/src/snippets/code/doc_src_qset.cpp 11 + \snippet code/doc_src_qset.cpp 11 STL-style iterators can be used as arguments to \l{generic algorithms}. For example, here's how to find an item in the set using the qFind() algorithm: - \snippet doc/src/snippets/code/doc_src_qset.cpp 12 + \snippet code/doc_src_qset.cpp 12 Multiple iterators can be used on the same set. However, you may not attempt to modify the container while iterating on it. @@ -901,7 +901,7 @@ Example: - \snippet doc/src/snippets/code/doc_src_qset.cpp 13 + \snippet code/doc_src_qset.cpp 13 \sa fromList(), QList::fromSet(), qSort() */ @@ -926,7 +926,7 @@ Example: - \snippet doc/src/snippets/code/doc_src_qset.cpp 14 + \snippet code/doc_src_qset.cpp 14 \sa toList(), QList::toSet() */ diff --git a/src/corelib/tools/qshareddata.cpp b/src/corelib/tools/qshareddata.cpp index ffc8ac601d..4c33bebd7b 100644 --- a/src/corelib/tools/qshareddata.cpp +++ b/src/corelib/tools/qshareddata.cpp @@ -99,7 +99,7 @@ QT_BEGIN_NAMESPACE implicitly shared \c Employee class. In the header file we define the two classes \c Employee and \c EmployeeData. - \snippet doc/src/snippets/sharedemployee/employee.h 0 + \snippet sharedemployee/employee.h 0 In class \c Employee, note the single data member, a \e {d pointer} of type \c {QSharedDataPointer<EmployeeData>}. All accesses of @@ -121,14 +121,14 @@ QT_BEGIN_NAMESPACE straightforward. Both create a new instance of \c EmployeeData and assign it to the \e{d pointer} . - \snippet doc/src/snippets/sharedemployee/employee.h 1 + \snippet sharedemployee/employee.h 1 \codeline - \snippet doc/src/snippets/sharedemployee/employee.h 2 + \snippet sharedemployee/employee.h 2 Note that class \c Employee also has a trivial copy constructor defined, which is not strictly required in this case. - \snippet doc/src/snippets/sharedemployee/employee.h 7 + \snippet sharedemployee/employee.h 7 The copy constructor is not strictly required here, because class \c EmployeeData is included in the same file as class \c Employee @@ -162,9 +162,9 @@ QT_BEGIN_NAMESPACE detach() to ensure that the function operates on its own copy of the data. - \snippet doc/src/snippets/sharedemployee/employee.h 3 + \snippet sharedemployee/employee.h 3 \codeline - \snippet doc/src/snippets/sharedemployee/employee.h 4 + \snippet sharedemployee/employee.h 4 Note that if detach() is called more than once in a member function due to multiple dereferences of the \e {d pointer}, detach() will @@ -180,9 +180,9 @@ QT_BEGIN_NAMESPACE In \c Employee's \e const member functions, dereferencing the \e {d pointer} does \e not cause detach() to be called. - \snippet doc/src/snippets/sharedemployee/employee.h 5 + \snippet sharedemployee/employee.h 5 \codeline - \snippet doc/src/snippets/sharedemployee/employee.h 6 + \snippet sharedemployee/employee.h 6 Notice that there is no need to implement a copy constructor or an assignment operator for the \c Employee class, because the copy @@ -199,7 +199,7 @@ QT_BEGIN_NAMESPACE Consider a simple example that creates two instances of the implicitly shared \c Employee class. - \snippet doc/src/snippets/sharedemployee/main.cpp 0 + \snippet sharedemployee/main.cpp 0 After the second employee e2 is created and e1 is assigned to it, both \c e1 and \c e2 refer to Albrecht Durer, employee 1001. Both \c diff --git a/src/corelib/tools/qsize.cpp b/src/corelib/tools/qsize.cpp index b276d2d2e0..b4b99d26ff 100644 --- a/src/corelib/tools/qsize.cpp +++ b/src/corelib/tools/qsize.cpp @@ -194,7 +194,7 @@ void QSize::transpose() \endlist Example: - \snippet doc/src/snippets/code/src_corelib_tools_qsize.cpp 0 + \snippet code/src_corelib_tools_qsize.cpp 0 \sa setWidth(), setHeight(), scaled() */ @@ -252,7 +252,7 @@ QSize QSize::scaled(const QSize &s, Qt::AspectRatioMode mode) const Using a reference makes it possible to manipulate the width directly. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qsize.cpp 1 + \snippet code/src_corelib_tools_qsize.cpp 1 \sa rheight(), setWidth() */ @@ -265,7 +265,7 @@ QSize QSize::scaled(const QSize &s, Qt::AspectRatioMode mode) const Using a reference makes it possible to manipulate the height directly. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qsize.cpp 2 + \snippet code/src_corelib_tools_qsize.cpp 2 \sa rwidth(), setHeight() */ @@ -276,7 +276,7 @@ QSize QSize::scaled(const QSize &s, Qt::AspectRatioMode mode) const Adds the given \a size to \e this size, and returns a reference to this size. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qsize.cpp 3 + \snippet code/src_corelib_tools_qsize.cpp 3 */ /*! @@ -285,7 +285,7 @@ QSize QSize::scaled(const QSize &s, Qt::AspectRatioMode mode) const Subtracts the given \a size from \e this size, and returns a reference to this size. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qsize.cpp 4 + \snippet code/src_corelib_tools_qsize.cpp 4 */ /*! @@ -622,7 +622,7 @@ void QSizeF::transpose() \endlist Example: - \snippet doc/src/snippets/code/src_corelib_tools_qsize.cpp 5 + \snippet code/src_corelib_tools_qsize.cpp 5 \sa setWidth(), setHeight(), scaled() */ @@ -636,11 +636,11 @@ void QSizeF::transpose() */ /*! - \fn QSizeF QSizeF::scaled(int width, int height, Qt::AspectRatioMode mode) const + \fn QSizeF QSizeF::scaled(qreal width, qreal height, Qt::AspectRatioMode mode) const \since 5.0 Returns a size scaled to a rectangle with the given \a width and - \a height, according to the specified \mode. + \a height, according to the specified \a mode. \sa scale() */ @@ -679,7 +679,7 @@ QSizeF QSizeF::scaled(const QSizeF &s, Qt::AspectRatioMode mode) const Using a reference makes it possible to manipulate the width directly. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qsize.cpp 6 + \snippet code/src_corelib_tools_qsize.cpp 6 \sa rheight(), setWidth() */ @@ -692,7 +692,7 @@ QSizeF QSizeF::scaled(const QSizeF &s, Qt::AspectRatioMode mode) const Using a reference makes it possible to manipulate the height directly. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qsize.cpp 7 + \snippet code/src_corelib_tools_qsize.cpp 7 \sa rwidth(), setHeight() */ @@ -703,7 +703,7 @@ QSizeF QSizeF::scaled(const QSizeF &s, Qt::AspectRatioMode mode) const Adds the given \a size to this size and returns a reference to this size. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qsize.cpp 8 + \snippet code/src_corelib_tools_qsize.cpp 8 */ /*! @@ -712,7 +712,7 @@ QSizeF QSizeF::scaled(const QSizeF &s, Qt::AspectRatioMode mode) const Subtracts the given \a size from this size and returns a reference to this size. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qsize.cpp 9 + \snippet code/src_corelib_tools_qsize.cpp 9 */ /*! diff --git a/src/corelib/tools/qstack.cpp b/src/corelib/tools/qstack.cpp index 888fbfa0b4..359705887e 100644 --- a/src/corelib/tools/qstack.cpp +++ b/src/corelib/tools/qstack.cpp @@ -58,7 +58,7 @@ Example: - \snippet doc/src/snippets/qstack/main.cpp 0 + \snippet qstack/main.cpp 0 The example will output 3, 2, 1 in that order. diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index a536a091a1..a9373d79df 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -421,7 +421,7 @@ const QString::Null QString::null = { }; Most of the QChar member functions also exist in QCharRef. However, they are not explicitly documented here. - \sa QString::operator[]() QString::at() QChar + \sa QString::operator[](), QString::at(), QChar */ /*! @@ -467,7 +467,7 @@ const QString::Null QString::null = { }; *} to its constructor. For example, the following code creates a QString of size 5 containing the data "Hello": - \snippet doc/src/snippets/qstring/main.cpp 0 + \snippet qstring/main.cpp 0 QString converts the \c{const char *} data into Unicode using the fromAscii() function. fromAscii() treats ordinals above 128 as Latin-1 @@ -480,7 +480,7 @@ const QString::Null QString::null = { }; You can also provide string data as an array of \l{QChar}s: - \snippet doc/src/snippets/qstring/main.cpp 1 + \snippet qstring/main.cpp 1 QString makes a deep copy of the QChar data, so you can modify it later without experiencing side effects. (If for performance @@ -495,12 +495,12 @@ const QString::Null QString::null = { }; character that can be used on the left side of an assignment. For example: - \snippet doc/src/snippets/qstring/main.cpp 2 + \snippet qstring/main.cpp 2 For read-only access, an alternative syntax is to use the at() function: - \snippet doc/src/snippets/qstring/main.cpp 3 + \snippet qstring/main.cpp 3 The at() function can be faster than \l operator[](), because it never causes a \l{deep copy} to occur. Alternatively, use the @@ -519,7 +519,7 @@ const QString::Null QString::null = { }; usage. For example, if you want to compare a QString with a string literal, you can write code like this and it will work as expected: - \snippet doc/src/snippets/qstring/main.cpp 4 + \snippet qstring/main.cpp 4 You can also pass string literals to functions that take QStrings as arguments, invoking the QString(const char *) @@ -534,7 +534,7 @@ const QString::Null QString::null = { }; character data: append(), prepend(), insert(), replace(), and remove(). For example: - \snippet doc/src/snippets/qstring/main.cpp 5 + \snippet qstring/main.cpp 5 If you are building a QString gradually and know in advance approximately how many characters the QString will contain, you @@ -563,7 +563,7 @@ const QString::Null QString::null = { }; they return -1. For example, here's a typical loop that finds all occurrences of a particular substring: - \snippet doc/src/snippets/qstring/main.cpp 6 + \snippet qstring/main.cpp 6 QString provides many functions for converting numbers into strings and strings into numbers. See the arg() functions, the @@ -642,14 +642,14 @@ const QString::Null QString::null = { }; application is to add the following entry to your \l{qmake Project Files}{qmake project file}: - \snippet doc/src/snippets/code/src_corelib_tools_qstring.cpp 0 + \snippet code/src_corelib_tools_qstring.cpp 0 You then need to explicitly call fromAscii(), fromLatin1(), fromUtf8(), or fromLocal8Bit() to construct a QString from an 8-bit string, or use the lightweight QLatin1String class, for example: - \snippet doc/src/snippets/code/src_corelib_tools_qstring.cpp 1 + \snippet code/src_corelib_tools_qstring.cpp 1 Similarly, you must call toAscii(), toLatin1(), toUtf8(), or toLocal8Bit() explicitly to convert the QString to an 8-bit @@ -666,7 +666,7 @@ const QString::Null QString::null = { }; \l{implicitly shared}, QStrings may be treated like \c{int}s or other basic types. For example: - \snippet doc/src/snippets/qstring/main.cpp 7 + \snippet qstring/main.cpp 7 The \c result variable, is a normal variable allocated on the stack. When \c return is called, and because we're returning by @@ -685,7 +685,7 @@ const QString::Null QString::null = { }; string with size 0. A null string is always empty, but an empty string isn't necessarily null: - \snippet doc/src/snippets/qstring/main.cpp 8 + \snippet qstring/main.cpp 8 All functions except isNull() treat null strings the same as empty strings. For example, toAscii().constData() returns a pointer to a @@ -732,7 +732,7 @@ const QString::Null QString::null = { }; complex string from multiple substrings. You will often write code like this: - \snippet doc/src/snippets/qstring/stringbuilder.cpp 0 + \snippet qstring/stringbuilder.cpp 0 There is nothing wrong with either of these string constructions, but there are a few hidden inefficiencies. Beginning with Qt 4.6, @@ -770,13 +770,13 @@ const QString::Null QString::null = { }; \c{QStringBuilder} wherever you want to use it, and use the \c{'%'} operator instead of \c{'+'} when concatenating strings: - \snippet doc/src/snippets/qstring/stringbuilder.cpp 5 + \snippet qstring/stringbuilder.cpp 5 A more global approach which is the most convenient but not entirely source compatible, is to this define in your .pro file: - \snippet doc/src/snippets/qstring/stringbuilder.cpp 3 + \snippet qstring/stringbuilder.cpp 3 and the \c{'+'} will automatically be performed as the \c{QStringBuilder} \c{'%'} everywhere. @@ -1200,12 +1200,12 @@ void QString::free(Data *d) Example: - \snippet doc/src/snippets/qstring/main.cpp 45 + \snippet qstring/main.cpp 45 If you want to append a certain number of identical characters to the string, use \l operator+=() as follows rather than resize(): - \snippet doc/src/snippets/qstring/main.cpp 46 + \snippet qstring/main.cpp 46 If you want to expand the string so that it reaches a certain width and fill the new positions with a particular character, use @@ -1213,7 +1213,7 @@ void QString::free(Data *d) If \a size is negative, it is equivalent to passing zero. - \snippet doc/src/snippets/qstring/main.cpp 47 + \snippet qstring/main.cpp 47 \sa truncate(), reserve() */ @@ -1278,7 +1278,7 @@ void QString::resize(int size) we're fairly sure that size is large enough to make a call to reserve() worthwhile: - \snippet doc/src/snippets/qstring/main.cpp 44 + \snippet qstring/main.cpp 44 \sa squeeze(), capacity() */ @@ -1422,7 +1422,7 @@ QString &QString::operator=(QChar ch) Example: - \snippet doc/src/snippets/qstring/main.cpp 26 + \snippet qstring/main.cpp 26 If the given \a position is greater than size(), the array is first extended using resize(). @@ -1506,11 +1506,11 @@ QString& QString::insert(int i, QChar ch) Example: - \snippet doc/src/snippets/qstring/main.cpp 9 + \snippet qstring/main.cpp 9 This is the same as using the insert() function: - \snippet doc/src/snippets/qstring/main.cpp 10 + \snippet qstring/main.cpp 10 The append() function is typically very fast (\l{constant time}), because QString preallocates extra space at the end of the string @@ -1602,7 +1602,7 @@ QString &QString::append(QChar ch) Example: - \snippet doc/src/snippets/qstring/main.cpp 36 + \snippet qstring/main.cpp 36 \sa append(), insert() */ @@ -1657,7 +1657,7 @@ QString &QString::append(QChar ch) position + \a n is beyond the end of the string, the string is truncated at the specified \a position. - \snippet doc/src/snippets/qstring/main.cpp 37 + \snippet qstring/main.cpp 37 \sa insert(), replace() */ @@ -1708,7 +1708,7 @@ QString &QString::remove(const QString &str, Qt::CaseSensitivity cs) Example: - \snippet doc/src/snippets/qstring/main.cpp 38 + \snippet qstring/main.cpp 38 This is the same as \c replace(ch, "", cs). @@ -1741,7 +1741,7 @@ QString &QString::remove(QChar ch, Qt::CaseSensitivity cs) Removes every occurrence of the regular expression \a rx in the string, and returns a reference to the string. For example: - \snippet doc/src/snippets/qstring/main.cpp 39 + \snippet qstring/main.cpp 39 \sa indexOf(), lastIndexOf(), replace() */ @@ -1753,7 +1753,7 @@ QString &QString::remove(QChar ch, Qt::CaseSensitivity cs) Removes every occurrence of the regular expression \a re in the string, and returns a reference to the string. For example: - \snippet doc/src/snippets/qstring/main.cpp 96 + \snippet qstring/main.cpp 96 \sa indexOf(), lastIndexOf(), replace() */ @@ -1766,7 +1766,7 @@ QString &QString::remove(QChar ch, Qt::CaseSensitivity cs) Example: - \snippet doc/src/snippets/qstring/main.cpp 40 + \snippet qstring/main.cpp 40 \sa insert(), remove() */ @@ -1817,13 +1817,13 @@ QString &QString::replace(int pos, int len, QChar after) Example: - \snippet doc/src/snippets/qstring/main.cpp 41 + \snippet qstring/main.cpp 41 \note The replacement text is not rescanned after it is inserted. Example: - \snippet doc/src/snippets/qstring/main.cpp 86 + \snippet qstring/main.cpp 86 */ QString &QString::replace(const QString &before, const QString &after, Qt::CaseSensitivity cs) { @@ -2242,7 +2242,7 @@ bool QString::operator<(const QLatin1String &other) const \overload operator<() The \a other byte array is converted to a QString using the - fromAscii() function. If any NUL characters ('\0') are embedded + fromAscii() function. If any NUL characters ('\\0') are embedded in the byte array, they will be included in the transformation. You can disable this operator by defining \c @@ -2264,8 +2264,7 @@ bool QString::operator<(const QLatin1String &other) const go through QObject::tr(), for example. */ -/*! \fn bool operator<=(const QString &s1, const QString &s2) - \relates QString +/*! \fn bool QString::operator<=(const QString &s1, const QString &s2) Returns true if string \a s1 is lexically less than or equal to string \a s2; otherwise returns false. @@ -2286,7 +2285,7 @@ bool QString::operator<(const QLatin1String &other) const \overload operator<=() The \a other byte array is converted to a QString using the - fromAscii() function. If any NUL characters ('\0') are embedded + fromAscii() function. If any NUL characters ('\\0') are embedded in the byte array, they will be included in the transformation. You can disable this operator by defining \c @@ -2308,8 +2307,7 @@ bool QString::operator<(const QLatin1String &other) const go through QObject::tr(), for example. */ -/*! \fn bool operator>(const QString &s1, const QString &s2) - \relates QString +/*! \fn bool QString::operator>(const QString &s1, const QString &s2) Returns true if string \a s1 is lexically greater than string \a s2; otherwise returns false. @@ -2346,7 +2344,7 @@ bool QString::operator>(const QLatin1String &other) const \overload operator>() The \a other byte array is converted to a QString using the - fromAscii() function. If any NUL characters ('\0') are embedded + fromAscii() function. If any NUL characters ('\\0') are embedded in the byte array, they will be included in the transformation. You can disable this operator by defining \c @@ -2390,7 +2388,7 @@ bool QString::operator>(const QLatin1String &other) const \overload operator>=() The \a other byte array is converted to a QString using the - fromAscii() function. If any NUL characters ('\0') are embedded in + fromAscii() function. If any NUL characters ('\\0') are embedded in the byte array, they will be included in the transformation. You can disable this operator by defining \c QT_NO_CAST_FROM_ASCII @@ -2434,7 +2432,7 @@ bool QString::operator>(const QLatin1String &other) const \overload operator!=() The \a other byte array is converted to a QString using the - fromAscii() function. If any NUL characters ('\0') are embedded + fromAscii() function. If any NUL characters ('\\0') are embedded in the byte array, they will be included in the transformation. You can disable this operator by defining \c QT_NO_CAST_FROM_ASCII @@ -2466,7 +2464,7 @@ bool QString::operator>(const QLatin1String &other) const Example: - \snippet doc/src/snippets/qstring/main.cpp 24 + \snippet qstring/main.cpp 24 If \a from is -1, the search starts at the last character; if it is -2, at the next to last character and so on. @@ -2489,7 +2487,7 @@ int QString::indexOf(const QString &str, int from, Qt::CaseSensitivity cs) const Example: - \snippet doc/src/snippets/qstring/main.cpp 24 + \snippet qstring/main.cpp 24 If \a from is -1, the search starts at the last character; if it is -2, at the next to last character and so on. @@ -2664,7 +2662,7 @@ static int lastIndexOfHelper(const ushort *haystack, int from, const ushort *nee Example: - \snippet doc/src/snippets/qstring/main.cpp 29 + \snippet qstring/main.cpp 29 \sa indexOf(), contains(), count() */ @@ -2703,7 +2701,7 @@ int QString::lastIndexOf(const QString &str, int from, Qt::CaseSensitivity cs) c Example: - \snippet doc/src/snippets/qstring/main.cpp 29 + \snippet qstring/main.cpp 29 \sa indexOf(), contains(), count() */ @@ -2793,13 +2791,13 @@ struct QStringCapture string with \a after. Returns a reference to the string. For example: - \snippet doc/src/snippets/qstring/main.cpp 42 + \snippet qstring/main.cpp 42 For regular expressions containing \l{capturing parentheses}, occurrences of \b{\\1}, \b{\\2}, ..., in \a after are replaced with \a{rx}.cap(1), cap(2), ... - \snippet doc/src/snippets/qstring/main.cpp 43 + \snippet qstring/main.cpp 43 \sa indexOf(), lastIndexOf(), remove(), QRegExp::cap() */ @@ -2951,13 +2949,13 @@ QString& QString::replace(const QRegExp &rx, const QString &after) string with \a after. Returns a reference to the string. For example: - \snippet doc/src/snippets/qstring/main.cpp 87 + \snippet qstring/main.cpp 87 For regular expressions containing capturing groups, - occurrences of \bold{\\1}, \bold{\\2}, ..., in \a after are replaced + occurrences of \b{\\1}, \b{\\2}, ..., in \a after are replaced with the string captured by the corresponding capturing group. - \snippet doc/src/snippets/qstring/main.cpp 88 + \snippet qstring/main.cpp 88 \sa indexOf(), lastIndexOf(), remove(), QRegularExpression, QRegularExpressionMatch */ @@ -3125,7 +3123,7 @@ int QString::count(const QStringRef &str, Qt::CaseSensitivity cs) const case sensitive; otherwise the search is case insensitive. Example: - \snippet doc/src/snippets/qstring/main.cpp 17 + \snippet qstring/main.cpp 17 \sa indexOf(), count() */ @@ -3179,7 +3177,7 @@ int QString::count(const QStringRef &str, Qt::CaseSensitivity cs) const Example: - \snippet doc/src/snippets/qstring/main.cpp 25 + \snippet qstring/main.cpp 25 */ int QString::indexOf(const QRegExp& rx, int from) const { @@ -3200,7 +3198,7 @@ int QString::indexOf(const QRegExp& rx, int from) const Example: - \snippet doc/src/snippets/qstring/main.cpp 25 + \snippet qstring/main.cpp 25 */ int QString::indexOf(QRegExp& rx, int from) const { @@ -3216,7 +3214,7 @@ int QString::indexOf(QRegExp& rx, int from) const Example: - \snippet doc/src/snippets/qstring/main.cpp 30 + \snippet qstring/main.cpp 30 */ int QString::lastIndexOf(const QRegExp& rx, int from) const { @@ -3237,7 +3235,7 @@ int QString::lastIndexOf(const QRegExp& rx, int from) const Example: - \snippet doc/src/snippets/qstring/main.cpp 30 + \snippet qstring/main.cpp 30 */ int QString::lastIndexOf(QRegExp& rx, int from) const { @@ -3253,7 +3251,7 @@ int QString::lastIndexOf(QRegExp& rx, int from) const This function counts overlapping matches, so in the example below, there are four instances of "ana" or "ama": - \snippet doc/src/snippets/qstring/main.cpp 18 + \snippet qstring/main.cpp 18 */ int QString::count(const QRegExp& rx) const @@ -3284,7 +3282,7 @@ int QString::count(const QRegExp& rx) const Example: - \snippet doc/src/snippets/qstring/main.cpp 93 + \snippet qstring/main.cpp 93 */ int QString::indexOf(const QRegularExpression& re, int from) const { @@ -3310,7 +3308,7 @@ int QString::indexOf(const QRegularExpression& re, int from) const Example: - \snippet doc/src/snippets/qstring/main.cpp 94 + \snippet qstring/main.cpp 94 */ int QString::lastIndexOf(const QRegularExpression &re, int from) const { @@ -3361,7 +3359,7 @@ bool QString::contains(const QRegularExpression &re) const This function counts overlapping matches, so in the example below, there are four instances of "ana" or "ama": - \snippet doc/src/snippets/qstring/main.cpp 95 + \snippet qstring/main.cpp 95 */ int QString::count(const QRegularExpression &re) const { @@ -3436,13 +3434,13 @@ int QString::count(const QRegularExpression &re) const to skip empty fields and how to deal with leading and trailing separators; see \l{SectionFlags}. - \snippet doc/src/snippets/qstring/main.cpp 52 + \snippet qstring/main.cpp 52 If \a start or \a end is negative, we count fields from the right of the string, the right-most field being -1, the one from right-most field being -2, and so on. - \snippet doc/src/snippets/qstring/main.cpp 53 + \snippet qstring/main.cpp 53 \sa split() */ @@ -3450,8 +3448,8 @@ int QString::count(const QRegularExpression &re) const /*! \overload section() - \snippet doc/src/snippets/qstring/main.cpp 51 - \snippet doc/src/snippets/qstring/main.cpp 54 + \snippet qstring/main.cpp 51 + \snippet qstring/main.cpp 54 \sa split() */ @@ -3560,12 +3558,12 @@ static QString extractSections(const QList<qt_section_chunk> §ions, This string is treated as a sequence of fields separated by the regular expression, \a reg. - \snippet doc/src/snippets/qstring/main.cpp 55 + \snippet qstring/main.cpp 55 \warning Using this QRegExp version is much more expensive than the overloaded string and character versions. - \sa split() simplified() + \sa split(), simplified() */ QString QString::section(const QRegExp ®, int start, int end, SectionFlags flags) const { @@ -3600,12 +3598,12 @@ QString QString::section(const QRegExp ®, int start, int end, SectionFlags fl This string is treated as a sequence of fields separated by the regular expression, \a re. - \snippet doc/src/snippets/qstring/main.cpp 89 + \snippet qstring/main.cpp 89 \warning Using this QRegularExpression version is much more expensive than the overloaded string and character versions. - \sa split() simplified() + \sa split(), simplified() */ QString QString::section(const QRegularExpression &re, int start, int end, SectionFlags flags) const { @@ -3646,7 +3644,7 @@ QString QString::section(const QRegularExpression &re, int start, int end, Secti The entire string is returned if \a n is greater than size() or less than zero. - \snippet doc/src/snippets/qstring/main.cpp 31 + \snippet qstring/main.cpp 31 \sa right(), mid(), startsWith() */ @@ -3664,7 +3662,7 @@ QString QString::left(int n) const The entire string is returned if \a n is greater than size() or less than zero. - \snippet doc/src/snippets/qstring/main.cpp 48 + \snippet qstring/main.cpp 48 \sa left(), mid(), endsWith() */ @@ -3687,7 +3685,7 @@ QString QString::right(int n) const Example: - \snippet doc/src/snippets/qstring/main.cpp 34 + \snippet qstring/main.cpp 34 \sa left(), right() */ @@ -3718,7 +3716,7 @@ QString QString::mid(int position, int n) const If \a cs is Qt::CaseSensitive (default), the search is case sensitive; otherwise the search is case insensitive. - \snippet doc/src/snippets/qstring/main.cpp 65 + \snippet qstring/main.cpp 65 \sa endsWith() */ @@ -3774,7 +3772,7 @@ bool QString::startsWith(const QStringRef &s, Qt::CaseSensitivity cs) const If \a cs is Qt::CaseSensitive (default), the search is case sensitive; otherwise the search is case insensitive. - \snippet doc/src/snippets/qstring/main.cpp 20 + \snippet qstring/main.cpp 20 \sa startsWith() */ @@ -4280,7 +4278,7 @@ QString& QString::setUnicode(const QChar *unicode, int size) Example: - \snippet doc/src/snippets/qstring/main.cpp 57 + \snippet qstring/main.cpp 57 \sa trimmed() */ @@ -4370,7 +4368,7 @@ QString QString::simplified() const Example: - \snippet doc/src/snippets/qstring/main.cpp 82 + \snippet qstring/main.cpp 82 Unlike simplified(), trimmed() leaves internal whitespace alone. @@ -4418,7 +4416,7 @@ QString QString::trimmed() const Example: - \snippet doc/src/snippets/qstring/main.cpp 85 + \snippet qstring/main.cpp 85 The return value is of type QCharRef, a helper class for QString. When you get an object of type QCharRef, you can use it as if it @@ -4457,7 +4455,7 @@ modifiable reference. Equivalent to \c at(position). Example: - \snippet doc/src/snippets/qstring/main.cpp 83 + \snippet qstring/main.cpp 83 If \a position is negative, it is equivalent to passing zero. @@ -4477,7 +4475,7 @@ void QString::truncate(int pos) If \a n is greater than size(), the result is an empty string. Example: - \snippet doc/src/snippets/qstring/main.cpp 15 + \snippet qstring/main.cpp 15 If you want to remove characters from the \e beginning of the string, use remove() instead. @@ -4497,7 +4495,7 @@ void QString::chop(int n) Example: - \snippet doc/src/snippets/qstring/main.cpp 21 + \snippet qstring/main.cpp 21 \sa resize() */ @@ -4536,7 +4534,7 @@ QString& QString::fill(QChar ch, int size) Example: - \snippet doc/src/snippets/qstring/main.cpp 58 + \snippet qstring/main.cpp 58 \sa isEmpty(), resize() */ @@ -4547,7 +4545,7 @@ QString& QString::fill(QChar ch, int size) Example: - \snippet doc/src/snippets/qstring/main.cpp 28 + \snippet qstring/main.cpp 28 Qt makes a distinction between null strings and empty strings for historical reasons. For most applications, what matters is @@ -4564,7 +4562,7 @@ QString& QString::fill(QChar ch, int size) Example: - \snippet doc/src/snippets/qstring/main.cpp 27 + \snippet qstring/main.cpp 27 \sa size() */ @@ -4576,7 +4574,7 @@ QString& QString::fill(QChar ch, int size) Example: - \snippet doc/src/snippets/qstring/main.cpp 84 + \snippet qstring/main.cpp 84 This operation is typically very fast (\l{constant time}), because QString preallocates extra space at the end of the string @@ -4598,7 +4596,7 @@ QString& QString::fill(QChar ch, int size) \overload operator+=() Appends the byte array \a ba to this string. The byte array is converted - to Unicode using the fromAscii() function. If any NUL characters ('\0') + to Unicode using the fromAscii() function. If any NUL characters ('\\0') are embedded in the \a ba byte array, they will be included in the transformation. @@ -4805,7 +4803,7 @@ QString& QString::fill(QChar ch, int size) a human would expect. Consider sorting user-visible strings with localeAwareCompare(). - \snippet doc/src/snippets/qstring/main.cpp 16 + \snippet qstring/main.cpp 16 \sa operator==(), operator<(), operator>() */ @@ -5089,13 +5087,13 @@ const ushort *QString::utf16() const If \a truncate is false and the size() of the string is more than \a width, then the returned string is a copy of the string. - \snippet doc/src/snippets/qstring/main.cpp 32 + \snippet qstring/main.cpp 32 If \a truncate is true and the size() of the string is more than \a width, then any characters in a copy of the string after position \a width are removed, and the copy is returned. - \snippet doc/src/snippets/qstring/main.cpp 33 + \snippet qstring/main.cpp 33 \sa rightJustified() */ @@ -5125,7 +5123,7 @@ QString QString::leftJustified(int width, QChar fill, bool truncate) const Returns a string of size() \a width that contains the \a fill character followed by the string. For example: - \snippet doc/src/snippets/qstring/main.cpp 49 + \snippet qstring/main.cpp 49 If \a truncate is false and the size() of the string is more than \a width, then the returned string is a copy of the string. @@ -5134,7 +5132,7 @@ QString QString::leftJustified(int width, QChar fill, bool truncate) const \a width, then the resulting string is truncated at position \a width. - \snippet doc/src/snippets/qstring/main.cpp 50 + \snippet qstring/main.cpp 50 \sa leftJustified() */ @@ -5163,7 +5161,7 @@ QString QString::rightJustified(int width, QChar fill, bool truncate) const /*! Returns a lowercase copy of the string. - \snippet doc/src/snippets/qstring/main.cpp 75 + \snippet qstring/main.cpp 75 The case conversion will always happen in the 'C' locale. For locale dependent case folding use QLocale::toLower() @@ -5286,7 +5284,7 @@ QString QString::toCaseFolded() const /*! Returns an uppercase copy of the string. - \snippet doc/src/snippets/qstring/main.cpp 81 + \snippet qstring/main.cpp 81 The case conversion will always happen in the 'C' locale. For locale dependent case folding use QLocale::toUpper() @@ -5369,14 +5367,14 @@ QString QString::toUpper() const \c{long long}). If you need those, use the standard snprintf() function instead: - \snippet doc/src/snippets/qstring/main.cpp 63 + \snippet qstring/main.cpp 63 \warning We do not recommend using QString::sprintf() in new Qt code. Instead, consider using QTextStream or arg(), both of which support Unicode strings seamlessly and are type-safe. Here's an example that uses QTextStream: - \snippet doc/src/snippets/qstring/main.cpp 64 + \snippet qstring/main.cpp 64 For \l {QObject::tr()}{translations}, especially if the strings contains more than one escape sequence, you should consider using @@ -5749,7 +5747,7 @@ QString &QString::vsprintf(const char* cformat, va_list ap) Example: - \snippet doc/src/snippets/qstring/main.cpp 74 + \snippet qstring/main.cpp 74 \sa number(), toULongLong(), toInt(), QLocale::toLongLong() */ @@ -5784,7 +5782,7 @@ qint64 QString::toLongLong(bool *ok, int base) const Example: - \snippet doc/src/snippets/qstring/main.cpp 79 + \snippet qstring/main.cpp 79 \sa number(), toLongLong(), QLocale::toULongLong() */ @@ -5821,7 +5819,7 @@ quint64 QString::toULongLong(bool *ok, int base) const Example: - \snippet doc/src/snippets/qstring/main.cpp 73 + \snippet qstring/main.cpp 73 \sa number(), toULong(), toInt(), QLocale::toLong() */ @@ -5856,7 +5854,7 @@ long QString::toLong(bool *ok, int base) const Example: - \snippet doc/src/snippets/qstring/main.cpp 78 + \snippet qstring/main.cpp 78 \sa number(), QLocale::toULong() */ @@ -5890,7 +5888,7 @@ ulong QString::toULong(bool *ok, int base) const Example: - \snippet doc/src/snippets/qstring/main.cpp 72 + \snippet qstring/main.cpp 72 \sa number(), toUInt(), toDouble(), QLocale::toInt() */ @@ -5923,7 +5921,7 @@ int QString::toInt(bool *ok, int base) const Example: - \snippet doc/src/snippets/qstring/main.cpp 77 + \snippet qstring/main.cpp 77 \sa number(), toInt(), QLocale::toUInt() */ @@ -5956,7 +5954,7 @@ uint QString::toUInt(bool *ok, int base) const Example: - \snippet doc/src/snippets/qstring/main.cpp 76 + \snippet qstring/main.cpp 76 \sa number(), toUShort(), toInt(), QLocale::toShort() */ @@ -5989,7 +5987,7 @@ short QString::toShort(bool *ok, int base) const Example: - \snippet doc/src/snippets/qstring/main.cpp 80 + \snippet qstring/main.cpp 80 \sa number(), toShort(), QLocale::toUShort() */ @@ -6014,25 +6012,25 @@ ushort QString::toUShort(bool *ok, int base) const If a conversion error occurs, \c{*}\a{ok} is set to false; otherwise \c{*}\a{ok} is set to true. - \snippet doc/src/snippets/qstring/main.cpp 66 + \snippet qstring/main.cpp 66 Various string formats for floating point numbers can be converted to double values: - \snippet doc/src/snippets/qstring/main.cpp 67 + \snippet qstring/main.cpp 67 The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toDouble() - \snippet doc/src/snippets/qstring/main.cpp 68 + \snippet qstring/main.cpp 68 For historic reasons, this function does not handle thousands group separators. If you need to convert such numbers, use QLocale::toDouble(). - \snippet doc/src/snippets/qstring/main.cpp 69 + \snippet qstring/main.cpp 69 - \sa number() QLocale::setDefault() QLocale::toDouble() trimmed() + \sa number(), QLocale::setDefault(), QLocale::toDouble(), trimmed() */ double QString::toDouble(bool *ok) const @@ -6052,7 +6050,7 @@ double QString::toDouble(bool *ok) const Example: - \snippet doc/src/snippets/qstring/main.cpp 71 + \snippet qstring/main.cpp 71 \sa number(), toDouble(), toInt(), QLocale::toFloat() */ @@ -6081,7 +6079,7 @@ float QString::toFloat(bool *ok) const The base is 10 by default and must be between 2 and 36. For bases other than 10, \a n is treated as an unsigned integer. - \snippet doc/src/snippets/qstring/main.cpp 56 + \snippet qstring/main.cpp 56 The formatting always uses QLocale::C, i.e., English/UnitedStates. To get a localized string representation of a number, use @@ -6220,7 +6218,7 @@ QString &QString::setNum(double n, char f, int prec) To get a localized string representation of a number, use QLocale::toString() with the appropriate locale. - \snippet doc/src/snippets/qstring/main.cpp 35 + \snippet qstring/main.cpp 35 \sa setNum() */ @@ -6318,7 +6316,7 @@ QString QString::number(double n, char f, int prec) Example: - \snippet doc/src/snippets/qstring/main.cpp 62 + \snippet qstring/main.cpp 62 \sa QStringList::join(), section() */ @@ -6369,18 +6367,18 @@ QStringList QString::split(QChar sep, SplitBehavior behavior, Qt::CaseSensitivit Here's an example where we extract the words in a sentence using one or more whitespace characters as the separator: - \snippet doc/src/snippets/qstring/main.cpp 59 + \snippet qstring/main.cpp 59 Here's a similar example, but this time we use any sequence of non-word characters as the separator: - \snippet doc/src/snippets/qstring/main.cpp 60 + \snippet qstring/main.cpp 60 Here's a third example where we use a zero-length assertion, \b{\\b} (word boundary), to split the string into an alternating sequence of non-word and word tokens: - \snippet doc/src/snippets/qstring/main.cpp 61 + \snippet qstring/main.cpp 61 \sa QStringList::join(), section() */ @@ -6418,18 +6416,18 @@ QStringList QString::split(const QRegExp &rx, SplitBehavior behavior) const Here's an example where we extract the words in a sentence using one or more whitespace characters as the separator: - \snippet doc/src/snippets/qstring/main.cpp 90 + \snippet qstring/main.cpp 90 Here's a similar example, but this time we use any sequence of non-word characters as the separator: - \snippet doc/src/snippets/qstring/main.cpp 91 + \snippet qstring/main.cpp 91 Here's a third example where we use a zero-length assertion, - \bold{\\b} (word boundary), to split the string into an + \b{\\b} (word boundary), to split the string into an alternating sequence of non-word and word tokens: - \snippet doc/src/snippets/qstring/main.cpp 92 + \snippet qstring/main.cpp 92 \sa QStringList::join(), section() */ @@ -6770,7 +6768,7 @@ static QString replaceArgEscapes(const QString &s, const ArgEscapeData &d, int f This example shows how we might create a \c status string for reporting progress while processing a list of files: - \snippet doc/src/snippets/qstring/main.cpp 11 + \snippet qstring/main.cpp 11 First, \c arg(i) replaces \c %1. Then \c arg(total) replaces \c %2. Finally, \c arg(fileName) replaces \c %3. @@ -6806,7 +6804,7 @@ QString QString::arg(const QString &a, int fieldWidth, QChar fillChar) const strings \a a1 and \a a2 are replaced in one pass. This can make a difference if \a a1 contains e.g. \c{%1}: - \snippet doc/src/snippets/qstring/main.cpp 13 + \snippet qstring/main.cpp 13 */ /*! @@ -6893,8 +6891,8 @@ QString QString::arg(const QString &a, int fieldWidth, QChar fillChar) const locale was specified, the "C" locale is used. The 'L' flag is ignored if \a base is not 10. - \snippet doc/src/snippets/qstring/main.cpp 12 - \snippet doc/src/snippets/qstring/main.cpp 14 + \snippet qstring/main.cpp 12 + \snippet qstring/main.cpp 14 If \a fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the @@ -6930,8 +6928,8 @@ QString QString::arg(const QString &a, int fieldWidth, QChar fillChar) const using QLocale::setDefault(). The 'L' flag is ignored if \a base is not 10. - \snippet doc/src/snippets/qstring/main.cpp 12 - \snippet doc/src/snippets/qstring/main.cpp 14 + \snippet qstring/main.cpp 12 + \snippet qstring/main.cpp 14 If \a fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the @@ -7114,7 +7112,7 @@ QString QString::arg(char a, int fieldWidth, QChar fillChar) const value produces right-aligned text; a negative value produces left-aligned text. - \snippet doc/src/snippets/code/src_corelib_tools_qstring.cpp 2 + \snippet code/src_corelib_tools_qstring.cpp 2 The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of \a a. The conversion @@ -7310,7 +7308,7 @@ bool QString::isRightToLeft() const Example: - \snippet doc/src/snippets/qstring/main.cpp 19 + \snippet qstring/main.cpp 19 Note that the pointer remains valid only as long as the string is not modified by other means. For read-only access, constData() is @@ -7398,8 +7396,8 @@ bool QString::isRightToLeft() const Here's an example of how we can use a QRegExp on raw data in memory without requiring to copy the data into a QString: - \snippet doc/src/snippets/qstring/main.cpp 22 - \snippet doc/src/snippets/qstring/main.cpp 23 + \snippet qstring/main.cpp 22 + \snippet qstring/main.cpp 23 \warning A string created with fromRawData() is \e not '\\0'-terminated, unless the raw data contains a '\\0' character @@ -7475,11 +7473,11 @@ QString &QString::setRawData(const QChar *unicode, int size) the \c{const char *} data. For example, assuming \c str is a QString, - \snippet doc/src/snippets/code/src_corelib_tools_qstring.cpp 3 + \snippet code/src_corelib_tools_qstring.cpp 3 is much faster than - \snippet doc/src/snippets/code/src_corelib_tools_qstring.cpp 4 + \snippet code/src_corelib_tools_qstring.cpp 4 because it doesn't construct four temporary QString objects and make a deep copy of the character data. @@ -7491,7 +7489,7 @@ QString &QString::setRawData(const QChar *unicode, int size) just a very thin wrapper around a \c{const char *}. Using QLatin1String, the example code above becomes - \snippet doc/src/snippets/code/src_corelib_tools_qstring.cpp 5 + \snippet code/src_corelib_tools_qstring.cpp 5 This is a bit longer to type, but it provides exactly the same benefits as the first version of the code, and is faster than @@ -7501,7 +7499,7 @@ QString &QString::setRawData(const QChar *unicode, int size) QLatin1String can be used everywhere a QString is expected. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qstring.cpp 6 + \snippet code/src_corelib_tools_qstring.cpp 6 \sa QString, QLatin1Char, QStringLiteral */ @@ -8369,7 +8367,7 @@ QString &QString::append(const QStringRef &str) If \a n is greater than size() or less than zero, a reference to the entire string is returned. - \snippet doc/src/snippets/qstring/main.cpp leftRef + \snippet qstring/main.cpp leftRef \sa left(), rightRef(), midRef(), startsWith() */ @@ -8389,7 +8387,7 @@ QStringRef QString::leftRef(int n) const If \a n is greater than size() or less than zero, a reference to the entire string is returned. - \snippet doc/src/snippets/qstring/main.cpp rightRef + \snippet qstring/main.cpp rightRef \sa right(), leftRef(), midRef(), endsWith() */ @@ -8416,7 +8414,7 @@ QStringRef QString::rightRef(int n) const Example: - \snippet doc/src/snippets/qstring/main.cpp midRef + \snippet qstring/main.cpp midRef \sa mid(), leftRef(), rightRef() */ @@ -9160,7 +9158,7 @@ QVector<uint> QStringRef::toUcs4() const Example: - \snippet doc/src/snippets/code/src_corelib_tools_qstring.cpp 7 + \snippet code/src_corelib_tools_qstring.cpp 7 */ QString QString::toHtmlEscaped() const { diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp index 6999972172..a044cca3c9 100644 --- a/src/corelib/tools/qstringbuilder.cpp +++ b/src/corelib/tools/qstringbuilder.cpp @@ -95,7 +95,7 @@ QT_BEGIN_NAMESPACE \c QChar, \c QCharRef, \c QLatin1Char, and \c char. */ -/*! \fn QByteArray QStringBuilder::toLatin1() const +/* \fn QByteArray QStringBuilder::toLatin1() const Returns a Latin-1 representation of the string as a QByteArray. The returned byte array is undefined if the string contains non-Latin1 characters. diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp index bfe2c5ec2d..c25d326b9d 100644 --- a/src/corelib/tools/qstringlist.cpp +++ b/src/corelib/tools/qstringlist.cpp @@ -102,7 +102,7 @@ QT_BEGIN_NAMESPACE {QList::operator+=()}{operator+=()} and \l {QStringList::operator<<()}{operator<<()} functions. For example: - \snippet doc/src/snippets/qstringlist/main.cpp 0 + \snippet qstringlist/main.cpp 0 \section1 Iterating over the strings @@ -111,15 +111,15 @@ QT_BEGIN_NAMESPACE Indexing: - \snippet doc/src/snippets/qstringlist/main.cpp 1 + \snippet qstringlist/main.cpp 1 Java-style iterator: - \snippet doc/src/snippets/qstringlist/main.cpp 2 + \snippet qstringlist/main.cpp 2 STL-style iterator: - \snippet doc/src/snippets/qstringlist/main.cpp 3 + \snippet qstringlist/main.cpp 3 The QStringListIterator class is simply a type definition for QListIterator<QString>. QStringList also provide the @@ -133,12 +133,12 @@ QT_BEGIN_NAMESPACE string list into a single string (with an optional separator) using the join() function. For example: - \snippet doc/src/snippets/qstringlist/main.cpp 4 + \snippet qstringlist/main.cpp 4 To break up a string into a string list, use the QString::split() function: - \snippet doc/src/snippets/qstringlist/main.cpp 6 + \snippet qstringlist/main.cpp 6 The argument to split can be a single character, a string, or a QRegExp. @@ -152,7 +152,7 @@ QT_BEGIN_NAMESPACE contain a particular substring (or match a particular regular expression): - \snippet doc/src/snippets/qstringlist/main.cpp 7 + \snippet qstringlist/main.cpp 7 The contains() function tells you whether the list contains a given string, while the indexOf() function returns the index of @@ -163,7 +163,7 @@ QT_BEGIN_NAMESPACE Finally, the replaceInStrings() function calls QString::replace() on each string in the string list in turn. For example: - \snippet doc/src/snippets/qstringlist/main.cpp 8 + \snippet qstringlist/main.cpp 8 \sa QString */ @@ -180,7 +180,7 @@ QT_BEGIN_NAMESPACE Constructs a string list that contains the given string, \a str. Longer lists are easily created like this: - \snippet doc/src/snippets/qstringlist/main.cpp 9 + \snippet qstringlist/main.cpp 9 \sa append() */ @@ -255,13 +255,13 @@ void QtPrivate::QStringList_sort(QStringList *that, Qt::CaseSensitivity cs) comparison is case sensitive; otherwise the comparison is case insensitive. - \snippet doc/src/snippets/qstringlist/main.cpp 5 - \snippet doc/src/snippets/qstringlist/main.cpp 10 + \snippet qstringlist/main.cpp 5 + \snippet qstringlist/main.cpp 10 This is equivalent to - \snippet doc/src/snippets/qstringlist/main.cpp 11 - \snippet doc/src/snippets/qstringlist/main.cpp 12 + \snippet qstringlist/main.cpp 11 + \snippet qstringlist/main.cpp 12 \sa contains() */ @@ -348,8 +348,8 @@ QStringList QtPrivate::QStringList_filter(const QStringList *that, const QRegula For example: - \snippet doc/src/snippets/qstringlist/main.cpp 5 - \snippet doc/src/snippets/qstringlist/main.cpp 13 + \snippet qstringlist/main.cpp 5 + \snippet qstringlist/main.cpp 13 \sa QString::replace() */ @@ -372,8 +372,8 @@ void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QString &b For example: - \snippet doc/src/snippets/qstringlist/main.cpp 5 - \snippet doc/src/snippets/qstringlist/main.cpp 14 + \snippet qstringlist/main.cpp 5 + \snippet qstringlist/main.cpp 14 For regular expressions that contain \l{capturing parentheses}, occurrences of \b{\\1}, \b{\\2}, ..., in \a after are @@ -381,8 +381,8 @@ void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QString &b For example: - \snippet doc/src/snippets/qstringlist/main.cpp 5 - \snippet doc/src/snippets/qstringlist/main.cpp 15 + \snippet qstringlist/main.cpp 5 + \snippet qstringlist/main.cpp 15 */ void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegExp &rx, const QString &after) { diff --git a/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp index f0d8c248b4..0c1ed4de84 100644 --- a/src/corelib/tools/qtimeline.cpp +++ b/src/corelib/tools/qtimeline.cpp @@ -182,7 +182,7 @@ void QTimeLinePrivate::setCurrentTime(int msecs) Example: - \snippet doc/src/snippets/code/src_corelib_tools_qtimeline.cpp 0 + \snippet code/src_corelib_tools_qtimeline.cpp 0 You can also use QTimeLine with the \l{Graphics View}{Graphics View framework} for diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc index e92f91aa47..748126012b 100644 --- a/src/corelib/tools/qvarlengtharray.qdoc +++ b/src/corelib/tools/qvarlengtharray.qdoc @@ -35,12 +35,12 @@ The C++ language doesn't support variable-length arrays on the stack. For example, the following code won't compile: - \snippet doc/src/snippets/code/doc_src_qvarlengtharray.cpp 0 + \snippet code/doc_src_qvarlengtharray.cpp 0 The alternative is to allocate the array on the heap (with \c{new}): - \snippet doc/src/snippets/code/doc_src_qvarlengtharray.cpp 1 + \snippet code/doc_src_qvarlengtharray.cpp 1 However, if myfunc() is called very frequently from the application's inner loop, heap allocation can be a major source @@ -53,7 +53,7 @@ it is much faster than heap allocation. Example: - \snippet doc/src/snippets/code/doc_src_qvarlengtharray.cpp 2 + \snippet code/doc_src_qvarlengtharray.cpp 2 In the example above, QVarLengthArray will preallocate 1024 elements on the stack and use them unless \c{n + 1} is greater @@ -260,7 +260,7 @@ be used to access and modify the items in the array. Example: - \snippet doc/src/snippets/code/doc_src_qvarlengtharray.cpp 3 + \snippet code/doc_src_qvarlengtharray.cpp 3 The pointer remains valid as long as the array isn't reallocated. diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp index 0026338047..20501f98ff 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.cpp @@ -119,20 +119,20 @@ int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT) Here's an example of a QVector that stores integers and a QVector that stores QString values: - \snippet doc/src/snippets/code/src_corelib_tools_qvector.cpp 0 + \snippet code/src_corelib_tools_qvector.cpp 0 QVector stores a vector (or array) of items. Typically, vectors are created with an initial size. For example, the following code constructs a QVector with 200 elements: - \snippet doc/src/snippets/code/src_corelib_tools_qvector.cpp 1 + \snippet code/src_corelib_tools_qvector.cpp 1 The elements are automatically initialized with a \l{default-constructed value}. If you want to initialize the vector with a different value, pass that value as the second argument to the constructor: - \snippet doc/src/snippets/code/src_corelib_tools_qvector.cpp 2 + \snippet code/src_corelib_tools_qvector.cpp 2 You can also call fill() at any time to fill the vector with a value. @@ -142,11 +142,11 @@ int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT) non-const vectors, operator[]() returns a reference to the item that can be used on the left side of an assignment: - \snippet doc/src/snippets/code/src_corelib_tools_qvector.cpp 3 + \snippet code/src_corelib_tools_qvector.cpp 3 For read-only access, an alternative syntax is to use at(): - \snippet doc/src/snippets/code/src_corelib_tools_qvector.cpp 4 + \snippet code/src_corelib_tools_qvector.cpp 4 at() can be faster than operator[](), because it never causes a \l{deep copy} to occur. @@ -164,7 +164,7 @@ int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT) backward. Both return the index of the matching item if they found one; otherwise, they return -1. For example: - \snippet doc/src/snippets/code/src_corelib_tools_qvector.cpp 5 + \snippet code/src_corelib_tools_qvector.cpp 5 If you simply want to check whether a vector contains a particular value, use contains(). If you want to find out how @@ -411,7 +411,7 @@ int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT) can be used to access and modify the items in the vector. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qvector.cpp 6 + \snippet code/src_corelib_tools_qvector.cpp 6 The pointer remains valid as long as the vector isn't reallocated. @@ -482,7 +482,7 @@ int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT) Inserts \a value at the end of the vector. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qvector.cpp 7 + \snippet code/src_corelib_tools_qvector.cpp 7 This is the same as calling resize(size() + 1) and assigning \a value to the new last element in the vector. @@ -499,7 +499,7 @@ int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT) Inserts \a value at the beginning of the vector. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qvector.cpp 8 + \snippet code/src_corelib_tools_qvector.cpp 8 This is the same as vector.insert(0, \a value). @@ -519,7 +519,7 @@ int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT) value is appended to the vector. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qvector.cpp 9 + \snippet code/src_corelib_tools_qvector.cpp 9 For large vectors, this operation can be slow (\l{linear time}), because it requires moving all the items at indexes \a i and @@ -538,7 +538,7 @@ int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT) vector. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qvector.cpp 10 + \snippet code/src_corelib_tools_qvector.cpp 10 */ /*! \fn QVector::iterator QVector::insert(iterator before, const T &value) @@ -592,7 +592,7 @@ int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT) size beforehand. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qvector.cpp 11 + \snippet code/src_corelib_tools_qvector.cpp 11 \sa resize() */ @@ -604,7 +604,7 @@ int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT) Returns -1 if no item matched. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qvector.cpp 12 + \snippet code/src_corelib_tools_qvector.cpp 12 This function requires the value type to have an implementation of \c operator==(). @@ -620,7 +620,7 @@ int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT) last item. Returns -1 if no item matched. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qvector.cpp 13 + \snippet code/src_corelib_tools_qvector.cpp 13 This function requires the value type to have an implementation of \c operator==(). @@ -966,7 +966,7 @@ int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT) Example: - \snippet doc/src/snippets/code/src_corelib_tools_qvector.cpp 14 + \snippet code/src_corelib_tools_qvector.cpp 14 \sa fromList(), QList::fromVector() */ @@ -977,7 +977,7 @@ int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT) Example: - \snippet doc/src/snippets/code/src_corelib_tools_qvector.cpp 15 + \snippet code/src_corelib_tools_qvector.cpp 15 \sa toList(), QList::toVector() */ @@ -989,7 +989,7 @@ int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT) Example: - \snippet doc/src/snippets/code/src_corelib_tools_qvector.cpp 16 + \snippet code/src_corelib_tools_qvector.cpp 16 \sa toStdVector(), QList::fromStdList() */ @@ -999,7 +999,7 @@ int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT) Returns a std::vector object with the data contained in this QVector. Example: - \snippet doc/src/snippets/code/src_corelib_tools_qvector.cpp 17 + \snippet code/src_corelib_tools_qvector.cpp 17 \sa fromStdVector(), QList::toStdList() */ |