improved Ctrl+, Ctrl+Shift+ input fix (I hope :)

This commit is contained in:
John Preston 2015-10-18 15:43:19 +02:00
parent 7d666ed225
commit 1a54daef31
2 changed files with 23 additions and 11 deletions

View file

@ -40,6 +40,7 @@
#include <private/qguiapplication_p.h>
#include <qpa/qplatformtheme.h>
#include <qstylehints.h>
#include <QtCore/QLocale>
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
#endif
@ -1879,10 +1880,17 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
unknown = false;
}
// QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards
if (unknown && !isReadOnly()
&& event->modifiers() != Qt::ControlModifier
&& event->modifiers() != (Qt::ControlModifier | Qt::ShiftModifier)) {
// 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 (event->modifiers() == Qt::ControlModifier
|| event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) {
skip = true;
}
}
if (unknown && !isReadOnly() && !skip) {
QString t = event->text();
if (!t.isEmpty() && (t.at(0).isPrint() || t.at(0).unicode() == 0x200C || t.at(0).unicode() == 0x200D)) {
insert(t);

View file

@ -1342,17 +1342,21 @@ void QWidgetTextControlPrivate::keyPressEvent(QKeyEvent *e)
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
|| e->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) {
e->ignore();
return;
skip = true;
}
}
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 (overwriteMode
// no need to call deleteChar() if we have a selection, insertText