diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-01-26 11:46:56 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-01-26 11:46:56 +0100 |
commit | 9225ac7348c9023093b6ef8d4519087c7dddeaa2 (patch) | |
tree | 4660e25bd5cfd4a2a40b0ad97ea689c4acb22a8c /tools/qml/main.cpp | |
parent | 9d8fe2ac121162c15be6728495be2235b728325a (diff) | |
parent | 0076c44d3993f377ad6417d3bb08109b608dfbd2 (diff) |
Merge remote-tracking branch 'origin/dev' into wip/pointerhandler
Change-Id: I7962fd2282792c43af69784c8e98fb050fd928a7
Diffstat (limited to 'tools/qml/main.cpp')
-rw-r--r-- | tools/qml/main.cpp | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 5e8b872821..e8a506264c 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -46,7 +46,6 @@ #include <QDir> #include <QFile> #include <QFileInfo> -#include <QRegularExpression> #include <QStringList> #include <QScopedPointer> #include <QDebug> @@ -568,29 +567,14 @@ int main(int argc, char *argv[]) loadDummyDataFiles(e, dummyDir); for (const QString &path : qAsConst(files)) { - //QUrl::fromUserInput doesn't treat no scheme as relative file paths -#if QT_CONFIG(regularexpression) - QRegularExpression urlRe("[[:word:]]+://.*"); - if (urlRe.match(path).hasMatch()) { //Treat as a URL - QUrl url = QUrl::fromUserInput(path); - if (verboseMode) - printf("qml: loading %s\n", - qPrintable(url.isLocalFile() - ? QDir::toNativeSeparators(url.toLocalFile()) - : url.toString())); + QUrl url = QUrl::fromUserInput(path, QDir::currentPath()); + if (verboseMode) + printf("qml: loading %s\n", qPrintable(url.toString())); + QByteArray strippedFile; + if (getFileSansBangLine(path, strippedFile)) + e.loadData(strippedFile, e.baseUrl().resolved(url)); //QQmlComponent won't resolve it for us, it doesn't know it's a valid file if we loadData + else //Errors or no bang line e.load(url); - } else -#endif - { //Local file path - if (verboseMode) - printf("qml: loading %s\n", qPrintable(QDir::toNativeSeparators(path))); - - QByteArray strippedFile; - if (getFileSansBangLine(path, strippedFile)) - e.loadData(strippedFile, e.baseUrl().resolved(QUrl::fromLocalFile(path))); //QQmlComponent won't resolve it for us, it doesn't know it's a valid file if we loadData - else //Errors or no bang line - e.load(path); - } } if (lw->earlyExit) |