Do exact match for Ctrl+Shift+.
This commit is contained in:
parent
7eaf7f8aaa
commit
893dab0920
1 changed files with 5 additions and 7 deletions
|
|
@ -2919,10 +2919,10 @@ bool InputField::handleMarkdownKey(QKeyEvent *e) {
|
||||||
if (!_markdownEnabled) {
|
if (!_markdownEnabled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto matches = [&](const QKeySequence &sequence) {
|
const auto modifiers = e->modifiers()
|
||||||
const auto searchKey = (e->modifiers() | e->key())
|
|
||||||
& ~(Qt::KeypadModifier | Qt::GroupSwitchModifier);
|
& ~(Qt::KeypadModifier | Qt::GroupSwitchModifier);
|
||||||
const auto events = QKeySequence(searchKey);
|
const auto matches = [&](const QKeySequence &sequence) {
|
||||||
|
const auto events = QKeySequence(modifiers | e->key());
|
||||||
return sequence.matches(events) == QKeySequence::ExactMatch;
|
return sequence.matches(events) == QKeySequence::ExactMatch;
|
||||||
};
|
};
|
||||||
const auto matchesCtrlShiftDot = [&] {
|
const auto matchesCtrlShiftDot = [&] {
|
||||||
|
|
@ -2930,8 +2930,7 @@ bool InputField::handleMarkdownKey(QKeyEvent *e) {
|
||||||
// shift+. gives us '>' and ctrl+shift+> is not the same.
|
// shift+. gives us '>' and ctrl+shift+> is not the same.
|
||||||
// So we check with native code instead.
|
// So we check with native code instead.
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
return e->modifiers().testFlag(Qt::ControlModifier)
|
return (modifiers == (Qt::ControlModifier | Qt::ShiftModifier))
|
||||||
&& e->modifiers().testFlag(Qt::ShiftModifier)
|
|
||||||
&& (e->nativeVirtualKey() == VK_OEM_PERIOD);
|
&& (e->nativeVirtualKey() == VK_OEM_PERIOD);
|
||||||
#elif !defined DESKTOP_APP_DISABLE_X11_INTEGRATION // Q_OS_WIN
|
#elif !defined DESKTOP_APP_DISABLE_X11_INTEGRATION // Q_OS_WIN
|
||||||
if (!_inner->_xcbKeySymbols) {
|
if (!_inner->_xcbKeySymbols) {
|
||||||
|
|
@ -2941,8 +2940,7 @@ bool InputField::handleMarkdownKey(QKeyEvent *e) {
|
||||||
_inner->_xcbKeySymbols.get(),
|
_inner->_xcbKeySymbols.get(),
|
||||||
e->nativeScanCode(),
|
e->nativeScanCode(),
|
||||||
0);
|
0);
|
||||||
return e->modifiers().testFlag(Qt::ControlModifier)
|
return (modifiers == (Qt::ControlModifier | Qt::ShiftModifier))
|
||||||
&& e->modifiers().testFlag(Qt::ShiftModifier)
|
|
||||||
&& (keysym == XKB_KEY_period);
|
&& (keysym == XKB_KEY_period);
|
||||||
#else // !Q_OS_WIN && !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
#else // !Q_OS_WIN && !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue