From b1a1be6f4e27f4276fe834ef32427bc68d10e731 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 14 Jan 2014 13:50:13 +0100 Subject: [PATCH] + workaround for strange behaviour of Qt 4.8 regarding period/colon --- src/Gui/PythonConsole.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index 28586eb4c..e900b5168 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -539,10 +539,18 @@ void PythonConsole::keyPressEvent(QKeyEvent * e) case Qt::Key_Period: { - // analyse context and show available call tips - int contextLength = cursor.position() - inputLineBegin.position(); - TextEdit::keyPressEvent(e); - d->callTipsList->showTips( inputStrg.left( contextLength ) ); + // In Qt 4.8 there is a strange behaviour because when pressing ":" + // then key is also set to 'Period' instead of 'Colon'. So we have + // to make sure we only handle the period. + if (e->text() == QLatin1String(".")) { + // analyse context and show available call tips + int contextLength = cursor.position() - inputLineBegin.position(); + TextEdit::keyPressEvent(e); + d->callTipsList->showTips( inputStrg.left( contextLength ) ); + } + else { + TextEdit::keyPressEvent(e); + } } break; case Qt::Key_Home: