summaryrefslogtreecommitdiffstats
path: root/doc/src/examples/contiguouscache.qdoc
diff options
context:
space:
mode:
authorIan Walters <ian.walters@nokia.com>2009-05-11 00:26:10 (GMT)
committerIan Walters <ian.walters@nokia.com>2009-05-11 00:26:10 (GMT)
commit142c059031f42f1f4cb64873c634e655f3b7a46d (patch)
tree7a6db59f4bf69e030895496d46e0dab903530c83 /doc/src/examples/contiguouscache.qdoc
parent21f15b50777ab3507f79061e749c5cee9acecb3b (diff)
downloadQt-142c059031f42f1f4cb64873c634e655f3b7a46d.zip
Qt-142c059031f42f1f4cb64873c634e655f3b7a46d.tar.gz
Qt-142c059031f42f1f4cb64873c634e655f3b7a46d.tar.bz2
Documentation patch from Jason
A bunch of minor doc fixes.
Diffstat (limited to 'doc/src/examples/contiguouscache.qdoc')
-rw-r--r--doc/src/examples/contiguouscache.qdoc34
1 files changed, 16 insertions, 18 deletions
diff --git a/doc/src/examples/contiguouscache.qdoc b/doc/src/examples/contiguouscache.qdoc
index 6c67d77..71e7740 100644
--- a/doc/src/examples/contiguouscache.qdoc
+++ b/doc/src/examples/contiguouscache.qdoc
@@ -44,11 +44,11 @@
\title Contiguous Cache Example
The Contiguous Cache example shows how to use QContiguousCache to manage memory usage for
- very large models. In some environments memory is limited, and even when it
- isn't users still dislike an application using
- excessive memory. Using QContiguousCache to manage a list rather than loading
- the entire list into memory allows the application to limit the amount
- of memory it uses regardless of the size of the data set it accesses
+ very large models. In some environments memory is limited and, even when it
+ isn't, users still dislike an application using excessive memory.
+ Using QContiguousCache to manage a list, rather than loading
+ the entire list into memory, allows the application to limit the amount
+ of memory it uses, regardless of the size of the data set it accesses
The simplest way to use QContiguousCache is to cache as items are requested. When
a view requests an item at row N it is also likely to ask for items at rows near
@@ -56,7 +56,7 @@
\snippet examples/tools/contiguouscache/randomlistmodel.cpp 0
- After getting the row the class determines if the row is in the bounds
+ After getting the row, the class determines if the row is in the bounds
of the contiguous cache's current range. It would have been equally valid to
simply have the following code instead.
@@ -68,13 +68,12 @@
\endcode
However a list will often jump rows if the scroll bar is used directly, resulting in
- the code above to cause every row between where the cache was last centered
- to the requested row to be fetched before the requested row is fetched.
+ the code above causing every row between the old and new rows to be fetched.
Using QContiguousCache::lastIndex() and QContiguousCache::firstIndex() allows
- the example to determine where in the list the cache is currently over. These values
- don't represent the indexes into the cache own memory, but rather a virtual
- infinite array that the cache represents.
+ the example to determine what part of the list the cache is currently caching.
+ These values don't represent the indexes into the cache's own memory, but rather
+ a virtual infinite array that the cache represents.
By using QContiguousCache::append() and QContiguousCache::prepend() the code ensures
that items that may be still on the screen are not lost when the requested row
@@ -84,16 +83,15 @@
rows with significant gaps between them consider using QCache instead.
And thats it. A perfectly reasonable cache, using minimal memory for a very large
- list. In this case the accessor for getting the words into cache:
-
- \snippet examples/tools/contiguouscache/randomlistmodel.cpp 1
-
- Generates random information rather than fixed information. This allows you
+ list. In this case the accessor for getting the words into the cache
+ generates random information rather than fixed information. This allows you
to see how the cache range is kept for a local number of rows when running the
example.
+ \snippet examples/tools/contiguouscache/randomlistmodel.cpp 1
+
It is also worth considering pre-fetching items into the cache outside of the
- applications paint routine. This can be done either with a separate thread
- or using a QTimer to incrementally expand the range of the thread prior to
+ application's paint routine. This can be done either with a separate thread
+ or using a QTimer to incrementally expand the range of the cache prior to
rows being requested out of the current cache range.
*/