summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qbitarray.cpp7
-rw-r--r--src/corelib/tools/qbitarray.cpp13
2 files changed, 17 insertions, 3 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qbitarray.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qbitarray.cpp
index 4b2916a619..7fe4ea191d 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qbitarray.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qbitarray.cpp
@@ -174,3 +174,10 @@ a[0] = 1; a[1] = 0; a[2] = 1; // a: [ 1, 0, 1 ]
b[0] = 1; b[1] = 1; // b: [ 1, 1 ]
c = a ^ b; // c: [ 0, 1, 1 ]
//! [14]
+
+//! [15]
+QBitArray ba(4);
+ba.fill(true, 1, 2); // ba: [ 0, 1, 0, 0 ]
+ba.fill(true, 1, 3); // ba: [ 0, 1, 1, 0 ]
+ba.fill(true, 1, 4); // ba: [ 0, 1, 1, 1 ]
+//! [15]
diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp
index a6f22abce8..9f7b2db526 100644
--- a/src/corelib/tools/qbitarray.cpp
+++ b/src/corelib/tools/qbitarray.cpp
@@ -290,11 +290,18 @@ void QBitArray::resize(int size)
/*!
\overload
- Sets bits at index positions \a begin up to and excluding \a end
+ Sets bits at index positions \a begin up to (but not including) \a end
to \a value.
- \a begin and \a end must be a valid index position in the bit
- array (i.e., 0 <= \a begin <= size() and 0 <= \a end <= size()).
+ \a begin must be a valid index position in the bit array
+ (0 <= \a begin < size()).
+
+ \a end must be either a valid index position or equal to size(), in
+ which case the fill operation runs until the end of the array
+ (0 <= \a end <= size()).
+
+ Example:
+ \snippet code/src_corelib_tools_qbitarray.cpp 15
*/
void QBitArray::fill(bool value, int begin, int end)