本文整理汇总了Python中PyQt5.QtCore.Qt.Key_Escape方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.Key_Escape方法的具体用法?Python Qt.Key_Escape怎么用?Python Qt.Key_Escape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.Key_Escape方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: text
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Escape [as 别名]
def text(self) -> str:
"""Get the text which would be displayed when pressing this key."""
control = {
Qt.Key_Space: ' ',
Qt.Key_Tab: '\t',
Qt.Key_Backspace: '\b',
Qt.Key_Return: '\r',
Qt.Key_Enter: '\r',
Qt.Key_Escape: '\x1b',
}
if self.key in control:
return control[self.key]
elif not _is_printable(self.key):
return ''
text = QKeySequence(self.key).toString()
if not self.modifiers & Qt.ShiftModifier: # type: ignore[operator]
text = text.lower()
return text
示例2: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Escape [as 别名]
def keyPressEvent(self, event):
key = event.key()
if key in (Qt.Key_Backspace, Qt.Key_Delete):
view = self.current_view()
selected = view.selectedIndexes() if view else None
if selected:
view.confirm_stop_syncing(view.get_selected_folders())
if key == Qt.Key_Escape:
view = self.current_view()
selected = view.selectedIndexes() if view else None
if selected:
for index in selected:
view.selectionModel().select(
index, QItemSelectionModel.Deselect
)
elif self.gui.systray.isSystemTrayAvailable():
self.hide()
示例3: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Escape [as 别名]
def keyPressEvent(self, e):
"""Prevent closing :report dialogs when pressing <Escape>."""
if config.val.input.escape_quits_reporter or e.key() != Qt.Key_Escape:
super().keyPressEvent(e)
示例4: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Escape [as 别名]
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)
示例5: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Escape [as 别名]
def keyPressEvent(self, event):
if event.key() == Qt.Key_Escape:
self.close()
示例6: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Escape [as 别名]
def keyPressEvent(self, event):
if event.key() == Qt.Key_Escape:
self.close()
# save size and position of window, when user closes the window.
示例7: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Escape [as 别名]
def keyPressEvent(self, event):
if event.key() == Qt.Key_Escape and self._flashing:
event.ignore()
示例8: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Escape [as 别名]
def keyPressEvent(self, e):
if e.key() == Qt.Key_Escape:
self.close()
#Function to display warning message for quitting
示例9: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Escape [as 别名]
def keyPressEvent(self, event: QKeyEvent) -> None:
if event.key() in {Qt.Key_F, Qt.Key_Escape}:
event.accept()
if self.parent is None:
self.originalParent.toggleFullscreen()
else:
self.parent.toggleFullscreen()
elif self.isFullScreen():
self.originalParent.keyPressEvent(event)
else:
super(mpvWidget, self).keyPressEvent(event)
示例10: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Escape [as 别名]
def keyPressEvent(self, event):
if event.modifiers() & Qt.ShiftModifier \
and event.key() in [Qt.Key_Up, Qt.Key_Down, Qt.Key_Left, Qt.Key_Right]:
dlat = 1.0 / (self.radarwidget.zoom * self.radarwidget.ar)
dlon = 1.0 / (self.radarwidget.zoom * self.radarwidget.flat_earth)
if event.key() == Qt.Key_Up:
self.radarwidget.panzoom(pan=(dlat, 0.0))
elif event.key() == Qt.Key_Down:
self.radarwidget.panzoom(pan=(-dlat, 0.0))
elif event.key() == Qt.Key_Left:
self.radarwidget.panzoom(pan=(0.0, -dlon))
elif event.key() == Qt.Key_Right:
self.radarwidget.panzoom(pan=(0.0, dlon))
elif event.key() == Qt.Key_Escape:
self.closeEvent()
elif event.key() == Qt.Key_F11: # F11 = Toggle Full Screen mode
if not self.isFullScreen():
self.showFullScreen()
else:
self.showNormal()
else:
# All other events go to the BlueSky console
self.console.keyPressEvent(event)
event.accept()
示例11: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Escape [as 别名]
def keyPressEvent(self, event): # pylint: disable=invalid-name
key = event.key()
if key == Qt.Key_Backspace or key == Qt.Key_Escape:
self._back()
return super().keyPressEvent(event)
示例12: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Escape [as 别名]
def keyPressEvent(self, e):
if e.key() == Qt.Key_Escape:
self.close()
示例13: keyReleaseEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Escape [as 别名]
def keyReleaseEvent(self, event):
if event.key() == Qt.Key_Delete:
item = self.scene().focusItem()
self.scene().removeArea(item)
#elif event.key() == Qt.Key_Escape:
# self.first = True
QGraphicsView.keyReleaseEvent(self, event)