⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qpixmapcache.3qt

📁 tmark1.11:用于生成QT/EMBEDDED应用工程的Markfile文件
💻 3QT
字号:
.TH QPixmapCache 3qt "6 July 1999" "Troll Tech AS" \" -*- nroff -*-.\" Copyright 1992-1999 Troll Tech AS.  All rights reserved.  See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQPixmapCache \- Application-global cache for pixmaps.SH SYNOPSIS.br.PP\fC#include <qpixmapcache.h>\fR.PP.SS "Static Public Members".TPint \fBcacheLimit\fR () .TPvoid \fBsetCacheLimit\fR ( int ) .TPQPixmap* \fBfind\fR ( const QString & key ) .TPbool \fBfind\fR ( const QString & key, QPixmap & ) .TPbool \fBinsert\fR ( const QString & key, QPixmap * ) .TPvoid \fBinsert\fR ( const QString & key, const QPixmap & ) .TPvoid \fBclear\fR () .SH DESCRIPTIONThe QPixmapCache class provides an application-global cache for pixmaps..PPThis class is a tool for optimized drawing with QPixmaps. Here follows an example. The QRadioButton widget has a non-trivial visual representation. In the drawButton() function, we do not draw the radio button directly. Instead, we first check the global pixmap cache if a pixmap called "$qt_radio_s_" exists. The \fCs\fR is a numerical value that specifies the the radio button state. If a pixmap is found, we bitBlt() it onto the widget and return. Otherwise, we create a new pixmap, draw the radio button in the pixmap and finally insert the pixmap in the global pixmap cache, using the key above. The bitBlt() is 10 times faster than drawing the radio button. All radio buttons in the program share the cached pixmap since QPixmapCache is application-global..PPQPixmapCache contains no member data, only static functions to access the global pixmap cache. It creates an internal QCache for caching the pixmaps..PPThe cache associates a pixmap with a normal string (key). If two pixmaps are inserted into the cache using equal keys, then the last pixmap will hide the first pixmap. The QDict and QCache classes do exactly the same..PPThe cache becomes full when the total size of all pixmaps in the cache exceeds the cache limit. The initial cache limit is 1024 KByte (1 MByte). A pixmap takes roughly width*height*depth/8 bytes of memory..PPSee the QCache documentation for a more details about the cache mechanism..SH MEMBER FUNCTION DOCUMENTATION.SH "int QPixmapCache::cacheLimit () \fC[static]\fR"Returns the cache limit (in kilobytes)..PPThe default setting is 1024 kilobytes..PPSee also: setCacheLimit()..SH "void QPixmapCache::clear () \fC[static]\fR"Removes all pixmaps from the cache..SH "QPixmap * QPixmapCache::find ( const QString & key ) \fC[static]\fR"Returns the pixmap associated with \fIkey\fR in the cache, or null if there is no such pixmap..PP\fB NOTE: if valid, you should copy the pixmap immediately (this is quick since QPixmaps are implicitly shared), because subsequent insertions into the cache could cause the pointer to become invalid. For this reason, we recommend you use find(const QString&, QPixmap&) instead. \fR.PPExample:.PP.nf.br    QPixmap* pp;.br    QPixmap p;.br    if ( (pp=QPixmapCache::find("my_previous_copy", pm)) ) {.br        p = *pp;.br    } else {.br        p.load("bigimage.png");.br        QPixmapCache::insert("my_previous_copy", new QPixmap(p));.br    }.br    painter->drawPixmap(0, 0, p);.fi.SH "bool QPixmapCache::find ( const QString & key, QPixmap & pm ) \fC[static]\fR"Sets \fIpm\fR to the cached pixmap associated with \fIkey\fR in the cache and returns TRUE. If FALSE is returned, no cached copy was found, and \fIpm\fR is unchanged..PPExample:.PP.nf.br    QPixmap p;.br    if ( !QPixmapCache::find("my_previous_copy", pm) ) {.br        pm.load("bigimage.png");.br        QPixmapCache::insert("my_previous_copy", pm);.br    }.br    painter->drawPixmap(0, 0, p);.fi.SH "bool QPixmapCache::insert ( const QString & key, QPixmap * pm ) \fC[static]\fR"Inserts the pixmap \fIpm\fR associated with \fIkey\fR into the cache. Returns TRUE if successful, or FALSE if the pixmap is too big for the cache..PP\fB NOTE: If this function returns FALSE, you must delete \fIpm\fR yourself. Additionally, be very careful about using \fIpm\fR after calling this function, as any other insertions into the cache, from anywhere in the application, or within Qt itself, could cause the pixmap to be discarded from the cache, and the pointer to become invalid..PPDue to these dangers, we strongly recommend that you use insert(const QString&, const QPixmap&) instead. \fR.SH "void QPixmapCache::insert ( const QString & key, const QPixmap & pm ) \fC[static]\fR"Inserts a copy of the pixmap \fIpm\fR associated with \fIkey\fR into the cache. Returns TRUE if successful, or FALSE if the pixmap is too big for the cache..PPAll pixmaps inserted by the Qt library have a key starting with "$qt..". Use something else for your own pixmaps..PPWhen a pixmap is inserted and the cache is about to exceed its limit, it removes pixmaps until there is enough room for the pixmap to be inserted..PPThe oldest pixmaps (least recently accessed in the cache) are deleted when more space is needed..PPSee also: setCacheLimit()..SH "void QPixmapCache::setCacheLimit ( int n ) \fC[static]\fR"Sets the cache limit to \fIn\fR kilobytes..PPThe default setting is 1024 kilobytes..PPSee also:  cacheLimit()..SH "SEE ALSO".BR http://www.troll.no/qt/qpixmapcache.html.SH COPYRIGHTCopyright 1992-1999 Troll Tech AS.  See the license file included inthe distribution for a complete license statement..SH AUTHORGenerated automatically from the source code.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -