mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
*! Some fixes for "type-to-search" feature.
This commit is contained in:
parent
496e1c873c
commit
495047082b
|
@ -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() )
|
||||
|
|
|
@ -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 )
|
||||
|
|
Loading…
Reference in a new issue