diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-05-20 05:36:25 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-05-20 05:36:25 (GMT) |
commit | 1aeab18c1e78e201a38d76a24e8cfd2733e4f5e7 (patch) | |
tree | 39ad1c03ddd858ddf18463ae61cb1aca2f7cd7fb /tools/qmlviewer | |
parent | 47f2559f10780f81a1fd1387b2eebeb804fe9378 (diff) | |
download | Qt-1aeab18c1e78e201a38d76a24e8cfd2733e4f5e7.zip Qt-1aeab18c1e78e201a38d76a24e8cfd2733e4f5e7.tar.gz Qt-1aeab18c1e78e201a38d76a24e8cfd2733e4f5e7.tar.bz2 |
Basic qualified type support.
Can now:
DialLibrary.Dial { ... }
without any import statement.
Can also run qmlviewer with -L DialLibrary then use Dial { ... }.
The exact way this works will almost definitely change to ensure predictable
behaviour under future type additions to scopes.
Diffstat (limited to 'tools/qmlviewer')
-rw-r--r-- | tools/qmlviewer/main.cpp | 6 | ||||
-rw-r--r-- | tools/qmlviewer/qmlviewer.cpp | 4 | ||||
-rw-r--r-- | tools/qmlviewer/qmlviewer.h | 1 |
3 files changed, 11 insertions, 0 deletions
diff --git a/tools/qmlviewer/main.cpp b/tools/qmlviewer/main.cpp index f59918f..38a00bb 100644 --- a/tools/qmlviewer/main.cpp +++ b/tools/qmlviewer/main.cpp @@ -41,6 +41,7 @@ void usage() qWarning(" -recordtest <directory> .................. record an autotest"); qWarning(" -runtest <directory> ..................... run a previously recorded test"); qWarning(" -translation <translationfile> ........... set the language to run in"); + qWarning(" -L <directory> ........................... prepend to the library search path"); qWarning(" "); qWarning(" Press F1 for interactive help"); exit(1); @@ -81,6 +82,7 @@ int main(int argc, char ** argv) QString dither = "none"; QString recordfile; QStringList recordargs; + QStringList libraries; QString skin; bool devkeys = false; bool cache = false; @@ -132,6 +134,8 @@ int main(int argc, char ** argv) usage(); translationFile = newargv[i + 1]; ++i; + } else if (arg == "-L") { + libraries << QString(argv[++i]); } else if (arg[0] != '-') { fileName = arg; } else if (1 || arg == "-help") { @@ -146,6 +150,8 @@ int main(int argc, char ** argv) } QmlViewer viewer(testMode, testDir, 0, frameless ? Qt::FramelessWindowHint : Qt::Widget); + foreach (QString lib, libraries) + viewer.addLibraryPath(lib); viewer.setCacheEnabled(cache); viewer.setRecordFile(recordfile); if (period>0) diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index 97db22e..4b0a83a 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -314,6 +314,10 @@ void QmlViewer::toggleRecording() setRecording(recording); } +void QmlViewer::addLibraryPath(const QString& lib) +{ + canvas->engine()->addNameSpacePath("",lib); +} void QmlViewer::reload() { diff --git a/tools/qmlviewer/qmlviewer.h b/tools/qmlviewer/qmlviewer.h index 09b2b5b..967af49 100644 --- a/tools/qmlviewer/qmlviewer.h +++ b/tools/qmlviewer/qmlviewer.h @@ -42,6 +42,7 @@ public: void setAutoRecord(int from, int to); void setDeviceKeys(bool); void setCacheEnabled(bool); + void addLibraryPath(const QString& lib); QSize sizeHint() const; |