From 595d11cfa0f4df6a6c677d45f3e62914c068859b Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Sun, 5 Nov 2017 00:19:00 +0200 Subject: [PATCH] Exclude modifier keys from triggering typing notifications fixes #116 --- src/TextInputWidget.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/TextInputWidget.cc b/src/TextInputWidget.cc index e68b1c28..cad54d96 100644 --- a/src/TextInputWidget.cc +++ b/src/TextInputWidget.cc @@ -40,11 +40,14 @@ FilteredTextEdit::FilteredTextEdit(QWidget *parent) void FilteredTextEdit::keyPressEvent(QKeyEvent *event) { - if (!typingTimer_->isActive()) { - emit startedTyping(); - } + const bool isModifier = (event->modifiers() != Qt::NoModifier); - typingTimer_->start(); + if (!isModifier) { + if (!typingTimer_->isActive()) + emit startedTyping(); + + typingTimer_->start(); + } if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) { stopTyping();