def keyPressEvent(self, event: QKeyEvent) -> None:
     if event.key() == Qt.Key_Escape:
         self.modlist.setFocus()
         self.searchbar.setText('')
     elif event.matches(QKeySequence.Find):
         self.searchbar.setFocus()
     elif event.matches(QKeySequence.Paste):
         self.pasteEvent()
     # TODO: enhancement: add start game / start script merger shortcuts
     else:
         super().keyPressEvent(event)
Beispiel #2
0
 def keyPressEvent(self, event: QKeyEvent) -> None:
     if event.key() == Qt.Key_Escape:
         self.selectionModel().clear()
     elif event.matches(QKeySequence.Delete):
         asyncio.create_task(self.deleteSelectedMods())
     elif event.modifiers(
     ) & Qt.ControlModifier == Qt.ControlModifier and event.key(
     ) == Qt.Key_Up:
         asyncio.create_task(self.changeSelectedModsPriority(1))
     elif event.modifiers(
     ) & Qt.ControlModifier == Qt.ControlModifier and event.key(
     ) == Qt.Key_Down:
         asyncio.create_task(self.changeSelectedModsPriority(-1))
     elif event.modifiers(
     ) & Qt.ControlModifier == Qt.ControlModifier and event.key(
     ) == Qt.Key_P:
         index = self.selectionModel().selectedRows()[0]
         index = index.sibling(index.row(), 5)
         if index.flags() & Qt.ItemIsEditable:
             self.setCurrentIndex(index)
             self.edit(index)
     else:
         super().keyPressEvent(event)