2

Inspired by this Answer QML - Import external JavaScript file I am trying to load a .js file from a external URL.

import QtQuick 2.9
import QtQuick.Window 2.2

import 'http://code.qt.io/cgit/qt/qtdeclarative.git/plain/examples/quick/demos/photoviewer/PhotoViewerCore/script/script.js' as Test

Window {
    id: window
    visible: true
    width: 600
    height: 600

    Component.onCompleted: console.log('It is:', Test.calculateScale(100, 100, 200) + '!\nMagical!')
}

But with the import 'http://...' statement my application is not even starting / crashes immediately after start (without any error message).

I have the strong feeling that I am missing something to get the external import working, but I have no idea what exactly.

9
  • This is probably some incompatibillity of the "new" diskcache functionallity of Qt, where the result of the JIT when loading a QML file is stored, so that it has not to be rebuilt. Try to dissalbe diskcaching. stackoverflow.com/questions/41922581/… Commented Mar 7, 2018 at 13:56
  • Also you might try to get that problem fixed (if that is possible) by filing a bug report. Commented Mar 7, 2018 at 13:57
  • Thank you, your first comment helped me with the error message. But my application is still not starting / crashes immediately after start (without an error message now). Commented Mar 7, 2018 at 14:00
  • Can you try, instead of importing a script, to load an image via HTTP? There might be problems for your Qt app to load anything from the net. Maybe problems with the proxy. Commented Mar 7, 2018 at 14:03
  • @derM Image {source: 'http://.....'} works :/ Commented Mar 7, 2018 at 14:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.