fix:code smell

This commit is contained in:
Xiao YiFang 2023-04-10 22:12:54 +08:00 committed by xiaoyifang
parent 6dee7cf1e9
commit 54a4a052a5

View file

@ -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,11 +751,9 @@ 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 ) {
@ -763,7 +761,6 @@ bool ScanPopup::eventFilter( QObject * watched, QEvent * event )
}
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() );
}