diff --git a/config.cc b/config.cc
index d56cbd55..2660095a 100644
--- a/config.cc
+++ b/config.cc
@@ -1782,7 +1782,7 @@ void save( Class const & c )
preferences.appendChild( opt );
opt = dd.createElement( "mainWindowHotkey" );
- opt.appendChild( dd.createTextNode( c.preferences.mainWindowHotkey.toKeySequence().toString() ) );
+ opt.appendChild( dd.createTextNode( c.preferences.mainWindowHotkey.toString() ) );
preferences.appendChild( opt );
opt = dd.createElement( "enableClipboardHotkey" );
@@ -1790,7 +1790,7 @@ void save( Class const & c )
preferences.appendChild( opt );
opt = dd.createElement( "clipboardHotkey" );
- opt.appendChild( dd.createTextNode( c.preferences.clipboardHotkey.toKeySequence().toString() ) );
+ opt.appendChild( dd.createTextNode( c.preferences.clipboardHotkey.toString() ) );
preferences.appendChild( opt );
opt = dd.createElement( "startWithScanPopupOn" );
diff --git a/config.hh b/config.hh
index e52f3718..2d097cc4 100644
--- a/config.hh
+++ b/config.hh
@@ -320,9 +320,9 @@ struct Preferences
bool searchInDock;
bool enableMainWindowHotkey;
- HotKey mainWindowHotkey;
+ QKeySequence mainWindowHotkey;
bool enableClipboardHotkey;
- HotKey clipboardHotkey;
+ QKeySequence clipboardHotkey;
bool startWithScanPopupOn;
bool enableScanPopupModifiers;
diff --git a/hotkeywrapper.cc b/hotkeywrapper.cc
index a5eae039..6dda6116 100644
--- a/hotkeywrapper.cc
+++ b/hotkeywrapper.cc
@@ -329,6 +329,12 @@ bool HotkeyWrapper::setGlobalKey( int key, int key2,
return true;
}
+bool HotkeyWrapper::setGlobalKey( QKeySequence & seq, int handle )
+{
+ Config::HotKey hk(seq);
+ return setGlobalKey(hk.key1,hk.key2,hk.modifiers,handle);
+}
+
#if( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) )
bool HotkeyWrapper::winEvent ( MSG * message, long * result )
#else
diff --git a/hotkeywrapper.hh b/hotkeywrapper.hh
index 00ad0965..dc537c75 100644
--- a/hotkeywrapper.hh
+++ b/hotkeywrapper.hh
@@ -68,6 +68,8 @@ public:
bool setGlobalKey( int key, int key2, Qt::KeyboardModifiers modifier,
int handle );
+ bool setGlobalKey( QKeySequence & , int );
+
/// Unregisters everything
void unregister();
diff --git a/mainwindow.cc b/mainwindow.cc
index e93a6bc1..f48ce208 100644
--- a/mainwindow.cc
+++ b/mainwindow.cc
@@ -2971,17 +2971,11 @@ void MainWindow::installHotKeys()
}
if ( cfg.preferences.enableMainWindowHotkey )
- hotkeyWrapper->setGlobalKey( cfg.preferences.mainWindowHotkey.key1,
- cfg.preferences.mainWindowHotkey.key2,
- cfg.preferences.mainWindowHotkey.modifiers,
- 0 );
+ hotkeyWrapper->setGlobalKey( cfg.preferences.mainWindowHotkey,0 );
if ( cfg.preferences.enableClipboardHotkey && scanPopup.get() )
{
- hotkeyWrapper->setGlobalKey( cfg.preferences.clipboardHotkey.key1,
- cfg.preferences.clipboardHotkey.key2,
- cfg.preferences.clipboardHotkey.modifiers,
- 1 );
+ hotkeyWrapper->setGlobalKey( cfg.preferences.clipboardHotkey,1 );
}
connect( hotkeyWrapper.get(),
diff --git a/preferences.cc b/preferences.cc
index 6cdebbc8..33fb3c63 100644
--- a/preferences.cc
+++ b/preferences.cc
@@ -178,9 +178,9 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ):
#endif
ui.enableMainWindowHotkey->setChecked( p.enableMainWindowHotkey );
- ui.mainWindowHotkey->setHotKey( p.mainWindowHotkey );
+ ui.mainWindowHotkey->setKeySequence( p.mainWindowHotkey );
ui.enableClipboardHotkey->setChecked( p.enableClipboardHotkey );
- ui.clipboardHotkey->setHotKey( p.clipboardHotkey );
+ ui.clipboardHotkey->setKeySequence( p.clipboardHotkey );
ui.startWithScanPopupOn->setChecked( p.startWithScanPopupOn );
ui.enableScanPopupModifiers->setChecked( p.enableScanPopupModifiers );
@@ -398,9 +398,9 @@ Config::Preferences Preferences::getPreferences()
p.darkMode = ui.darkMode->isChecked();
p.darkReaderMode = ui.darkReaderMode->isChecked();
p.enableMainWindowHotkey = ui.enableMainWindowHotkey->isChecked();
- p.mainWindowHotkey = ui.mainWindowHotkey->getHotKey();
+ p.mainWindowHotkey = ui.mainWindowHotkey->keySequence();
p.enableClipboardHotkey = ui.enableClipboardHotkey->isChecked();
- p.clipboardHotkey = ui.clipboardHotkey->getHotKey();
+ p.clipboardHotkey = ui.clipboardHotkey->keySequence();
p.startWithScanPopupOn = ui.startWithScanPopupOn->isChecked();
p.enableScanPopupModifiers = ui.enableScanPopupModifiers->isChecked();
diff --git a/preferences.ui b/preferences.ui
index d0f40859..983f327f 100644
--- a/preferences.ui
+++ b/preferences.ui
@@ -709,11 +709,7 @@ in the pressed state when the word selection changes.
-
-
-
- false
-
-
+
@@ -740,11 +736,7 @@ in the pressed state when the word selection changes.
-
-
-
- false
-
-
+
@@ -1760,11 +1752,6 @@ from Stardict, Babylon and GLS dictionaries
-
- HotKeyEdit
- QLineEdit
-
-
StylesComboBox
QComboBox