def keyPressEvent(self, event): change = 0 if event.key() == Qt.Key_Home: change = -self.__denominator elif event.key() in (Qt.Key_Up, Qt.Key_Right): change = 1 elif event.key() == Qt.Key_PageUp: change = (self.__denominator // 10) + 1 elif event.key() in (Qt.Key_Down, Qt.Key_Left): change = -1 elif event.key() == Qt.Key_PageDown: change = -((self.__denominator // 10) + 1) elif event.key() == Qt.Key_End: change = self.__denominator if change: numerator = self.__numerator numerator += change numerator = max(0, min(numerator, self.__denominator)) if numerator != self.__numerator: self.__numerator = numerator self.valueChanged.emit(self.__numerator, self.__denominator) self.update() event.accept() else: QWidget.keyPressEvent(self, event)
def keyPressEvent(self, event): key = event.key() mod = event.modifiers() if key == Qt.Key_Up and self.history: self.history_i = min(self.history_i+1, len(self.history)-1) self.lineInput.setText(self.history[self.history_i]) elif key == Qt.Key_Down and self.history: self.history_i = max(self.history_i-1, -1) if self.history_i >= 0: self.lineInput.setText(self.history[self.history_i]) else: self.lineInput.setText('') elif key == Qt.Key_Enter or key == Qt.Key_Return: if mod & Qt.ShiftModifier: self.complete() else: self.run() elif key == Qt.Key_Escape: txt, r = QInputDialog.getItem(self, QCoreApplication.translate("QPyShell", "Command line history"), QCoreApplication.translate("QPyShell", "Please select a history item:"), self.history, 0, False) if r and txt: self.lineInput.setText(txt) elif self.standalone and key == Qt.Key_Print: self.printContents() elif self.standalone and key == Qt.Key_Q and (mod & Qt.ControlModifier): self.close() else: QWidget.keyPressEvent(self, event)
def keyPressEvent(self, event): if event.key()==Qt.Key_Right: self.slider.setValue(self.slider.value() + 1) elif event.key()==Qt.Key_Left: self.slider.setValue(self.slider.value() - 1) else: QWidget.keyPressEvent(self, event)
def keyPressEvent(self, event): qKey = str(event.key()) if qKey in midi_keyboard2key_map.keys(): self.sendNoteOn(midi_keyboard2key_map.get(qKey)) QWidget.keyPressEvent(self, event)
def keyPressEvent(self, event): QWidget.keyPressEvent(self, event) if not event.isAccepted() and event.key() == Qt.Key_Escape: if self.layoutEditor.isVisible(): self.leaveLayoutEditor() self.actionChangeLayout.setChecked(False) else: self.close()
def keyPressEvent( self, event ): " Handles the key press events " if event.key() == Qt.Key_Escape: self.escapePressed.emit() event.accept() else: QWidget.keyPressEvent( self, event ) return
def keyPressEvent(self, event): " Handles the key press events " if event.key() == Qt.Key_Escape: self.escapePressed.emit() event.accept() else: QWidget.keyPressEvent(self, event) return
def keyPressEvent(self, event): taskList = { Qt.Key_Plus: lambda: self.scaleView(1.2), Qt.Key_Minus: lambda: self.scaleView(1 / 1.2)} if(event.key() in taskList): taskList[event.key()]() else: QWidget.keyPressEvent(self, event)
def keyPressEvent(self, e): if (e.modifiers() == Qt.ControlModifier or e.modifiers() == Qt.MetaModifier) and e.key() == Qt.Key_C: items = '' for r in range(self.rasterInfoList.count()): items.append(self.rasterInfoList.item(r).text() + "\n") if items: clipboard = QApplication.clipboard() clipboard.setText(items) else: QWidget.keyPressEvent(self, e)
def keyPressEvent( self, e ): if ( e.modifiers() == Qt.ControlModifier or e.modifiers() == Qt.MetaModifier ) and e.key() == Qt.Key_C: items = '' for r in range( self.rasterInfoList.count() ): items.append( self.rasterInfoList.item( r ).text() + "\n" ) if items: clipboard = QApplication.clipboard() clipboard.setText( items ) else: QWidget.keyPressEvent( self, e )
def keyPressEvent(self, event): taskList = { Qt.Key_Plus: lambda: self.scaleView(1.2), Qt.Key_Minus: lambda: self.scaleView(1 / 1.2) } if (event.key() in taskList): taskList[event.key()]() else: QWidget.keyPressEvent(self, event)
def keyPressEvent(self, event): """Reimplemented to handle key events""" ctrl = event.modifiers() & Qt.ControlModifier shift = event.modifiers() & Qt.ShiftModifier if event.key() in (Qt.Key_Enter, Qt.Key_Return): self.emit(SIGNAL('find()')) elif event.key() == Qt.Key_F and ctrl and shift: # Toggle find widgets self.parent().emit(SIGNAL('toggle_visibility(bool)'), not self.isVisible()) else: QWidget.keyPressEvent(self, event)
def keyPressEvent(self, event): """ Called on key press Reimplement from widget """ if event.key() == Qt.Key_Delete: self.deleteItem() return QWidget.keyPressEvent(self, event)
def keyPressEvent(self, event): if event.key() == Qt.Qt.Key_Left: self.navPlot.change_selected_pointleft() if event.key() == Qt.Qt.Key_Right: self.navPlot.change_selected_pointright() return QWidget.keyPressEvent(self, event)
def keyPressEvent(self, event): key = event.key() changed = False if key == Qt.Key_Enter or key == Qt.Key_Return or key == Qt.Key_Right: self.selected.emit(self.selectedIndex) self.items[self.selectedIndex].selected.emit() if key == Qt.Key_Escape or key == Qt.Key_Left: self.exit.emit() elif key == Qt.Key_Down: self.selectedIndex += 1 changed = True elif key == Qt.Key_Up: self.selectedIndex -= 1 changed = True else: QWidget.keyPressEvent(self, event) self.validateSelected() if changed: self.selectionChanged.emit(self.selectedIndex)
def keyPressEvent(self, event): if not event.isAutoRepeat(): qKey = str(event.key()) if qKey in kMidiKeyboard2KeyMap.keys(): self.sendNoteOn(kMidiKeyboard2KeyMap.get(qKey)) QWidget.keyPressEvent(self, event)
def keyPressEvent(self, event): """ Switch back to the original value on ESC. """ QWidget.keyPressEvent(self, event) if event.key() == Qt.Key_Escape: self.setValue(self._originalValue)
def keyPressEvent(self, event): if not self.keyPressHandler(event): QWidget.keyPressEvent(self, event)
def keyPressEvent(self,event): """ Switch back to the original value on ESC. """ QWidget.keyPressEvent(self,event) if event.key()==Qt.Key_Escape: self.setValue(self._originalValue)
def keyReleaseEvent(self, event): if event.key() == Qt.Key_Alt: self.menuBar().setVisible(not self.menuBar().isVisible()) else: QWidget.keyPressEvent(self, event)
def keyPressEvent(self, e): if e.key() in [Qt.Key_Escape]: self.close() #print e.key() #self.TreeEditor.keyPressEvent(e) QWidget.keyPressEvent(self, e)