当前位置: 首页>>代码示例>>Python>>正文


Python Qt.Key_Escape方法代码示例

本文整理汇总了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 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:22,代码来源:keyutils.py

示例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() 
开发者ID:gridsync,项目名称:gridsync,代码行数:19,代码来源:main_window.py

示例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) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:6,代码来源:crashdialog.py

示例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) 
开发者ID:amccaugh,项目名称:phidl,代码行数:30,代码来源:quickplotter.py

示例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() 
开发者ID:persepolisdm,项目名称:persepolis,代码行数:5,代码来源:update.py

示例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. 
开发者ID:persepolisdm,项目名称:persepolis,代码行数:8,代码来源:addlink.py

示例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() 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:5,代码来源:flash_dialog.py

示例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 
开发者ID:ugroot,项目名称:GROOT,代码行数:7,代码来源:Gui.py

示例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) 
开发者ID:ozmartian,项目名称:vidcutter,代码行数:13,代码来源:mpvwidget.py

示例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() 
开发者ID:TUDelft-CNS-ATM,项目名称:bluesky,代码行数:29,代码来源:mainwindow.py

示例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) 
开发者ID:iGio90,项目名称:Dwarf,代码行数:8,代码来源:panel_java_explorer.py

示例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() 
开发者ID:koduj-z-klasa,项目名称:python101,代码行数:5,代码来源:kalkulator06a.py

示例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) 
开发者ID:zdenop,项目名称:lector,代码行数:10,代码来源:ocrwidget.py


注:本文中的PyQt5.QtCore.Qt.Key_Escape方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。