src/eric7/QScintilla/Editor.py

branch
eric7-maintenance
changeset 10733
d96c69a235fc
parent 10694
f46c1e224e8a
parent 10715
5e000d8fc96b
child 10814
ba20efe10336
--- a/src/eric7/QScintilla/Editor.py	Wed Apr 24 10:14:44 2024 +0200
+++ b/src/eric7/QScintilla/Editor.py	Sun Jun 02 09:51:20 2024 +0200
@@ -37,6 +37,7 @@
     QActionGroup,
     QCursor,
     QFont,
+    QKeyEvent,
     QPainter,
     QPalette,
     QPixmap,
@@ -7978,6 +7979,26 @@
             self.endUndoAction()
             self.setSelection(sline, sindex + 1, eline, eindex + 1)
 
+        if (
+            ev.key() == Qt.Key.Key_Comma
+            and ev.modifiers() & Qt.KeyboardModifier.KeypadModifier
+        ):
+            # Change the numpad ',' to always insert a '.' because that is what
+            # is needed in programming.
+
+            # Create a new QKeyEvent to substitute the original one
+            ev = QKeyEvent(
+                ev.type(),
+                Qt.Key.Key_Period,
+                ev.modifiers(),
+                ".",
+                ev.isAutoRepeat(),
+                ev.count(),
+            )
+
+            super().keyPressEvent(ev)
+            return
+
         txt = ev.text()
 
         # See it is text to insert.

eric ide

mercurial