在QtWebkit中禁用拖放功能 [英] Disable drag/drop in QtWebkit

查看:191
本文介绍了在QtWebkit中禁用拖放功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Qt的WebKit为应用程序创建一个HTML GUI ...到目前为止,一切都很顺利,有一个小问题,我不希望人们能够从我的GUI拖放图像。我使用一个小的java脚本禁用了文本选择。但是我不确定如何禁用图像拖动....我在body标签中使用了onmousedown =return false但它禁用了鼠标点击,这会影响我的所有输入字段,因为用户将无法使用鼠标关注输入对象.....这是我用来禁用鼠标手势的方法。

I am trying to create an HTML GUI for an application using Qt's WebKit... so far everything is going smooth with a minor problem, I don't want people to be able to drag and drop images from my GUI. I have disabled text selection using a small java script. But I'm not sure how to disable image dragging.... I have used onmousedown="return false" in the body tag but it disables mouse clicking and this would affect all of my input fields since the user will not be able to get the focus on input objects using the mouse..... Here's the method I used to disable the mouse gestures.

<html>
<head>
 ....
</head>

<body onmousedown="return false";>
....
</body>
</html>

我不确定qtwebkit本身是否有一个实际的选项/属性来禁用拖动我偶然发现了与此事有关的任何事情,而且我不想单独为每个图像使用onmousedown =return false代码,因为这将是代码大屠杀。

I am not sure if there is an actual option/attribute in qtwebkit itself to disable dragging as I haven't stumbled upon anything relative to this matter plus I don't wanna use the onmousedown="return false" code for each image individually as this would be a code massacre.

编辑:加上一些图像将作为按钮工作,禁用鼠标点击将使它们停止运作。

Plus some images will work as buttons and disabling mouse clicks will make them stop functioning.

推荐答案

尝试

body ondragstart="return false"

这篇关于在QtWebkit中禁用拖放功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