From 936cc8adccecfdd32966bd9c1ff7a9f534a027fe Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 8 Apr 2019 11:42:29 +0200 Subject: Add support for selectors to qmlscene This allows to use qmlscene together with file selectors. Task-number: QDS-589 Change-Id: Icf613c938bfc2c56b33a36ab2da32c3c54b498a2 Reviewed-by: Ulf Hermann --- tools/qmlscene/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tools') diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index 83d6ce5d72..a1a162cda7 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -361,6 +362,7 @@ static void usage() #endif puts(" --textrendertype [qt|native].......Select the default render type for text-like elements."); puts(" -I ........................ Add to the list of import paths"); + puts(" -S .....................Add to the list of QQmlFileSelector selectors"); puts(" -P ........................ Add to the list of plugin paths"); puts(" -translation ... Set the language to run in"); @@ -457,6 +459,7 @@ int main(int argc, char ** argv) Options options; QStringList imports; + QStringList customSelectors; QStringList pluginPaths; // Parse arguments for application attributes to be applied before Q[Gui]Application creation. @@ -529,6 +532,8 @@ int main(int argc, char ** argv) options.verbose = true; else if (lowerArgument == QLatin1String("-i") && i + 1 < size) imports.append(arguments.at(++i)); + else if (lowerArgument == QLatin1String("-s") && i + 1 < size) + customSelectors.append(arguments.at(++i)); else if (lowerArgument == QLatin1String("-p") && i + 1 < size) pluginPaths.append(arguments.at(++i)); else if (lowerArgument == QLatin1String("--apptype")) @@ -584,6 +589,8 @@ int main(int argc, char ** argv) // TODO: as soon as the engine construction completes, the debug service is // listening for connections. But actually we aren't ready to debug anything. QQmlEngine engine; + QQmlFileSelector* selector = new QQmlFileSelector(&engine, &engine); + selector->setExtraSelectors(customSelectors); QPointer component = new QQmlComponent(&engine); for (int i = 0; i < imports.size(); ++i) engine.addImportPath(imports.at(i)); -- cgit v1.2.3