summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-10-14 05:18:52 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-10-14 05:18:52 (GMT)
commit8e9a0667ee8856558694d9d661585d36f7f41da8 (patch)
tree7f71e351fbc4cd7d45186076c9450065428c1f38 /src/declarative/fx
parentc84227fbd5e068859f8de15e4c522b076885b9dc (diff)
parent8a8ddeb9e29abb0734bb7cd703de8302c3e1a506 (diff)
downloadQt-8e9a0667ee8856558694d9d661585d36f7f41da8.zip
Qt-8e9a0667ee8856558694d9d661585d36f7f41da8.tar.gz
Qt-8e9a0667ee8856558694d9d661585d36f7f41da8.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/fx')
-rw-r--r--src/declarative/fx/qfxborderimage.cpp14
-rw-r--r--src/declarative/fx/qfxpixmapcache.cpp18
2 files changed, 26 insertions, 6 deletions
diff --git a/src/declarative/fx/qfxborderimage.cpp b/src/declarative/fx/qfxborderimage.cpp
index 8f98a11..f1574e5 100644
--- a/src/declarative/fx/qfxborderimage.cpp
+++ b/src/declarative/fx/qfxborderimage.cpp
@@ -138,6 +138,15 @@ QFxBorderImage::~QFxBorderImage()
The URL may be absolute, or relative to the URL of the component.
*/
+static QString toLocalFileOrQrc(const QUrl& url)
+{
+ QString r = url.toLocalFile();
+ if (r.isEmpty() && url.scheme() == QLatin1String("qrc"))
+ r = QLatin1Char(':') + url.path();
+ return r;
+}
+
+
void QFxBorderImage::setSource(const QUrl &url)
{
Q_D(QFxBorderImage);
@@ -180,8 +189,9 @@ void QFxBorderImage::setSource(const QUrl &url)
d->status = Loading;
if (d->url.path().endsWith(QLatin1String(".sci"))) {
#ifndef QT_NO_LOCALFILE_OPTIMIZED_QML
- if (d->url.scheme() == QLatin1String("file")) {
- QFile file(d->url.toLocalFile());
+ QString lf = toLocalFileOrQrc(d->url);
+ if (!lf.isEmpty()) {
+ QFile file(lf);
file.open(QIODevice::ReadOnly);
setGridScaledImage(QFxGridScaledImage(&file));
} else
diff --git a/src/declarative/fx/qfxpixmapcache.cpp b/src/declarative/fx/qfxpixmapcache.cpp
index 80b5011..13e1b16 100644
--- a/src/declarative/fx/qfxpixmapcache.cpp
+++ b/src/declarative/fx/qfxpixmapcache.cpp
@@ -124,6 +124,14 @@ static bool readImage(QIODevice *dev, QPixmap *pixmap)
This class is NOT reentrant.
*/
+static QString toLocalFileOrQrc(const QUrl& url)
+{
+ QString r = url.toLocalFile();
+ if (r.isEmpty() && url.scheme() == QLatin1String("qrc"))
+ r = QLatin1Char(':') + url.path();
+ return r;
+}
+
/*!
Finds the cached pixmap corresponding to \a url.
A previous call to get() must have requested the URL,
@@ -142,8 +150,9 @@ bool QFxPixmapCache::find(const QUrl& url, QPixmap *pixmap)
bool ok = true;
if (!QPixmapCache::find(key,pixmap)) {
#ifndef QT_NO_LOCALFILE_OPTIMIZED_QML
- if (url.scheme()==QLatin1String("file")) {
- QFile f(url.toLocalFile());
+ QString lf = toLocalFileOrQrc(url);
+ if (!lf.isEmpty()) {
+ QFile f(lf);
if (f.open(QIODevice::ReadOnly)) {
if (!readImage(&f, pixmap)) {
qWarning() << "Format error loading" << url;
@@ -207,10 +216,11 @@ bool QFxPixmapCache::find(const QUrl& url, QPixmap *pixmap)
QNetworkReply *QFxPixmapCache::get(QmlEngine *engine, const QUrl& url, QPixmap *pixmap)
{
#ifndef QT_NO_LOCALFILE_OPTIMIZED_QML
- if (url.scheme()==QLatin1String("file")) {
+ QString lf = toLocalFileOrQrc(url);
+ if (!lf.isEmpty()) {
QString key = url.toString();
if (!QPixmapCache::find(key,pixmap)) {
- QFile f(url.toLocalFile());
+ QFile f(lf);
if (f.open(QIODevice::ReadOnly)) {
if (!readImage(&f, pixmap)) {
qWarning() << "Format error loading" << url;