Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QQuickPixmap Class Reference

#include <qquickpixmap_p.h>

+ Inheritance diagram for QQuickPixmap:
+ Collaboration diagram for QQuickPixmap:

Public Types

enum  Status { Null , Ready , Error , Loading }
 
enum  Option { Asynchronous = 0x00000001 , Cache = 0x00000002 }
 

Public Member Functions

 QQuickPixmap ()
 
 QQuickPixmap (QQmlEngine *, const QUrl &)
 
 QQuickPixmap (QQmlEngine *, const QUrl &, Options options)
 
 QQuickPixmap (QQmlEngine *, const QUrl &, const QRect &region, const QSize &)
 
 QQuickPixmap (const QUrl &, const QImage &image)
 
 ~QQuickPixmap ()
 
bool isNull () const
 
bool isReady () const
 
bool isError () const
 
bool isLoading () const
 
Status status () const
 
QString error () const
 
const QUrlurl () const
 
const QSizeimplicitSize () const
 
const QRectrequestRegion () const
 
const QSizerequestSize () const
 
QQuickImageProviderOptions::AutoTransform autoTransform () const
 
int frameCount () const
 
QImage image () const
 
void setImage (const QImage &)
 
void setPixmap (const QQuickPixmap &other)
 
QColorSpace colorSpace () const
 
QQuickTextureFactorytextureFactory () const
 
QRect rect () const
 
int width () const
 
int height () const
 
void load (QQmlEngine *, const QUrl &)
 
void load (QQmlEngine *, const QUrl &, QQuickPixmap::Options options)
 
void load (QQmlEngine *, const QUrl &, const QRect &requestRegion, const QSize &requestSize)
 
void load (QQmlEngine *, const QUrl &, const QRect &requestRegion, const QSize &requestSize, QQuickPixmap::Options options)
 
void load (QQmlEngine *, const QUrl &, const QRect &requestRegion, const QSize &requestSize, QQuickPixmap::Options options, const QQuickImageProviderOptions &providerOptions, int frame=0, int frameCount=1, qreal devicePixelRatio=1.0)
 
void loadImageFromDevice (QQmlEngine *engine, QIODevice *device, const QUrl &url, const QRect &requestRegion, const QSize &requestSize, const QQuickImageProviderOptions &providerOptions, int frame=0, int frameCount=1)
 
void clear ()
 
void clear (QObject *)
 
bool connectFinished (QObject *, const char *)
 
bool connectFinished (QObject *, int)
 
bool connectDownloadProgress (QObject *, const char *)
 
bool connectDownloadProgress (QObject *, int)
 

Static Public Member Functions

static void purgeCache ()
 
static bool isCached (const QUrl &url, const QRect &requestRegion, const QSize &requestSize, const int frame, const QQuickImageProviderOptions &options)
 

Static Public Attributes

static const QLatin1String itemGrabberScheme = QLatin1String("itemgrabber")
 

Friends

class QQuickPixmapData
 

Detailed Description

A class that encapsulates the action of fetching a pixmap, as well as the pixmap itself (indirectly via QQuickPixmapData::textureFactory) and the responsibility of canceling outstanding requests. Rather than relying on QPixmapCache which doesn't cache all the information Qt Quick needs, QQuickPixmap implements its own cache, that correctly degrades over time. (QQuickPixmapData::release() marks it as being not-currently-used, and QQuickPixmapCache::shrinkCache() sweeps away the least-recently-released instances until the remaining bytes are less than cache_limit.)

Definition at line 103 of file qquickpixmap_p.h.

Member Enumeration Documentation

◆ Option

Enumerator
Asynchronous 
Cache 

Definition at line 109 of file qquickpixmap_p.h.

◆ Status

Enumerator
Null 
Ready 
Error 
Loading 

Definition at line 107 of file qquickpixmap_p.h.

Constructor & Destructor Documentation

◆ QQuickPixmap() [1/5]

QQuickPixmap::QQuickPixmap ( )

Definition at line 1639 of file qquickpixmapcache.cpp.

◆ QQuickPixmap() [2/5]

QQuickPixmap::QQuickPixmap ( QQmlEngine * engine,
const QUrl & url )

