Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML deployment problem
Forum Updated to NodeBB v4.3 + New Features

QML deployment problem

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 3 Posters 2.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jackfan
    wrote on last edited by
    #1

    I write a qml program to retrieve the photos album from flickr website, using the following js code, it works fine.

    @function flickrGetPhotoSets()
    {
    req = new XMLHttpRequest();
    req.onreadystatechange = flickrGetPhotoSetsResponse;//parseFunc
    var url = "http://api.flickr.com/services/rest/?method=flickr.photosets.getList&api_key=apikey &user_id=userid&format=json"
    req.open("POST", url, true);
    // req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    req.setRequestHeader("Content-Encoding", "UTF-8");
    req.send();
    }
    function flickrGetPhotoSetsResponse()
    {
    console.log("taobao response start...");
    if (req.readyState == XMLHttpRequest.HEADERS_RECEIVED)
    {
    }
    else if (req.readyState == XMLHttpRequest.DONE)
    {
    if(req.responseText.length == 0 || req.responseText == null)
    {
    return;
    }
    console.log( req.responseText);
    var rsp= req.responseText.toString();
    var start = rsp.indexOf("(") + 1;
    console.log("string start:"+start);
    var end = rsp.length - 1;
    var jSONString = rsp.substring( start, end);
    console.log(jSONString);
    photosetJson = .parse(jSONString);
    background.formatAlbumListModel();
    }
    }@

    Then I try to retrieve photo albums from another website, using the similar js code as following code , it runs fine as picture 2 when I using Qt Creator to compile
    @

    function taotaoGetAccessToken()
    {
    req = new XMLHttpRequest();
    req.onreadystatechange = renrenGetAccessTokenResponse;//parseFunc
    var url = "https://graph.taotao.com/oauth/token?grant_type=password&username=username&password=password&client_id=clientid &client_secret=clientsecret&scope=read_user_album read_user_photo"
    req.open("POST", url, true);
    // req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    req.setRequestHeader("Content-Encoding", "UTF-8");
    req.send();
    }
    function taotaoGetAccessTokenResponse()
    {
    console.log("taotao response start...");
    if (req.readyState == XMLHttpRequest.HEADERS_RECEIVED)
    {
    }
    else if (req.readyState == XMLHttpRequest.DONE)
    {
    if(req.responseText.length == 0 || req.responseText == null)
    {
    return;
    }
    console.log( req.responseText);
    var rsp= req.responseText.toString();
    var accesstokenJson= .parse(rsp);
    accesstoken= accesstokenJson["access_token"]
    var paraArray =
    [
    "api_key=" + "apikey"
    ,"method="+ "photos.getAlbums"
    ,"access_token=" + accesstoken
    ,"format=" + ""
    ,"v=" + "1.0"
    ,"uid=" + "224243671" //"243571487"
    ];
    //
    paraArray.sort();
    var signString= paraArray.join("");
    signString= signString+ "signstring"
    console.log( signString);
    var sign= hex_md5(signString);
    paraArray.push("sig="+sign)
    taotaoGetAlbumsApiURL= "http://api.taotao.com/restserver.do?"+paraArray.join("&");
    console.log("API URL:"+ taotaoGetAlbumsApiURL);
    taotaoGetPhotoSets(taotaoGetAlbumsApiURL)
    }
    }
    function taotaoGetPhotoSets(apirul)
    {
    req = new XMLHttpRequest();
    req.onreadystatechange = taotaoGetPhotoSetsResponse;//parseFunc
    var url = apirul
    req.open("POST", url, true);
    // req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    req.setRequestHeader("Content-Encoding", "UTF-8");
    req.send();
    }
    function taotaoGetPhotoSetsResponse()
    {
    console.log("taotao response start...");
    if (req.readyState == XMLHttpRequest.HEADERS_RECEIVED)
    {
    }
    else if (req.readyState == XMLHttpRequest.DONE)
    {
    if(req.responseText.length == 0 || req.responseText == null)
    {
    return;
    }
    console.log( req.responseText);
    var rsp= req.responseText.toString();
    photosetJson= .parse(rsp);
    // if (photosetJson["error_code"]==undefined)
    background.formatTaotaoAlbumListModel();
    // else
    // {
    // taotaoGetPhotoSets(taotaoGetAlbumsApiURL);
    // console.log("get photoset return error code");
    // }
    }
    }

    @

    picutre2: http://www.flickr.com/photos/66243188@N07/6055674662/

    However, when I deploy the second program, it is not working as in Qt Creator. It displays as pictures 3, in the release folder, besides the compiled exe file, I do include libgcc_s_dw2-1.dll, mingwm10.dll, imageformats, and qt related dlls, the first application can be deployed successfully when I including these files. This is really a weird problem, what is the problem of the second part js code for deployment, why the second part js code can run successfully in Qt creator but fails in deployment? Ps: the two parts js code both linked to the same qml.

    picture 3 http://www.flickr.com/photos/66243188@N07/6055674756/

    1 Reply Last reply
    0
    • M Offline
      M Offline
      minimoog77
      wrote on last edited by
      #2

      Did you add plugins folder in the deployment?

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jackfan
        wrote on last edited by
        #3

        the plugin I used is image dlls, minimoog77, what you mean by plugin folder ? I just include the imageformats folder, is it enough?

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jackfan
          wrote on last edited by
          #4

          I have create a sub-folder named "plugins" and put all images dlls into it, and put app.addLibraryPath("../plugins"); in main.cpp
          but the program still work the same

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sigrid
            wrote on last edited by
            #5

            You need to include the imageformats folder like you did and it needs to be a subdirectory in the directory that contains the executable. Is this how you set it up?

            Also, in order to get information from Qt about the loading of the plugin, you can use the "QT_DEBUG_PLUGINS":http://doc.qt.nokia.com/latest/deployment-plugins.html#debugging-plugins environment variable. This might help you to find the cause of the problem. Set this variable to a non-zero value in the environment from which your application is launched.

            Also, you could try running Dependency Walker on the plugin to check if the dependencies are correct. You need to run Dependency Walker on the plugin from the application directory, this way it will get the same environment as it would when starting up.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved