I launch the qml app with these arguments (via VSCode launch.json):

            "args": ["-I", "C:\\Code\\cpp\\build_Hello_Debug","-f", "C:\\Code\\cpp\\qml-plugin-minimal\\Main.qml", ],

 * My example project contains a simple Main.qml. with my Hello QML_ELEMENT
     o "C:\Code\cpp\qml-plugin-minimal\Main.qml"
 * Build dir has a World.dll
     o "C:\Code\cpp\build_Hello_Debug\World.dll"
 * Below it contains the plugin in the Hello/World subdir:
     o "C:\Code\cpp\build_Hello_Debug\Hello\World\Worldplugin.dll"

    Hello {
        id:hello
        Component.onCompleted: {
            hello.speak()
        }
    }

Then when calling qml.exe it prints, see the first entry:

Modified PATH: "C:\\Code\\cpp\\build_Hello_Debug;C:\\Program Files\\Common Files\\Oracle\\Java\\javapath;C:\\VulkanSDK\\1.3.231.1\\Bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\ProgramData\\chocolatey\\bin;C:\\Users\\Eli\\Apps\\platform-tools;C:\\Program Files (x86)\\Tailscale IPN;C:\\Program Files\\dotnet\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\CodeMeter\\DevKit\\bin\\;C:\\Program Files (x86)\\CodeMeter\\Runtime\\bin\\;C:\\Program Files\\LLVM\\bin;C:\\Program Files\\doxygen\\bin;C:\\Program Files (x86)\\GitExtensions\\;C:\\Program Files\\nodejs\\;C:\\Program Files\\AMD\\AMDuProf\\bin;C:\\Program Files\\Docker\\Docker\\resources\\bin;C:\\Program Files\\CMake\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Tailscale\\;C:\\Program Files\\RedHat\\Podman\\;C:\\Program Files\\PowerShell\\7\\;C:\\Users\\Eli\\AppData\\Local\\Programs\\Python\\Python311\\Scripts\\;C:\\Users\\Eli\\AppData\\Local\\Programs\\Python\\Python311\\;C:\\Program Files\\platform-tools;C:\\Users\\Eli\\.cargo\\bin;C:\\Users\\Eli\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\Eli\\Apps;C:\\Users\\Eli\\AppData\\Local\\Android\\Sdk\\platform-tools;C:\\gitlab_runner;C:\\ProgramData\\chocolatey\\lib\\deno;C:\\Users\\Eli\\AppData\\Roaming\\npm;C:\\Users\\Eli\\.dotnet\\tools;C:\\Users\\Eli\\AppData\\Local\\Programs\\Microsoft VS Code\\bin"

*When removing my code:*

QQmlApplicationEngine failed to load component
file:///C:/Code/cpp/qml-plugin-minimal/Main.qml:5:1: Cannot load library C:\Code\cpp\build_Hello_Debug\Hello\World\Worldplugin.dll: The specified module could not be found.
qml: Did not load any objects, exiting.


On 26/10/2023 15:14, Ulf Hermann via Development wrote:
I can confirm a simple:

     for (const QString &importPath : parser.values(importOption)){
         QByteArray path = qgetenv("PATH");
         QByteArray newPath = importPath.toLocal8Bit() + ";";
         newPath += path;
         qputenv("PATH", newPath);
         qDebug() << "Modified PATH:" << qgetenv("PATH");
         e.addImportPath(importPath);
     }

I don't quite understand why this works. Can you show the directory layout in the respective import path? Where do the files end up?

In any case, it should be specific to windows, so please add an "#ifdef Q_OS_WIN". The best place to discuss this is actually the code review system. You don't necessarily have to open a feature ticket.

cheers,
Ulf
-- 
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to