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 ),
enableClipboardHotkey( true ),
#endif
mainWindowHotkey( QKeySequence( "Ctrl+F11,F11" ) ),
clipboardHotkey( QKeySequence( "Ctrl+C,C" ) ),
mainWindowHotkey( QKeySequence( "Ctrl+F11, Ctrl+F11" ) ),
clipboardHotkey( QKeySequence( "Ctrl+C, Ctrl+C" ) ),
startWithScanPopupOn( false ),
enableScanPopupModifiers( false ),
scanPopupModifiers( 0 ),

View file

@ -205,11 +205,18 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ):
ui.darkMode->hide();
#endif
/// Hotkey Tab
ui.enableMainWindowHotkey->setChecked( p.enableMainWindowHotkey );
ui.mainWindowHotkey->setKeySequence( p.mainWindowHotkey );
ui.enableClipboardHotkey->setChecked( p.enableClipboardHotkey );
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.enableScanPopupModifiers->setChecked( p.enableScanPopupModifiers );