Important: Please read the Qt Code of Conduct -

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:
      <input name="First" size="40" ondrop=droph(event) ondragover="return false;"/>

    function droph(event)
    //console.log('PoolName', event.dataTransfer.getData('PoolName'));

    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
    mimeData->setData("PoolName", byteArrPoolName);

    and after that try to get it in JavaScript

    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" system is also a good idea

Log in to reply