mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
fix:code smell
This commit is contained in:
parent
6dee7cf1e9
commit
54a4a052a5
18
scanpopup.cc
18
scanpopup.cc
|
@ -712,7 +712,7 @@ vector< sptr< Dictionary::Class > > const & ScanPopup::getActiveDicts()
|
|||
|
||||
Config::MutedDictionaries const * mutedDictionaries = dictionaryBar.getMutedDictionaries();
|
||||
|
||||
if ( !dictionaryBar.toggleViewAction()->isChecked() || mutedDictionaries == 0 ){
|
||||
if ( !dictionaryBar.toggleViewAction()->isChecked() || mutedDictionaries == nullptr ){
|
||||
return groups[current].dictionaries;
|
||||
}
|
||||
|
||||
|
@ -751,18 +751,15 @@ void ScanPopup::typingEvent( QString const & t )
|
|||
|
||||
bool ScanPopup::eventFilter( QObject * watched, QEvent * event )
|
||||
{
|
||||
if ( watched == ui.translateBox->translateLine() )
|
||||
if ( watched == ui.translateBox->translateLine() && event->type() == QEvent::FocusIn )
|
||||
{
|
||||
if ( event->type() == QEvent::FocusIn )
|
||||
{
|
||||
QFocusEvent * focusEvent = static_cast< QFocusEvent * >( event );
|
||||
const QFocusEvent * focusEvent = static_cast< QFocusEvent * >( event );
|
||||
|
||||
// select all on mouse click
|
||||
if ( focusEvent->reason() == Qt::MouseFocusReason ) {
|
||||
QTimer::singleShot( 0, this, &ScanPopup::focusTranslateLine );
|
||||
}
|
||||
return false;
|
||||
// select all on mouse click
|
||||
if ( focusEvent->reason() == Qt::MouseFocusReason ) {
|
||||
QTimer::singleShot( 0, this, &ScanPopup::focusTranslateLine );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( mouseIntercepted )
|
||||
|
@ -771,7 +768,6 @@ bool ScanPopup::eventFilter( QObject * watched, QEvent * event )
|
|||
|
||||
if ( event->type() == QEvent::MouseMove )
|
||||
{
|
||||
// GD_DPRINTF( "Object: %s\n", watched->objectName().toUtf8().data() );
|
||||
QMouseEvent * mouseEvent = ( QMouseEvent * ) event;
|
||||
reactOnMouseMove( mouseEvent->globalPos() );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue