[PyQt] KHTMLPart mouse events

Christoph Burgmer chrislb at gmx.de
Sat Jan 10 13:54:41 GMT 2009


Am Saturday, 10. January 2009 schrieben Sie:
> On Friday 09 January 2009 08:50:07 am Christoph Burgmer wrote:

> > It seems that
> > khtmlMousePressEvent (khtml::MousePressEvent* event)
> > is the right place to do that, but the sip-file does not have those
> > mouse event methods, they are commented out.

[snip]

> I suspect that khtml::MousePressEvent is not a class that's exposed in
> the "public" KDE API - meaning it's declared in some file that PyKDE
> doesn't wrap. So if you got one, you couldn't do anything with it
> anyway, since it's not a wrapped class.
>
> However, there are mouse events (QMouseEvent) available in KHTMLView,
> and you can get the KHTMLView object from the part by calling it's
> view() method.

[snip]

Thanks for the answer.
I finally ported my main view from KHTMLPart to QWebView and a few lines give 
me what I want + portability to pure Qt for later.

class CharacterView(QtWebKit.QWebView):
    def mousePressEvent(self, event):
        QtWebKit.QWebView.mousePressEvent(self, event)
        if event.button() == QtCore.Qt.MidButton:
            self.emit(QtCore.SIGNAL("midButtonRelease"))

Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090110/58d72962/attachment.html


More information about the PyQt mailing list