<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Fail to Qt.createComponent in qml]]></title><description><![CDATA[<p dir="auto">Hello guys,</p>
<p dir="auto">I try to load a qml file dynamically, but failed. The component status keeps "Component.Loading". And the output an error string:<br />
qt.tlsbackend.ossl: Failed to load libssl/libcrypto<br />
qml: Error loading component: e:/QT/abc/my.qml:-1 Network error</p>
<p dir="auto">For the first error, "Failed to load libssl/libcrypto", I put the QT's bin dir to environment "path", this error disappear. But the second one, "-1 Network error" keeps the same.</p>
<p dir="auto">I can successfully create a component if the qml file is a "qrc:/xxx.qml", also can create from C++ code. Qt version is 6.4.2.<br />
Please give some suggestion. Thanks.<br />
Code is like this:</p>
<pre><code>onClicked: {
    var url = Qt.resolvedUrl("E:/QT/abc/my.qml");
    console.log("url = ", url)
    var comp = Qt.createComponent(url);
    console.log("comp = " + comp)
    console.log("comp.status = " + comp.status)
    if (comp.status == Component.Error) {
        console.log("Error loading component:", comp.errorString());
    }

    if (rb.comp.status === Component.Ready) {
        var params = { }
        var item = rb.comp.createObject(rootItem, params);
    }
}
</code></pre>
]]></description><link>https://forum.qt.io/topic/144425/fail-to-qt-createcomponent-in-qml</link><generator>RSS for Node</generator><lastBuildDate>Wed, 05 Aug 2026 00:13:09 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/144425.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 17 Apr 2023 07:04:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fail to Qt.createComponent in qml on Mon, 17 Apr 2023 11:11:31 GMT]]></title><description><![CDATA[<p dir="auto">See if you can make it as Qt.resolvedUrl("file:///E:/QT/abc/my.qml")<br />
Added "file:///" for qml file</p>
]]></description><link>https://forum.qt.io/post/755005</link><guid isPermaLink="true">https://forum.qt.io/post/755005</guid><dc:creator><![CDATA[dheerendra]]></dc:creator><pubDate>Mon, 17 Apr 2023 11:11:31 GMT</pubDate></item><item><title><![CDATA[Reply to Fail to Qt.createComponent in qml on Thu, 20 Apr 2023 02:16:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dheerendra">@<bdi>dheerendra</bdi></a> Thanks. It works. So, any time when you access local file from qml, must add this prefix to url ?</p>
]]></description><link>https://forum.qt.io/post/755480</link><guid isPermaLink="true">https://forum.qt.io/post/755480</guid><dc:creator><![CDATA[Hit Tiger Tonight]]></dc:creator><pubDate>Thu, 20 Apr 2023 02:16:40 GMT</pubDate></item><item><title><![CDATA[Reply to Fail to Qt.createComponent in qml on Mon, 17 Apr 2023 11:11:31 GMT]]></title><description><![CDATA[<p dir="auto">See if you can make it as Qt.resolvedUrl("file:///E:/QT/abc/my.qml")<br />
Added "file:///" for qml file</p>
]]></description><link>https://forum.qt.io/post/755005</link><guid isPermaLink="true">https://forum.qt.io/post/755005</guid><dc:creator><![CDATA[dheerendra]]></dc:creator><pubDate>Mon, 17 Apr 2023 11:11:31 GMT</pubDate></item></channel></rss>