# Remapping keys via qt.QShortcut()

**URL:** <https://discourse.slicer.org/t/remapping-keys-via-qt-qshortcut/44869>\
**Category:** Support\
**Tags:** python\
**Created:** [October 24, 2025, 1:02pm UTC](https://discourse.slicer.org/t/remapping-keys-via-qt-qshortcut/44869 "2025-10-24T13:02:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tas47](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/tas47/32/78529_2.png) [@tas47](https://discourse.slicer.org/u/tas47)\
**Post date:** [October 24, 2025, 1:02pm UTC](https://discourse.slicer.org/t/remapping-keys-via-qt-qshortcut/44869/1 "2025-10-24T13:02:21Z")

</div>

Hello all,  
I was wondering if there was anyway to remap shortcut keys that are already used:  
example say Ctrl+9 is already used for another shortcut or maybe not available: is there a way to free it up and remap to the a function? Given function useHangingProtocolPetCT

````shortcut
shortcut.setKey(qt.QKeySequence("Ctrl+9"))
shortcut.connect( "activated()", useHangingProtocolPetCt)```

Thank you,
````

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 25, 2025, 2:54pm UTC](https://discourse.slicer.org/t/remapping-keys-via-qt-qshortcut/44869/2 "2025-10-25T14:54:51Z")

</div>

This should not be hard to do, as Slicer exposes the full Qt API in Python. You can look up the Qt documentarion or ask chatbots about how to do it exactly, but it should be something like finding the shortcut or action object and then change the keyboard shortcut (and then you can add a new one) or add a new shortcut with a more specific context or install an event filter.
