From 495047082b25ca4e56c1d7f3e72ec040fabd3439 Mon Sep 17 00:00:00 2001 From: Konstantin Isakov Date: Tue, 12 May 2009 15:54:37 +0000 Subject: [PATCH] *! Some fixes for "type-to-search" feature. --- src/articleview.cc | 4 ++++ src/mainwindow.cc | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/articleview.cc b/src/articleview.cc index af1aabf3..1d076f22 100644 --- a/src/articleview.cc +++ b/src/articleview.cc @@ -235,6 +235,10 @@ bool ArticleView::eventFilter( QObject * obj, QEvent * ev ) { QKeyEvent * keyEvent = static_cast< QKeyEvent * >( ev ); + if ( keyEvent->key() == Qt::Key_Space || + keyEvent->key() == Qt::Key_Backspace ) + return false; // Those key have other uses than to start typing + QString text = keyEvent->text(); if ( text.size() ) diff --git a/src/mainwindow.cc b/src/mainwindow.cc index d65ab849..f8eeede2 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -907,9 +907,14 @@ void MainWindow::showDefinitionInNewTab( QString const & word, void MainWindow::typingEvent( QString const & t ) { - ui.translateLine->setText( t ); - ui.translateLine->setFocus(); - ui.translateLine->setCursorPosition( t.size() ); + if ( t == "\n" || t == "\r" ) + focusTranslateLine(); + else + { + ui.translateLine->setText( t ); + ui.translateLine->setFocus(); + ui.translateLine->setCursorPosition( t.size() ); + } } void MainWindow::showTranslationFor( QString const & inWord )