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


Python Qt.Key_Down方法代码示例

本文整理汇总了Python中PyQt5.QtCore.Qt.Key_Down方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.Key_Down方法的具体用法?Python Qt.Key_Down怎么用?Python Qt.Key_Down使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtCore.Qt的用法示例。


在下文中一共展示了Qt.Key_Down方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: keyPressEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Down [as 别名]
def keyPressEvent(self, event: QKeyEvent) -> None:

        if self.isReadOnly():
            return

        block: QTextBlock = self.textCursor().block()

        if event.key() in [Qt.Key_Down, Qt.Key_Up, Qt.Key_Left, Qt.Key_Right]:
            return

        if not event.key() == 16777220:
            super().keyPressEvent(event)

        if not isinstance(self.ignoreLength, bool):

            textToWrite: str = block.text()[self.ignoreLength:]

            # TODO: Handle multiline input!!!

            if event.key() == 16777220:
                self.userInputSignal.emit(textToWrite)
                return 
开发者ID:CountryTk,项目名称:Hydra,代码行数:24,代码来源:Terminal.py

示例2: filterKeyPressInHostsTableView

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Down [as 别名]
def filterKeyPressInHostsTableView(self, key, receiver):
        if not receiver.selectionModel().selectedRows():
            return True

        index = receiver.selectionModel().selectedRows()[0].row()

        if key == Qt.Key_Down:
            new_index = index + 1
            receiver.selectRow(new_index)
            receiver.clicked.emit(receiver.selectionModel().selectedRows()[0])
        elif key == Qt.Key_Up:
            new_index = index - 1
            receiver.selectRow(new_index)
            receiver.clicked.emit(receiver.selectionModel().selectedRows()[0])
        elif QApplication.keyboardModifiers() == Qt.ControlModifier and key == Qt.Key_C:
            selected = receiver.selectionModel().currentIndex()
            clipboard = QApplication.clipboard()
            clipboard.setText(selected.data().toString())
        return True 
开发者ID:GoVanguard,项目名称:legion,代码行数:21,代码来源:eventfilter.py

示例3: keyPressEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Down [as 别名]
def keyPressEvent(self, event):
        """Reimplemented."""
        # Override the default QComboBox behavior
        if event.key() == Qt.Key_Down and event.modifiers() & Qt.AltModifier:
            self.showPopup()
            return

        ignored = {Qt.Key_Up, Qt.Key_Down,
                   Qt.Key_PageDown, Qt.Key_PageUp,
                   Qt.Key_Home, Qt.Key_End}

        if event.key() in ignored:
            event.ignore()
            return

        super(CheckComboBox, self).keyPressEvent(event) 
开发者ID:artisan-roaster-scope,项目名称:artisan,代码行数:18,代码来源:qcheckcombobox.py

示例4: eventFilter

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Down [as 别名]
def eventFilter(self, obj, e):
        if obj == self.command and e.type() == QEvent.KeyPress:
            history = self.device.history
            if e.modifiers() & Qt.ControlModifier:
                if e.key() == Qt.Key_H:
                    d = DeviceConsoleHistory(self.device.env.devices)
                    if d.exec_() == QDialog.Accepted:
                        self.command.setText(d.command)

                elif len(history) > 0:
                    if e.key() == Qt.Key_E:
                        self.command.setText(history[0])

                    if e.key() == Qt.Key_Down:
                        self.command.completer().setModel(QStringListModel(history))
                        self.command.setText(' ')
                        self.command.completer().complete()
            return False

        return QDockWidget.eventFilter(self, obj, e) 
开发者ID:jziolkowski,项目名称:tdm,代码行数:22,代码来源:Console.py

示例5: down

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Down [as 别名]
def down(self, count=1):
        self._key_press(Qt.Key_Down, count, 'scrollBarMaximum', Qt.Vertical) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:4,代码来源:webkittab.py

示例6: keyPressEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Down [as 别名]
def keyPressEvent(self, e):
        """Override keyPressEvent to handle special keypresses."""
        if e.key() == Qt.Key_Up:
            self.history_prev()
            e.accept()
        elif e.key() == Qt.Key_Down:
            self.history_next()
            e.accept()
        elif e.modifiers() & Qt.ControlModifier and e.key() == Qt.Key_C:
            self.setText('')
            e.accept()
        else:
            super().keyPressEvent(e) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:15,代码来源:consolewidget.py

