summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/qml/qdeclarativeworkerscript.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp
index 8182998..dc5bc6e 100644
--- a/src/declarative/qml/qdeclarativeworkerscript.cpp
+++ b/src/declarative/qml/qdeclarativeworkerscript.cpp
@@ -189,7 +189,7 @@ QScriptValue QDeclarativeWorkerScriptEnginePrivate::onMessage(QScriptContext *ct
if (!script)
return engine->undefinedValue();
- if (ctxt->argumentCount() >= 1)
+ if (ctxt->argumentCount() >= 1)
script->callback = ctxt->argument(0);
return script->callback;
@@ -275,12 +275,20 @@ void QDeclarativeWorkerScriptEnginePrivate::processMessage(int id, const QVarian
}
}
+static QString toLocalFileOrQrc(const QUrl& url)
+{
+ QString r = url.toLocalFile();
+ if (r.isEmpty() && url.scheme() == QLatin1String("qrc"))
+ r = QLatin1Char(':') + url.path();
+ return r;
+}
+
void QDeclarativeWorkerScriptEnginePrivate::processLoad(int id, const QUrl &url)
{
- if (url.isRelative() || url.scheme() != QLatin1String("file"))
+ if (url.isRelative())
return;
- QString fileName = url.toLocalFile();
+ QString fileName = toLocalFileOrQrc(url);
QFile f(fileName);
if (f.open(QIODevice::ReadOnly)) {