diff options
Diffstat (limited to 'doc/src/snippets/code/src_gui_image_qpixmapcache.cpp')
-rw-r--r-- | doc/src/snippets/code/src_gui_image_qpixmapcache.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp b/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp new file mode 100644 index 0000000..c4b6353 --- /dev/null +++ b/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp @@ -0,0 +1,21 @@ +//! [0] +QPixmap* pp; +QPixmap p; +if ((pp=QPixmapCache::find("my_big_image", pm))) { + p = *pp; +} else { + p.load("bigimage.png"); + QPixmapCache::insert("my_big_image", new QPixmap(p)); +} +painter->drawPixmap(0, 0, p); +//! [0] + + +//! [1] +QPixmap pm; +if (!QPixmapCache::find("my_big_image", pm)) { + pm.load("bigimage.png"); + QPixmapCache::insert("my_big_image", pm); +} +painter->drawPixmap(0, 0, pm); +//! [1] |