开发者

Qt can I drag and drop from widget to Qwebkit?

I'm developing simple HTML editor and I like to be 开发者_JAVA百科able to drag and drop from a button that for example represent HTML text line and in the Qwebkit the HTML text line will be created does Qt support such action?

How should I approach such thing?


I believe it does, yes.

What you need to do is set the mime type of your drag event. See here for details. Then on the webkit side, you can read the drops mime type to see what it was.

You can then try one of the following approaches:

  1. Subclassing QWebView to implement dragEnterEvent and dropEvent. You can use event->pos() in the dropEvent to get the position where the drop occured.
  2. Implementing the drop in javascript within your page, eg setting up an event listener for drops or however its done (I've never tried this).
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