Obsolete Members for QPixmapCache

以下成員源於類 QPixmapCache 已過時。 提供它們是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它們。

靜態公共成員

(obsolete) bool find (const QString & key , QPixmap & pixmap )
(obsolete) QPixmap * find (const QString & key )

成員函數文檔編製

[static] bool QPixmapCache:: find (const QString & key , QPixmap & pixmap )

Use bool find(const QString &, QPixmap *) 代替。

[static] QPixmap *QPixmapCache:: find (const QString & key )

這是重載函數。

Returns the pixmap associated with the key in the cache, or null if there is no such pixmap.

警告: If valid, you should copy the pixmap immediately (this is fast). Subsequent insertions into the cache could cause the pointer to become invalid. For this reason, we recommend you use bool find(const QString &, QPixmap *) 代替。

範例:

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);