opt: revise QKeySequenceEdit usages
Some checks are pending
SonarCloud / Build and analyze (push) Waiting to run

* set Maximum length of global shortcuts to 2
* set Default to something that can be set by user
This commit is contained in:
shenleban tongying 2024-11-06 15:36:11 -05:00
parent 8ad7291147
commit 70d21d7eca
2 changed files with 9 additions and 2 deletions

View file

@ -215,8 +215,8 @@ Preferences::Preferences():
enableMainWindowHotkey( true ), enableMainWindowHotkey( true ),
enableClipboardHotkey( true ), enableClipboardHotkey( true ),
#endif #endif
mainWindowHotkey( QKeySequence( "Ctrl+F11,F11" ) ), mainWindowHotkey( QKeySequence( "Ctrl+F11, Ctrl+F11" ) ),
clipboardHotkey( QKeySequence( "Ctrl+C,C" ) ), clipboardHotkey( QKeySequence( "Ctrl+C, Ctrl+C" ) ),
startWithScanPopupOn( false ), startWithScanPopupOn( false ),
enableScanPopupModifiers( false ), enableScanPopupModifiers( false ),
scanPopupModifiers( 0 ), scanPopupModifiers( 0 ),

View file

@ -205,11 +205,18 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ):
ui.darkMode->hide(); ui.darkMode->hide();
#endif #endif
/// Hotkey Tab
ui.enableMainWindowHotkey->setChecked( p.enableMainWindowHotkey ); ui.enableMainWindowHotkey->setChecked( p.enableMainWindowHotkey );
ui.mainWindowHotkey->setKeySequence( p.mainWindowHotkey ); ui.mainWindowHotkey->setKeySequence( p.mainWindowHotkey );
ui.enableClipboardHotkey->setChecked( p.enableClipboardHotkey ); ui.enableClipboardHotkey->setChecked( p.enableClipboardHotkey );
ui.clipboardHotkey->setKeySequence( p.clipboardHotkey ); ui.clipboardHotkey->setKeySequence( p.clipboardHotkey );
#if QT_VERSION >= QT_VERSION_CHECK( 6, 5, 0 )
// Bound by current global hotkey implementations
ui.mainWindowHotkey->setMaximumSequenceLength( 2 );
ui.clipboardHotkey->setMaximumSequenceLength( 2 );
#endif
ui.startWithScanPopupOn->setChecked( p.startWithScanPopupOn ); ui.startWithScanPopupOn->setChecked( p.startWithScanPopupOn );
ui.enableScanPopupModifiers->setChecked( p.enableScanPopupModifiers ); ui.enableScanPopupModifiers->setChecked( p.enableScanPopupModifiers );