[PyQt] no mouseMoveEvent in QTextBrowser?

martin.hammer at de.thalesgroup.com martin.hammer at de.thalesgroup.com
Mon Jan 21 09:56:24 GMT 2008


>> Hi,
>>
>> I'm trying to get a mouseMoveEvent from a QTextBrowser in a 
centralwidget
>> of a QMainWindow. I can get mouseMoveEvents of the centralwidget but I
>> don#t seem to be able to get them from the textBrowser. I tried none, 
one
>> and both of commented line but nothing helped...
>>
>> Can anyone give me hint?
>>
>> class MainWindowForm(QtGui.QMainWindow):
>>   def __init__(self, parent=None):
>>     QtGui.QMainWindow.__init__(self)
>>
>>     self.ui = Ui_MainWindow()
>>     self.ui.setupUi(self)
>>     #self.connect( self.ui.textBrowser,
>> QtCore.SIGNAL("mouseMoveEvent(QMouseEvent *)"),
>> self.on_textBrowser_mouseMoveEvent)
>>
>>   #@QtCore.pyqtSignature("QMouseEvent *")
>>   def on_textBrowser_mouseMoveEvent(self, e):
>>     print "textBrowser mouse move"
>>
>>   def mouseMoveEvent(self, ev):
>>     print "centralwidget mouse move"
>> ---
>
>Events aren't signals. You either need to sub-class QTextBrowser and 
>reimplement mouseMoveEvent() (as you have done for QMainWindow) or 
install an 
>event filter.
>
Thanks for that, but as usual for one answer there come more questions :-)

When I install an eventfilter on the textBrowser I get many events like 
ToolTip but very few MouseMoves. In fact I get only MouseMove events 
immediately after the mouse enters or before it leaves the textBrowser. 

Funny is that I get MouseButtonDblClick events with the middle and right 
button but not with the left button.

In contrast to that, when I use a sub-class of textBrowser I think I get 
all MouseMove events, but sub-classing objects, when I use the designer is 
somewhat - hm, ugly - because you don't see it in designer.

Martin Hammer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20080121/24966f72/attachment.html


More information about the PyQt mailing list