mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
typingEvent fix,double characters when focus
This commit is contained in:
parent
de3d7b8b19
commit
5860e81ff3
|
@ -2583,7 +2583,7 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
|
||||||
else
|
else
|
||||||
if ( obj == wordList )
|
if ( obj == wordList )
|
||||||
{
|
{
|
||||||
if ( ev->type() == QEvent::KeyPress )
|
if (ev->type() == QEvent::KeyPress || ev->type() == QEvent::ShortcutOverride)
|
||||||
{
|
{
|
||||||
QKeyEvent * keyEvent = static_cast< QKeyEvent * >( ev );
|
QKeyEvent * keyEvent = static_cast< QKeyEvent * >( ev );
|
||||||
|
|
||||||
|
@ -2634,7 +2634,7 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (obj == ui.dictsList) {
|
if (obj == ui.dictsList) {
|
||||||
if ( ev->type() == QEvent::KeyPress )
|
if ( ev->type() == QEvent::KeyPress || ev->type() == QEvent::ShortcutOverride)
|
||||||
{
|
{
|
||||||
QKeyEvent * keyEvent = static_cast< QKeyEvent * >( ev );
|
QKeyEvent * keyEvent = static_cast< QKeyEvent * >( ev );
|
||||||
|
|
||||||
|
@ -2768,10 +2768,11 @@ void MainWindow::typingEvent( QString const & t )
|
||||||
|
|
||||||
if( translateLine->isEnabled() )
|
if( translateLine->isEnabled() )
|
||||||
{
|
{
|
||||||
//translateLine->setFocus();
|
translateLine->clear();
|
||||||
// Escaping the typed-in characters is the user's responsibility.
|
translateLine->setFocus();
|
||||||
setTranslateBoxTextAndClearSuffix( t, WildcardsAreAlreadyEscaped, EnablePopup );
|
// Escaping the typed-in characters is the user's responsibility.
|
||||||
translateLine->setCursorPosition( t.size() );
|
// setTranslateBoxTextAndClearSuffix( t, WildcardsAreAlreadyEscaped, EnablePopup );
|
||||||
|
// translateLine->setCursorPosition( t.size() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -856,9 +856,10 @@ void ScanPopup::typingEvent( QString const & t )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui.translateBox->translateLine()->setFocus();
|
ui.translateBox->translateLine()->clear();
|
||||||
ui.translateBox->setText( t, true );
|
ui.translateBox->translateLine()->setFocus();
|
||||||
ui.translateBox->translateLine()->setCursorPosition( t.size() );
|
// ui.translateBox->setText( t, true );
|
||||||
|
// ui.translateBox->translateLine()->setCursorPosition( t.size() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue