summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativeimagebase.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimagebase.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
index 416604b..2fc935f 100644
--- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
@@ -126,6 +126,24 @@ QSize QDeclarativeImageBase::sourceSize() const
return d->sourcesize.isValid() ? d->sourcesize : QSize(implicitWidth(),implicitHeight());
}
+bool QDeclarativeImageBase::cached() const
+{
+ Q_D(const QDeclarativeImageBase);
+ return d->cached;
+}
+
+void QDeclarativeImageBase::setCached(bool cached)
+{
+ Q_D(QDeclarativeImageBase);
+ if (d->cached == cached)
+ return;
+
+ d->cached = cached;
+ emit cachedChanged();
+ if (isComponentComplete())
+ load();
+}
+
void QDeclarativeImageBase::load()
{
Q_D(QDeclarativeImageBase);
@@ -150,7 +168,12 @@ void QDeclarativeImageBase::load()
d->status = Loading;
emit statusChanged(d->status);
- d->pix.load(qmlEngine(this), d->url, d->sourcesize, d->async);
+ QDeclarativePixmap::Options options;
+ if (d->async)
+ options |= QDeclarativePixmap::Asynchronous;
+ if (d->cached)
+ options |= QDeclarativePixmap::Cached;
+ d->pix.load(qmlEngine(this), d->url, d->sourcesize, options);
if (d->pix.isLoading()) {