lucw
April 25, 2022, 12:30pm
#1
how do you make keyboard shorcuts configurable ? As in, how do you accept input from the user to remap a keyboard shortcut ? Is there a PyQT widget which does that ?
QKeySequenceEdit Class | Qt Widgets 6.3.0 might be what you’re looking for.
Closet uses it for its occlusion shortcut:
) -> None:
self.ui.occludeShortcut.setKeySequence(QKeySequence(occlude_shortcut))
self.ui.occlusionAcceptBehavior.setCurrentIndex(
behaviors.index(occlude_accept_behavior)
)
self.ui.maxHeight.setValue(max_height)
self.ui.versionInfo.setText(f"Closet {version}")
def accept(self):
occlude_shortcut = self.ui.occludeShortcut.keySequence().toString()
occlude_accept_behavior = behaviors[
self.ui.occlusionAcceptBehavior.currentIndex()
]
max_height = self.ui.maxHeight.value()
self.cb(occlude_shortcut, occlude_accept_behavior, max_height)
super().accept()
GitHub - ijgnd/anki__editor__apply__font_color__background_color__custom_class__custom_style makes heavy use of it too:
4 Likes