summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2009-05-18 09:23:05 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2009-05-18 09:23:05 (GMT)
commit60a17320d39eed9cd82f38d07495161b2b2d5e42 (patch)
tree8b6b36806c35e2e384162bacf884e432ae919dc2 /doc/src/snippets/code/src_gui_image_qpixmapcache.cpp
parent3cc966afd45ac727126ea89bafa7c1aa1295226b (diff)
downloadQt-60a17320d39eed9cd82f38d07495161b2b2d5e42.zip
Qt-60a17320d39eed9cd82f38d07495161b2b2d5e42.tar.gz
Qt-60a17320d39eed9cd82f38d07495161b2b2d5e42.tar.bz2
Add an extension to QPixmapCache to get rid of strings.
This commit add a new API to add/find/remove pixmaps into QPixmapCache. This new extension is based on a key that the cache give you during the insertion. This key is internally a int which makes all operations in the cache much more faster that the string approach. Auto-tests has been extended as well and a benchmark has been added to compare both approach. I also depecrate the find method for the string API to have a method pointer based and not reference based like the Qt policy says. Reviewed-by: bnilsen Reviewed-by: andreas Followed-deeply-by: trond
Diffstat (limited to 'doc/src/snippets/code/src_gui_image_qpixmapcache.cpp')
-rw-r--r--doc/src/snippets/code/src_gui_image_qpixmapcache.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp b/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp
index c4b6353..2a04f64 100644
--- a/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp
+++ b/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp
@@ -13,7 +13,7 @@ painter->drawPixmap(0, 0, p);
//! [1]
QPixmap pm;
-if (!QPixmapCache::find("my_big_image", pm)) {
+if (!QPixmapCache::find("my_big_image", &pm)) {
pm.load("bigimage.png");
QPixmapCache::insert("my_big_image", pm);
}