Definition at line 1644 of file qquickpixmapcache.cpp.

References engine, load(), and url().

+ Here is the call graph for this function:

◆ QQuickPixmap() [3/5]

QQuickPixmap::QQuickPixmap ( QQmlEngine * engine,
const QUrl & url,
Options options )

Definition at line 1650 of file qquickpixmapcache.cpp.

References engine, load(), and url().

+ Here is the call graph for this function:

◆ QQuickPixmap() [4/5]

QQuickPixmap::QQuickPixmap ( QQmlEngine * engine,
const QUrl & url,
const QRect & region,
const QSize & size )

Definition at line 1656 of file qquickpixmapcache.cpp.

References engine, load(), and url().

+ Here is the call graph for this function:

◆ QQuickPixmap() [5/5]

QQuickPixmap::QQuickPixmap ( const QUrl & url,
const QImage & image )

Definition at line 1662 of file qquickpixmapcache.cpp.

References QQuickPixmapData::addToCache(), QQuickPixmapData, url(), and QQuickImageProviderOptions::UsePluginDefaultTransform.

+ Here is the call graph for this function:

◆ ~QQuickPixmap()

QQuickPixmap::~QQuickPixmap ( )

Definition at line 1669 of file qquickpixmapcache.cpp.

References QQuickPixmapData::release().

Referenced by load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ autoTransform()

◆ clear() [1/2]

void QQuickPixmap::clear ( )

Definition at line 1984 of file qquickpixmapcache.cpp.

References QQuickPixmapData::release().

Referenced by setImage(), and setPixmap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clear() [2/2]

void QQuickPixmap::clear ( QObject * obj)

Definition at line 1992 of file qquickpixmapcache.cpp.

References QObject::disconnect(), QQuickPixmapData::release(), and QQuickPixmapData::reply.

+ Here is the call graph for this function:

◆ colorSpace()

QColorSpace QQuickPixmap::colorSpace ( ) const

Definition at line 2053 of file qquickpixmapcache.cpp.

References QQuickTextureFactory::image(), and QQuickPixmapData::textureFactory.

+ Here is the call graph for this function:

◆ connectDownloadProgress() [1/2]

bool QQuickPixmap::connectDownloadProgress ( QObject * object,
const char * method )

Definition at line 2031 of file qquickpixmapcache.cpp.

References QObject::connect(), method, qWarning, QQuickPixmapData::reply, and SIGNAL.

+ Here is the call graph for this function:

◆ connectDownloadProgress() [2/2]

bool QQuickPixmap::connectDownloadProgress ( QObject * object,
int method )

Definition at line 2042 of file qquickpixmapcache.cpp.

References QMetaObject::connect(), QQuickPixmapReply::downloadProgressMethodIndex, method, qWarning, and QQuickPixmapData::reply.

+ Here is the call graph for this function:

◆ connectFinished() [1/2]

bool QQuickPixmap::connectFinished ( QObject * object,
const char * method )

Definition at line 2011 of file qquickpixmapcache.cpp.

References QObject::connect(), method, qWarning, QQuickPixmapData::reply, and SIGNAL.

+ Here is the call graph for this function:

◆ connectFinished() [2/2]

bool QQuickPixmap::connectFinished ( QObject * object,
int method )

Definition at line 2021 of file qquickpixmapcache.cpp.

References QMetaObject::connect(), QQuickPixmapReply::finishedMethodIndex, method, qWarning, and QQuickPixmapData::reply.

+ Here is the call graph for this function:

◆ error()

QString QQuickPixmap::error ( ) const

Definition at line 1697 of file qquickpixmapcache.cpp.

References QQuickPixmapData::errorString.

◆ frameCount()

int QQuickPixmap::frameCount ( ) const

Definition at line 1753 of file qquickpixmapcache.cpp.

References QQuickPixmapData::frameCount.

Referenced by load(), and loadImageFromDevice().

+ Here is the caller graph for this function:

◆ height()

int QQuickPixmap::height ( ) const

Definition at line 1808 of file qquickpixmapcache.cpp.

References QQuickPixmapData::textureFactory, and QQuickTextureFactory::textureSize().

Referenced by QQuickCanvasPixmap::height(), load(), and QQuickIconImagePrivate::updateFillMode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ image()

