Important: Please read the Qt Code of Conduct -

Qt5.2 webview html5 drag&drop failed

  • i write a webpage with image drag and drop from a img tag to div…it works fine in chrome and other browser..with Qt4.8.4 webview it works fine too..but with qt5.2.0 webview it failed…i don’t kown why. does anyone can fix this problem….thanks

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You should check the "bug report system": to see whether it's something known. If not you could consider opening a new bug report providing a minimal compilable example that reproduces the problem.

  • Drag and Drop DOM elements work fine in QT5.2:
    @var a = document.getElementById("mainDiv");
    a.ondrop = function(){
    a.ondragover = function(){

    File drop work fine in QT5.2:
    @a.ondrop = function(e) {

    // fetch FileList object
    var files = || e.dataTransfer.files;

    for (var i = 0, f; f = files[i]; i++) {

    I believe it is a fault in your Javascript, try running the following URLs in your projects:

    If the problem persists then I think you have not enabled in your webView DROP, try this:

    If it still does not work, you might not have Javascript enabled, try this:
    @QWebSettings *settings = QWebSettings::globalSettings();

    settings->setAttribute(QWebSettings::JavascriptEnabled, true);@

    To do all these tests, enable the "Inspector":

    @QWebSettings *settings = QWebSettings::globalSettings();

    settings->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);@

    and the right-click (before any testing) open the Console.

Log in to reply