Added ctrl+p/n to act as up/down arrow in listbox (#1503)

This commit is contained in:
Alice Nyaa 2024-01-07 16:08:10 -05:00 committed by GitHub
parent 32e63d67e3
commit 7ad2cd4936
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 1 deletions

View File

@ -2005,10 +2005,24 @@ class ListBox( QW.QScrollArea ):
elif self._last_hit_logical_index is not None:
if key_code in ( QC.Qt.Key_Up, ):
if ctrl and key_code in ( ord( 'P' ), ord( 'p' ) ):
# remove ctrl key to make it act exactly like the up arrow
ctrl = False
hit_logical_index = ( self._last_hit_logical_index - 1 ) % len( self._ordered_terms )
elif ctrl and key_code in ( ord( 'N' ), ord( 'n' ) ):
# remove ctrl key to make it act exactly like the down arrow
ctrl = False
hit_logical_index = ( self._last_hit_logical_index + 1 ) % len( self._ordered_terms )
elif key_code in ( QC.Qt.Key_Up, ):
hit_logical_index = ( self._last_hit_logical_index - 1 ) % len( self._ordered_terms )
elif key_code in ( QC.Qt.Key_Down, ):
hit_logical_index = ( self._last_hit_logical_index + 1 ) % len( self._ordered_terms )