QImage QQuickPixmap::image ( ) const

Definition at line 1768 of file qquickpixmapcache.cpp.

References QQuickTextureFactory::image(), and QQuickPixmapData::textureFactory.

Referenced by QQuickCanvasPixmap::image(), QQuickDragAttachedPrivate::startDrag(), and QQuickLabsPlatformIconLoader::toQIcon().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ implicitSize()

const QSize & QQuickPixmap::implicitSize ( ) const

Definition at line 1721 of file qquickpixmapcache.cpp.

References QQuickPixmapData::implicitSize.

◆ isCached()

bool QQuickPixmap::isCached ( const QUrl & url,
const QRect & requestRegion,
const QSize & requestSize,
const int frame,
const QQuickImageProviderOptions & options )
static

Definition at line 2002 of file qquickpixmapcache.cpp.

References QHash< Key, T >::contains(), frame, QQuickPixmapCache::instance(), requestRegion(), requestSize(), and url().

Referenced by QQuickAnimatedImagePrivate::infoForCurrentFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isError()

bool QQuickPixmap::isError ( ) const

Definition at line 1687 of file qquickpixmapcache.cpp.

References Error, and status().

+ Here is the call graph for this function:

◆ isLoading()

bool QQuickPixmap::isLoading ( ) const

Definition at line 1692 of file qquickpixmapcache.cpp.

References Loading, and status().

+ Here is the call graph for this function:

◆ isNull()

bool QQuickPixmap::isNull ( ) const

Definition at line 1677 of file qquickpixmapcache.cpp.

◆ isReady()

bool QQuickPixmap::isReady ( ) const

Definition at line 1682 of file qquickpixmapcache.cpp.

References Ready, and status().

Referenced by QQuickCanvasPixmap::isValid(), and QQuickDragAttachedPrivate::startDrag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load() [1/5]

void QQuickPixmap::load ( QQmlEngine * engine,
const QUrl & url )

Definition at line 1824 of file qquickpixmapcache.cpp.

References Cache, engine, load(), and url().

Referenced by QQuickPixmap(), QQuickPixmap(), QQuickPixmap(), load(), load(), load(), load(), and QQuickDragAttachedPrivate::loadPixmap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load() [2/5]

void QQuickPixmap::load ( QQmlEngine * engine,
const QUrl & url,
const QRect & requestRegion,
const QSize & requestSize )

Definition at line 1834 of file qquickpixmapcache.cpp.

References Cache, engine, load(), requestRegion(), requestSize(), and url().

+ Here is the call graph for this function:

◆ load() [3/5]

void QQuickPixmap::load ( QQmlEngine * engine,
const QUrl & url,
const QRect & requestRegion,
const QSize & requestSize,
QQuickPixmap::Options options )

Definition at line 1839 of file qquickpixmapcache.cpp.

References engine, load(), requestRegion(), requestSize(), and url().

+ Here is the call graph for this function:

◆ load() [4/5]

◆ load() [5/5]

void QQuickPixmap::load ( QQmlEngine * engine,
const QUrl & url,
QQuickPixmap::Options options )

Definition at line 1829 of file qquickpixmapcache.cpp.

References engine, load(), and url().

+ Here is the call graph for this function:

◆ loadImageFromDevice()

void QQuickPixmap::loadImageFromDevice ( QQmlEngine * engine,
QIODevice * device,
const QUrl & url,
const QRect & requestRegion,
const QSize & requestSize,
const QQuickImageProviderOptions & providerOptions,
int frame = 0,
int frameCount = 1 )

Attempts to load an image from the given url via the given device. This is for special cases when the QImageIOHandler can benefit from reusing the I/O device, or from something extra that a subclass of QIODevice carries with it. So far, this code doesn't support loading anything other than a QImage, for example compressed textures. It can be added if needed.

Definition at line 1944 of file qquickpixmapcache.cpp.

