[PyKDE] QScintilla bug and workaround

Timo Schüring timo at eda-solutions.de
Sat Oct 16 17:20:57 BST 2004


Hi Torsten and List User,

I had the same problem with AltGR but another solution,
maybe useful for those who do not like to patch QScintilla at C-Level:

Thank you for your analysis, I did check the ascii-value first and then just set the
state to 0 to pass just the ascii - key. But your solution is the better one

Regards,
  Timo

Just subclass the keyPressEvent Handler and modify it,

class SomeClassEdit(QextScintilla):
     def __init__(self,parent=None,name=None,flags=0):
         QextScintilla.__init__(self, parent, name, flags | Qt.WDestructiveClose)
          ...
	 blabala
          ...

     def	keyPressEvent(self,ke):
	# In windows scintilla, Alt Gr expansion lead to command expansion
	# and thus with German keyboards and others no characters which need
	# alt gr can be composed
         # Workaround : Subclass KeyEvent-Handler and modify Key-Event for
         #              to translate Alt and Control to Meta
         #
	#
	if ke.state() ==  Qt.AltButton | Qt.ControlButton :
		mke = QKeyEvent(ke.type(),ke.key(),ke.ascii(),Qt.MetaButton,ke.text())
		ke.accept()
		QextScintilla.keyPressEvent(self,mke)
     	else:
	     	QextScintilla.keyPressEvent(self,ke)










More information about the PyQt mailing list