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:
- Subclassing
QWebView
to implementdragEnterEvent
anddropEvent
. You can useevent->pos()
in thedropEvent
to get the position where the drop occured. - 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).
精彩评论