1
0
Fork 0

Merge pull request #2903 from yjd/Fix-Shift-key-combination-bug

Fix Shift key combination bug
This commit is contained in:
Duncan Ogilvie 2022-09-03 14:34:38 +02:00 committed by GitHub
commit 52b9866fc8
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 11 deletions

View File

@ -52,10 +52,13 @@ void ShortcutEdit::keyPressEvent(QKeyEvent* event)
// The shift modifier only counts when it is not used to type a symbol
// that is only reachable using the shift key anyway
// Fix from: https://bbs.pediy.com/thread-270394.htm
if(modifiers.testFlag(Qt::ShiftModifier) && (
((keyInt >= Qt::Key_Exclam) && (keyInt <= Qt::Key_Slash)) ||
((keyInt >= Qt::Key_Colon) && (keyInt <= Qt::Key_At)) ||
((keyInt >= Qt::Key_BracketLeft) && (keyInt <= Qt::Key_QuoteLeft))))
if(modifiers.testFlag(Qt::ShiftModifier) && (text.isEmpty() ||
!text.at(0).isPrint() ||
text.at(0).isLetterOrNumber() ||
text.at(0).isSpace()) &&
(!((keyInt >= Qt::Key_Exclam) && (keyInt <= Qt::Key_Slash)) ||
((keyInt >= Qt::Key_Colon) && (keyInt <= Qt::Key_At)) ||
((keyInt >= Qt::Key_BracketLeft) && (keyInt <= Qt::Key_QuoteLeft))))
keyInt += Qt::SHIFT;
if(modifiers.testFlag(Qt::ControlModifier))
keyInt += Qt::CTRL;

View File

@ -771,10 +771,10 @@
<normaloff>:/Default/icons/shortcut.png</normaloff>:/Default/icons/shortcut.png</iconset>
</property>
<property name="text">
<string>Shortcuts</string>
<string>Hotkeys</string>
</property>
<property name="statusTip">
<string>Open the Shortcuts dialog to customize keyboard shortcuts.</string>
<string>Open the Hotkeys dialog to customize keyboard hotkeys.</string>
</property>
</action>
<action name="actionDonate">

View File

@ -12,7 +12,7 @@ ShortcutsDialog::ShortcutsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::
// x64 has no model-view-controler pattern
QStringList tblHeader;
tblHeader << tr("Action") << tr("Shortcut");
tblHeader << tr("Action") << tr("Hotkey");
currentRow = 0;
@ -96,7 +96,7 @@ void ShortcutsDialog::updateShortcut()
// Ask user if they want to override the shortcut.
QMessageBox mbox;
mbox.setIcon(QMessageBox::Question);
mbox.setText("This shortcut is already used by action \"" + i.value().Name + "\".\n"
mbox.setText("This hotkey is already used by the action \"" + i.value().Name + "\".\n"
"Do you want to override it?");
mbox.setStandardButtons(QMessageBox::No | QMessageBox::Yes);
mbox.setDefaultButton(QMessageBox::Yes);

View File

@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Shortcuts</string>
<string>Hotkeys</string>
</property>
<property name="windowIcon">
<iconset theme="shortcut" resource="../../resource.qrc">
@ -33,7 +33,7 @@
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Shortcut</string>
<string>Hotkey</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>

View File

@ -470,7 +470,7 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
defaultShortcuts.insert("OptionsPreferences", Shortcut({tr("Options"), tr("Preferences")}, "", true));
defaultShortcuts.insert("OptionsAppearance", Shortcut({tr("Options"), tr("Appearance")}, "", true));
defaultShortcuts.insert("OptionsShortcuts", Shortcut({tr("Options"), tr("Shortcuts")}, "", true));
defaultShortcuts.insert("OptionsShortcuts", Shortcut({tr("Options"), tr("Hotkeys")}, "", true));
defaultShortcuts.insert("OptionsTopmost", Shortcut({tr("Options"), tr("Topmost")}, "Ctrl+F5", true));
defaultShortcuts.insert("OptionsReloadStylesheet", Shortcut({tr("Options"), tr("Reload style.css")}, "", true));