[QScintilla] Mouse event filter for QsciScintilla

Phil Thompson phil at riverbankcomputing.com
Mon Nov 13 14:49:54 GMT 2017


On 12 Nov 2017, at 9:17 pm, VA <dev+pyqt at indigo.re> wrote:
> 
> Hi,
> 
> It seems there's a bug with QsciScintilla widgets because they do not receive mouse press events, so it's not possible to have an event filter for mouse presses.
> 
> With this code sample, 'clicked' is never printed when clicking the text widget:
> 
> from PyQt5.QtCore import *
> from PyQt5.QtWidgets import *
> from PyQt5.Qsci import *
> 
> class Filter(QObject):
> 	def eventFilter(self, target, ev):
> 		if ev.type() == QEvent.MouseButtonPress:
> 			print('clicked')
> 		return False
> 
> app = QApplication([])
> f = Filter()
> sci = QsciScintilla()
> sci.installEventFilter(f)
> sci.show()
> app.exec_()

They do receive mouse press events. They are consumed (ie. accepted) and so do not make it to the event filter.

Phil


More information about the QScintilla mailing list