示例7: eventFilter

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Down [as 别名]
def eventFilter(self, obj, event):
        if obj == self.edtCommand:
            if event.type() == QEvent.KeyPress:
                if event.key() == Qt.Key_Up:
                    self.prev_command()
                    return True
                elif event.key() == Qt.Key_Down:
                    self.next_command()
                    return True
            return False
        else:
            return super().eventFilter(obj, event) 
开发者ID:Bertrand256,项目名称:dash-masternode-tool,代码行数:14,代码来源:cmd_console_dlg.py

示例8: test_export

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Down [as 别名]
def test_export(main,mocker):

    qtbot, win = main

    debugger = win.components['debugger']
    debugger._actions['Run'][0].triggered.emit()

    #set focus
    obj_tree = win.components['object_tree'].tree
    obj_tree_comp = win.components['object_tree']
    qtbot.mouseClick(obj_tree, Qt.LeftButton)
    qtbot.keyClick(obj_tree, Qt.Key_Down)
    qtbot.keyClick(obj_tree, Qt.Key_Down)

    #export STL
    mocker.patch.object(QFileDialog, 'getSaveFileName', return_value=('out.stl',''))
    obj_tree_comp._export_STL_action.triggered.emit()
    assert(os.path.isfile('out.stl'))

    #export STEP
    mocker.patch.object(QFileDialog, 'getSaveFileName', return_value=('out.step',''))
    obj_tree_comp._export_STEP_action.triggered.emit()
    assert(os.path.isfile('out.step'))

    #clean
    os.remove('out.step')
    os.remove('out.stl') 
开发者ID:CadQuery,项目名称:CQ-editor,代码行数:29,代码来源:test_app.py

示例9: test_inspect

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Down [as 别名]
def test_inspect(main):

    qtbot, win = main

    #set focus and make invisible
    obj_tree = win.components['object_tree'].tree
    qtbot.mouseClick(obj_tree, Qt.LeftButton)
    qtbot.keyClick(obj_tree, Qt.Key_Down)
    qtbot.keyClick(obj_tree, Qt.Key_Down)
    qtbot.keyClick(obj_tree, Qt.Key_Space)

    #enable object inspector
    insp = win.components['cq_object_inspector']
    insp._toolbar_actions[0].toggled.emit(True)

    #check if all stack items are visible in the tree
    assert(insp.root.childCount() == 3)

    #check if correct number of items is displayed
    viewer = win.components['viewer']

    insp.setCurrentItem(insp.root.child(0))
    assert(number_visible_items(viewer) == 4)

    insp.setCurrentItem(insp.root.child(1))
    assert(number_visible_items(viewer) == 7)

    insp.setCurrentItem(insp.root.child(2))
    assert(number_visible_items(viewer) == 4)

    insp._toolbar_actions[0].toggled.emit(False)
    assert(number_visible_items(viewer) == 3) 
开发者ID:CadQuery,项目名称:CQ-editor,代码行数:34,代码来源:test_app.py

示例10: _qtKeyToUMKey

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Down [as 别名]
def _qtKeyToUMKey(self, key):
        if key == Qt.Key_Shift:
            return KeyEvent.ShiftKey
        elif key == Qt.Key_Control:
            return KeyEvent.ControlKey
        elif key == Qt.Key_Alt:
            return KeyEvent.AltKey
        elif key == Qt.Key_Space:
            return KeyEvent.SpaceKey
        elif key == Qt.Key_Meta:
            return KeyEvent.MetaKey
        elif key == Qt.Key_Enter or key == Qt.Key_Return:
            return KeyEvent.EnterKey
        elif key == Qt.Key_Up:
            return KeyEvent.UpKey
        elif key == Qt.Key_Down:
            return KeyEvent.DownKey
        elif key == Qt.Key_Left:
            return KeyEvent.LeftKey
        elif key == Qt.Key_Right:
            return KeyEvent.RightKey
        elif key == Qt.Key_Minus:
            return KeyEvent.MinusKey
        elif key == Qt.Key_Underscore:
            return KeyEvent.UnderscoreKey
        elif key == Qt.Key_Plus:
            return KeyEvent.PlusKey
        elif key == Qt.Key_Equal:
            return KeyEvent.EqualKey

        return key 
开发者ID:Ultimaker,项目名称:Uranium,代码行数:33,代码来源:QtKeyDevice.py

