Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. Qt5.2 webview html5 drag&drop failed
Forum Updated to NodeBB v4.3 + New Features

Qt5.2 webview html5 drag&drop failed

Scheduled Pinned Locked Moved Qt WebKit
3 Posts 3 Posters 2.2k 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.
  • F Offline
    F Offline
    firegnu
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      You should check the "bug report system":http://bugreports.qt-project.org 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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • B Offline
        B Offline
        brcontainer
        wrote on last edited by
        #3

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

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

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

        for (var i = 0, f; f = files[i]; i++) {
        console.log(f);
        }
        }@

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

        • http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_draganddrop (DOM drag and drop)
        • http://blogs.sitepointstatic.com/examples/tech/filedrag/1/index.html (file drop)

        If the problem persists then I think you have not enabled in your webView DROP, try this:
        @WEBVIEW->setAcceptDrops(true);@

        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.

        QT project: https://github.com/brcontainer/qt-helper

        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