Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working on an app using QML and the Ubuntu SDK. One of the Pages contains a WebView. While the WebView receives click events just fine, it doesn't receive drag events, as I would like it to.

I assume the problem is that drag events are being trapped to provide navigation gestures for the WebView. This isn't necessary: The WebView is sized to exactly fill up the available space. In the HTML displayed by the WebView, I set <meta name="viewport" content="initial-scale=1.0, user-scalable=no">, to keep the WebView from allowing zooming. The content is sized to fill up the viewport, so there's no need for scrolling. But still, no drag events come through to the WebView. What do I need to do to let them through?

Edit to add: I've gotten reports that touch-and-drag works just fine; it's only mouse drag events that don't work. That would be consistent with this post, which suggests that mouse handling in WebViews in QML is broken.

share|improve this question

I've been wrestling with the same problem, as webview seems very limited wrt drag events. In your case, since you say you need no scrolling nor zooming, then wouldn't a simple MouseArea inside the webview work? This is assuming your simply using webview for rendering and not general browsing. As an aside, I ended up using onChildrenRectChanged to capture any scrolling within the webview, kind of like a substitute for contentX, Y, Width, and Height, but this may or may not be relevant for you.

share|improve this answer
Thanks, but I don't think this is quite what I want. I'd like to drag events to go through to the contents of the WebView. Those contents will handle the drag events. If I understand your suggestion, this would capture the drag events at the QML level instead. I guess it might be possible to capture them with a MouseArea and then communicate them to the contents of the WebView through a side channel, but that sounds like a lot of work. – Robert Schroll Aug 28 '13 at 0:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.