Python源码示例:PyQt5.QtCore.Qt.Key_F3()
示例1
def keyPressEvent(self, event):
if event.key() == Qt.Key_Escape:
self.reset_view()
if event.key() == Qt.Key_F1:
self.set_alias_visibility(not self.aliases_visible)
if event.key() == Qt.Key_F2:
self.set_port_visibility(not self.ports_visible)
if event.key() == Qt.Key_F3:
self.set_subport_visibility(not self.subports_visible)
if event.key() == Qt.Key_Question:
help_str = """
Mouse control:
Mousewheel: Zoom in and out
Right-click & drag: Zoom to rectangle
Middle-click & drag: Pan
Keyboard shortcuts:
Esc: Reset view
F1: Show/hide alias names
F2: Show/hide ports
F3: Show/hide subports (ports in underlying references)
"""
QMessageBox.about(self, 'PHIDL Help', help_str)
示例2
def keyPressEvent(self, event):
if event.key() == Qt.Key_F3:
if not self._findItems:
QMessageBox.warning(self, '警告', '没有找到要查找的内容!')
return
self._curFindItemPos += 1
self._curFindItemPos = self._curFindItemPos%len(self._findItems)
self.scrollToItem(self._findItems[self._curFindItemPos])
self.setCurrentItem(self._findItems[self._curFindItemPos])
示例3
def keyPressEvent(self, event):
if event.key() == Qt.Key_F3:
if not self._findItems:
QMessageBox.warning(self, '警告', '没有找到要查找的内容!')
return
self._curFindItemPos += 1
self._curFindItemPos = self._curFindItemPos%len(self._findItems)
self.scrollToItem(self._findItems[self._curFindItemPos])
self.setCurrentItem(self._findItems[self._curFindItemPos])
示例4
def keyPressEvent(self, e):
if e.modifiers() == Qt.ControlModifier and e.key() == Qt.Key_F:
text, okPressed = QInputDialog.getText(self, "Find", "Find what: ")
self.setSelectionBackgroundColor(QColor("#6be585"))
if okPressed:
if text == "":
text = " "
self.dialog.noMatch(text)
self.searchtext = text
"""
This is the way to implement a search function using QScintilla
http://pyqt.sourceforge.net/Docs/QScintilla2/classQsciScintilla.html#a37ac2bea94eafcfa639173557a821200
"""
if self.findFirst(
self.searchtext, False, True, False, True, True, -1, -1, True, False
):
pass
else:
self.dialog.noMatch(self.searchtext)
if e.key() == Qt.Key_F3:
self.findNext()
self.setSelectionBackgroundColor(QColor("#6be585"))
if e.modifiers() == Qt.ControlModifier and e.key() == Qt.Key_L:
self.setCursorPosition(self.line, self.column + 1)
return
if e.modifiers() == Qt.ControlModifier and e.key() == 77:
self.setCursorPosition(self.line + 1, self.column)
return
if e.modifiers() == Qt.ControlModifier and e.key() == Qt.Key_J:
self.setCursorPosition(self.line, self.column - 1)
if e.modifiers() == Qt.ControlModifier and e.key() == Qt.Key_I:
self.setCursorPosition(self.line - 1, self.column)
if e.modifiers() == Qt.ControlModifier and e.key() == Qt.Key_T:
self.parent.parent.realterminal()
return
super().keyPressEvent(e)