I currently have a QWidget that contains a QWebView. The container QWidget is translucent and frameless. I’ve been able to make it possible to drag the frameless window around by clicking and dragging around the outsides of the QWidget, but I cannot drag when I click anything in the QWebView.
My goal is to be able to create an element in the DOM of the QWebView with a class or id of “drag-handle”. Then, from within the application I would like to find any element called “drag-handle” and bind it to the drag event so I can use it to drag around the whole QWidget container.
I hope this makes sense, feel free to just point me in the direction of some docs or sample material if you think that’ll do it for me, I’d be more than happy to try to figure it out on my own if someone can just point me in the right direction.
By my opinion you should not use drag events, but mouse events. You should extend QWebVew class, override mouse handler events and:
QPoint offset = previousPos – event->pos(); mainWindow->move(mainWindow->pos() + offset);
For implementation of this functionality you may use QStateMachine.