示例11: keyPressEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Down [as 别名]
def keyPressEvent(self, event: QtGui.QKeyEvent) -> None:
        key_press = event.key()
        # if key_press == Qt.Key_Up:
        #     self.snake.direction = 'u'
        # elif key_press == Qt.Key_Down:
        #     self.snake.direction = 'd'
        # elif key_press == Qt.Key_Right:
        #     self.snake.direction = 'r'
        # elif key_press == Qt.Key_Left:
        #     self.snake.direction = 'l' 
开发者ID:Chrispresso,项目名称:SnakeAI,代码行数:12,代码来源:snake_app.py

示例12: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Down [as 别名]
def __init__(self, ui):
        
        super().__init__(ui)
        self.rois = [
            ROIWorm(
                self.ui.wormCanvas1,
                self.ui.comboBox_ROI1,
                self.ui.checkBox_ROI1
                ),
            ROIWorm(
                self.ui.wormCanvas2,
                self.ui.comboBox_ROI2,
                self.ui.checkBox_ROI2
                )
        ]

        
        self.ui.radioButton_ROI1.setShortcut(QKeySequence(Qt.Key_Up))
        self.ui.radioButton_ROI2.setShortcut(QKeySequence(Qt.Key_Down))


        self.ui.checkBox_ROI1.stateChanged.connect(partial(self._updateROI, self.rois[0]))
        self.ui.checkBox_ROI2.stateChanged.connect(partial(self._updateROI, self.rois[1]))

        self.ui.comboBox_ROI1.activated.connect(partial(self._updateROI, self.rois[0]))
        self.ui.comboBox_ROI2.activated.connect(partial(self._updateROI, self.rois[1]))
        
        # flags for RW and FF
        self.RW, self.FF = 1, 2
        self.ui.pushButton_ROI1_RW.clicked.connect(partial(self.roiRWFF, self.RW, self.rois[0]))
        self.ui.pushButton_ROI1_FF.clicked.connect(partial(self.roiRWFF, self.FF, self.rois[0]))
        self.ui.pushButton_ROI2_RW.clicked.connect(partial(self.roiRWFF, self.RW, self.rois[1]))
        self.ui.pushButton_ROI2_FF.clicked.connect(partial(self.roiRWFF, self.FF, self.rois[1])) 
开发者ID:ver228,项目名称:tierpsy-tracker,代码行数:35,代码来源:MWTrackerViewer.py

示例13: keyPressEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Down [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

示例14: textChanged

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Down [as 别名]
def textChanged(self, e):  # QKeyEvent(QEvent.KeyPress, Qt.Key_Enter, Qt.NoModifier)
        # if (32<e.key()<96 or 123<e.key()<126 or 0x1000001<e.key()<0x1000005 or e.key==Qt.Key_Delete):
        # 大键盘为Ret小键盘为Enter
        if (e.key() in (Qt.Key_Return, Qt.Key_Enter, Qt.Key_Semicolon, Qt.Key_BraceRight, Qt.Key_Up, Qt.Key_Down,
                        Qt.Key_Left, Qt.Key_Right, Qt.Key_Tab, Qt.Key_Delete, Qt.Key_Backspace)):
            self.renderStyle()
            self.loadColorPanel()

        self.actions["undo"].setEnabled(self.editor.isUndoAvailable())
        self.actions["redo"].setEnabled(self.editor.isRedoAvailable()) 
开发者ID:hustlei,项目名称:QssStylesheetEditor,代码行数:12,代码来源:mainwin.py

示例15: keyPressEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Down [as 别名]
def keyPressEvent(self, event):
		"""Keyboard press event

		Effective key: W, A, S, D, ↑,  ↓,  ←,  →
		Press a key on keyboard, the function will get an event, if the condition is met, call the function 
		run_action(). 

		Args:
			event, this argument will get when an event of keyboard pressed occured

		"""
		key_press = event.key()

		# don't need autorepeat, while haven't released, just run once
		if not event.isAutoRepeat():
			if key_press == Qt.Key_Up:			# up 
				run_action('camup')
			elif key_press == Qt.Key_Right:		# right
				run_action('camright')
			elif key_press == Qt.Key_Down:		# down
				run_action('camdown')
			elif key_press == Qt.Key_Left:		# left
				run_action('camleft')
			elif key_press == Qt.Key_W:			# W
				run_action('forward')
			elif key_press == Qt.Key_A:			# A
				run_action('fwleft')
			elif key_press == Qt.Key_S:			# S
				run_action('backward')
			elif key_press == Qt.Key_D:			# D
				run_action('fwright') 
开发者ID:sunfounder,项目名称:SunFounder_PiCar-V,代码行数:33,代码来源:client.py


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