views:

17

answers:

1

Im developing simple html editor and i like to be able to drap and drop
from abutton 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 ?

+1  A: 

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).
Dan