References QQuickPixmapData::addref(), QQuickPixmapData::addToCache(), QObject::connect(), QObject::destroyed(), device, QHash< Key, T >::end(), engine, QHash< Key, T >::find(), frame, frameCount(), QQuickPixmapCache::instance(), QQuickPixmapReader::instance(), iter, qCDebug, QQuickPixmapData, Qt::QueuedConnection, QQuickPixmapReader::readerMutex, QQuickPixmapData::refCount, QQuickPixmapData::reply, requestRegion(), requestSize(), QQuickPixmapData::specialDevice, QMutexLocker< Mutex >::unlock(), url(), and QQuickImageProviderOptions::UsePluginDefaultTransform.

+ Here is the call graph for this function:

◆ purgeCache()

void QQuickPixmap::purgeCache ( )
static

Definition at line 1373 of file qquickpixmapcache.cpp.

References QQuickPixmapCache::instance().

Referenced by QQuickWindow::~QQuickWindow(), QQmlPreviewHandler::loadUrl(), and QQuickWindow::releaseResources().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rect()

QRect QQuickPixmap::rect ( ) const

Definition at line 1816 of file qquickpixmapcache.cpp.

References QQuickPixmapData::textureFactory, and QQuickTextureFactory::textureSize().

+ Here is the call graph for this function:

◆ requestRegion()

const QRect & QQuickPixmap::requestRegion ( ) const

Definition at line 1737 of file qquickpixmapcache.cpp.

References QQuickPixmapData::requestRegion.

Referenced by isCached(), load(), load(), load(), and loadImageFromDevice().

+ Here is the caller graph for this function:

◆ requestSize()

const QSize & QQuickPixmap::requestSize ( ) const

Definition at line 1729 of file qquickpixmapcache.cpp.

References QQuickPixmapData::requestSize.

Referenced by isCached(), load(), load(), load(), and loadImageFromDevice().

+ Here is the caller graph for this function:

◆ setImage()

void QQuickPixmap::setImage ( const QImage & p)

Definition at line 1775 of file qquickpixmapcache.cpp.

References clear(), QQuickPixmapData, QQuickPixmapData::release(), and QQuickTextureFactory::textureFactoryForImage().

Referenced by QQuickItemGenerator::generateImageNode(), QQuickAnimatedImagePrivate::infoForCurrentFrame(), and QQuickImagePrivate::setImage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPixmap()

void QQuickPixmap::setPixmap ( const QQuickPixmap & other)

Definition at line 1786 of file qquickpixmapcache.cpp.

References QQuickPixmapData::addref(), clear(), other(), and QQuickPixmapData::release().

Referenced by QQuickImagePrivate::setPixmap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ status()

QQuickPixmap::Status QQuickPixmap::status ( ) const

Definition at line 1705 of file qquickpixmapcache.cpp.

References Null, and QQuickPixmapData::pixmapStatus.

Referenced by isError(), isLoading(), and isReady().

+ Here is the caller graph for this function:

◆ textureFactory()

QQuickTextureFactory * QQuickPixmap::textureFactory ( ) const

Definition at line 1760 of file qquickpixmapcache.cpp.

References QQuickPixmapData::textureFactory.

◆ url()

const QUrl & QQuickPixmap::url ( ) const

Definition at line 1713 of file qquickpixmapcache.cpp.

References QUrl::url(), and QQuickPixmapData::url.

Referenced by QQuickPixmap(), QQuickPixmap(), QQuickPixmap(), QQuickPixmap(), isCached(), load(), load(), load(), load(), load(), and loadImageFromDevice().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ width()

int QQuickPixmap::width ( ) const

Definition at line 1800 of file qquickpixmapcache.cpp.

References QQuickPixmapData::textureFactory, and QQuickTextureFactory::textureSize().

Referenced by load(), QQuickIconImagePrivate::updateFillMode(), and QQuickCanvasPixmap::width().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ QQuickPixmapData

friend class QQuickPixmapData
friend

Definition at line 175 of file qquickpixmap_p.h.

Referenced by QQuickPixmap(), load(), loadImageFromDevice(), and setImage().

Member Data Documentation

◆ itemGrabberScheme

const QLatin1String QQuickPixmap::itemGrabberScheme = QLatin1String("itemgrabber")
static

Definition at line 170 of file qquickpixmap_p.h.

Referenced by QQuickItemGrabResultPrivate::ensureImageInCache(), and load().


The documentation for this class was generated from the following files: