[Qt-qml] How to deploy a QML app with WebView on a machine without a Qt installation?

Girish Ramakrishnan girish at forwardbias.in
Thu Jun 30 08:57:59 CEST 2011


Hi Johan,

On Thu, Jun 30, 2011 at 11:34 AM, Johan Paul <johan.paul at gmail.com> wrote:
> Hi Girish!
>
>> That doesn't sound right. AFAIK, QML shouldn't be loading dll's
>> without a qmldir file. Maybe it's picking up another Qt from your
>> path? If you set the environment variable QML_IMPORT_TRACE=1, it
>> should give you lots of debug from the importing code. Can you see
>> what's happening there or maybe paste the output from both machines.
>
> Thanks - this helped a lot!
>
> And you are right, it is picking up the qmldir from the Qt installation dir.
>
> [2180] QDeclarativeImports(file:///D:/temp/demo/qml/webbrowser/webbrowser.qml::importExtension:
> loaded "C:/src/qt/qt/imports/QtWebKit/qmldir"
>
> Later it picks up the correct .dll:
> [2180] QDeclarativeImportDatabase::importPlugin: "QtWebKit" from
> "D:/temp/demo/qmlimports/qmlwebkitplugin.dll"
>
> In this case I had the "qmldir" file is in the qmlimports/ dir.
>
> This begs the question "why" and "how". To me this starts to look like
> the path where QML is looking for the qmldir file is being hard coded
> at installation time. No? In the case where it doesn't work, QML is
> setting the import path to something non-existing (look at the log
> below,  first line. It's the same in both traces and this is not what
> I would expect).
>

Yes, the install path is hardcoded. I don't remember the equivalent on
Windows, but on Linux you can specify "configure -prefix 'somepath'".
With that, 'somepath' gets hardcoded into the Qt binaries and Qt will
look for plugins in somepath/plugins directory, imports in
somepath/imports etc (also read up on qt.conf). Since they are
hardcoded in the binary, these paths will persist even if you move the
binaries to another machine. (Read up on qt.conf for more info)

> Or are there still some tricks I can play so that QML importer would
> not look into a Qt installation dir?
>
> Here's the complete log with QML import traces when it works:
> http://pastebin.com/cup17tbz
> Here's the complete log with QML import traces when it does not work:
> http://pastebin.com/eqrkYKNA
>
> From the trace where it does not work, it is not finding the "qmldir" file.
>
> Any ideas from this?
>

Someone more knowledgeable with the traces can probably help out. To
double check, you have the dll and qmldir under
C:/Users/jop/Desktop/demo-notworking/hw3duidemo/qmlimports/QtWebKit/
right? (The QtWebKit directory is important).

Girish


More information about the Qt-qml mailing list