*! Some fixes for "type-to-search" feature.

This commit is contained in:
Konstantin Isakov 2009-05-12 15:54:37 +00:00
parent 496e1c873c
commit 495047082b
2 changed files with 12 additions and 3 deletions

View file

@ -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() )

View file

@ -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 )