mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-12 17:34:51 +00:00
improved Ctrl+, Ctrl+Shift+ input fix (I hope :)
This commit is contained in:
parent
7d666ed225
commit
1a54daef31
@ -40,6 +40,7 @@
|
|||||||
#include <private/qguiapplication_p.h>
|
#include <private/qguiapplication_p.h>
|
||||||
#include <qpa/qplatformtheme.h>
|
#include <qpa/qplatformtheme.h>
|
||||||
#include <qstylehints.h>
|
#include <qstylehints.h>
|
||||||
|
#include <QtCore/QLocale>
|
||||||
#ifndef QT_NO_ACCESSIBILITY
|
#ifndef QT_NO_ACCESSIBILITY
|
||||||
#include "qaccessible.h"
|
#include "qaccessible.h"
|
||||||
#endif
|
#endif
|
||||||
@ -1879,10 +1880,17 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
|
|||||||
unknown = false;
|
unknown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards
|
// QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards
|
||||||
if (unknown && !isReadOnly()
|
//
|
||||||
&& event->modifiers() != Qt::ControlModifier
|
bool skip = false;
|
||||||
&& event->modifiers() != (Qt::ControlModifier | Qt::ShiftModifier)) {
|
if (QGuiApplication::inputMethod()->locale().language() == QLocale::German) {
|
||||||
|
if (event->modifiers() == Qt::ControlModifier
|
||||||
|
|| event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) {
|
||||||
|
skip = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unknown && !isReadOnly() && !skip) {
|
||||||
QString t = event->text();
|
QString t = event->text();
|
||||||
if (!t.isEmpty() && (t.at(0).isPrint() || t.at(0).unicode() == 0x200C || t.at(0).unicode() == 0x200D)) {
|
if (!t.isEmpty() && (t.at(0).isPrint() || t.at(0).unicode() == 0x200C || t.at(0).unicode() == 0x200D)) {
|
||||||
insert(t);
|
insert(t);
|
||||||
|
@ -1342,17 +1342,21 @@ void QWidgetTextControlPrivate::keyPressEvent(QKeyEvent *e)
|
|||||||
|
|
||||||
process:
|
process:
|
||||||
{
|
{
|
||||||
if (QGuiApplication::inputMethod()->locale().language() == QLocale::German)
|
// QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards
|
||||||
{
|
//
|
||||||
// QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards
|
bool skip = false;
|
||||||
//
|
if (QGuiApplication::inputMethod()->locale().language() == QLocale::German) {
|
||||||
if (e->modifiers() == Qt::ControlModifier
|
if (e->modifiers() == Qt::ControlModifier
|
||||||
|| e->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) {
|
|| e->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) {
|
||||||
e->ignore();
|
skip = true;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QString text = e->text();
|
if (skip) {
|
||||||
|
e->ignore();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString text = e->text();
|
||||||
if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t') || text.at(0).unicode() == 0x200C || text.at(0).unicode() == 0x200D)) {
|
if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t') || text.at(0).unicode() == 0x200C || text.at(0).unicode() == 0x200D)) {
|
||||||
if (overwriteMode
|
if (overwriteMode
|
||||||
// no need to call deleteChar() if we have a selection, insertText
|
// no need to call deleteChar() if we have a selection, insertText
|
||||||
|
Loading…
Reference in New Issue
Block a user