QMimeData::setUrls() and setData() with custom data type works works incorrect(different) from JS-side.



  • Hello,

    I have an issue with QMimeData.
    It works well in Qt 4.7.4, but it works in another way in Qt 4.8, Qt 5.1 (Win7).

    My application is custom QWebView that shows some WebPage.
    I have added some code on DropEvent but the issue can be reproduced even using browser-project from example.

    1. Open browser(5.1) / fancybrowser(4.8.4) / fancybrowser(4.7.4) from example folder
    2. Open test-html page:
      @
      <html>
      <body>
      <input name="First" size="40" ondrop=droph(event) ondragover="return false;"/>
      </body>
      </html>

    <scrip_t>
    function droph(event)
    {
    alert(event.dataTransfer.getData('text/uri-list'));
    alert(event.dataTransfer.getData('text/plain'));
    //console.log('PoolName', event.dataTransfer.getData('PoolName'));
    }
    </scrip_t>
    @

    1. Drag'n'Drop file(-s) on input area on webPage.

    Result (alerts()):
    4.7.4 libs will show you links to files that you droped ('text/uri-list')
    4.8.4 & 5.1.0 will show some Chinese chars first('text/uri-list') and after that correct paths('text/plain').
    Chinese chars is some kind of another(incorrect?) encoding of data.

    The same behavior for custom Mime-data. If I use
    @
    byteArrPoolName.append("MyNameOfPool");
    mimeData->setData("PoolName", byteArrPoolName);
    @

    and after that try to get it in JavaScript
    @
    event.dataTransfer.getData('PoolName');
    @

    It returns incorrect charachters the same as in Uri case.

    Please, help me. Because It blocks my application in migration to newer version of Qt and WebKit.

    Thanks in advance.


  • Lifetime Qt Champion

    Hi and welcome to devnet

    You might have found a bug/regression, you should bring this question to the interest mailing list, you'll find Qt's developers/maintainers there (this forum is more user oriented)

    A quick look to the "bug report":bugreports.qt-project.org/issues/ system is also a good idea


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.