def keyPressEvent(self, event): if event and self._key_press_rules: next_text = self._key_press_rules.getText(event.key()) if next_text: self.insertPlainText(next_text) return QPlainTextEdit.keyPressEvent(self, event)
def keyPressEvent(self, ev): if ev.key() == Qt.Key_X and ev.modifiers() == Qt.AltModifier: if self.replace_possible_unicode_sequence(): ev.accept() return if ev.key() == Qt.Key_Insert: self.setOverwriteMode(self.overwriteMode() ^ True) ev.accept() return QPlainTextEdit.keyPressEvent(self, ev) if (ev.key() == Qt.Key_Semicolon or ';' in unicode(ev.text())) and tprefs['replace_entities_as_typed'] and self.syntax == 'html': self.replace_possible_entity()
def keyPressEvent(self, ev): if ev.key() == Qt.Key_X and ev.modifiers() == Qt.AltModifier: if self.replace_possible_unicode_sequence(): ev.accept() return if ev.key() == Qt.Key_Insert: self.setOverwriteMode(self.overwriteMode() ^ True) ev.accept() return QPlainTextEdit.keyPressEvent(self, ev) if (ev.key() == Qt.Key_Semicolon or ';' in unicode(ev.text( ))) and tprefs['replace_entities_as_typed'] and self.syntax == 'html': self.replace_possible_entity()
def keyPressEvent(self, ev): if ev.key() == Qt.Key_X and ev.modifiers() == Qt.AltModifier: if self.replace_possible_unicode_sequence(): ev.accept() return if ev.key() == Qt.Key_Insert: self.setOverwriteMode(self.overwriteMode() ^ True) ev.accept() return if self.snippet_manager.handle_key_press(ev): self.completion_popup.hide() return if self.smarts.handle_key_press(ev, self): self.handle_keypress_completion(ev) return QPlainTextEdit.keyPressEvent(self, ev) self.handle_keypress_completion(ev)
def keyPressEvent(self, ev): if ev.key() == Qt.Key_X and ev.modifiers() == Qt.AltModifier: if self.replace_possible_unicode_sequence(): ev.accept() return if ev.key() == Qt.Key_Insert: self.setOverwriteMode(self.overwriteMode() ^ True) ev.accept() return if isosx and ev.modifiers() == Qt.ControlModifier and re.search(r'[a-zA-Z0-9]+', ev.text()) is not None: # For some reason Qt 5 translates Cmd+key into text on OS X # https://bugreports.qt-project.org/browse/QTBUG-36281 ev.setAccepted(False) return QPlainTextEdit.keyPressEvent(self, ev) if (ev.key() == Qt.Key_Semicolon or ';' in unicode(ev.text())) and tprefs['replace_entities_as_typed'] and self.syntax == 'html': self.replace_possible_entity()
def keyPressEvent(self, ev): if ev.key() == Qt.Key_X and ev.modifiers() == Qt.AltModifier: if self.replace_possible_unicode_sequence(): ev.accept() return if ev.key() == Qt.Key_Insert: self.setOverwriteMode(self.overwriteMode() ^ True) ev.accept() return if isosx and QT_VERSION < 0x504000 and ev.modifiers() == Qt.ControlModifier and re.search(r'[a-zA-Z0-9]+', ev.text()) is not None: # For some reason Qt 5 translates Cmd+key into text on OS X # https://bugreports.qt-project.org/browse/QTBUG-36281 ev.setAccepted(False) return if self.smarts.handle_key_press(ev, self): return QPlainTextEdit.keyPressEvent(self, ev)