Regression: Fix "can't go up/down the list of suggestions" bug introduced while fixing "sync between currently active article and the 'found in dictionaries' pane for web dictionaries" bug. See other focusReasons at http://doc.qt.nokia.com/4.7-snapshot/qt.html#FocusReason-enum

This commit is contained in:
Julian Depetris Chauvin 2011-09-03 11:45:43 -03:00
parent e362b4d2ca
commit f5cd150201
3 changed files with 19 additions and 1 deletions

View file

@ -101,7 +101,7 @@ std::string ArticleMaker::makeHtmlHeader( QString const & word,
"function processIframeMouseOut() { overIframeId = null; top.focus(); }"
"function processIframeMouseOver( newId ) { overIframeId = newId; }"
"function processIframeClick() { if( overIframeId != null ) { overIframeId = overIframeId.replace( 'gdexpandframe-', '' ); gdMakeArticleActive( overIframeId ) } }"
"function init() { window.addEventListener('blur', processIframeClick, false); top.focus(); }"
"function init() { window.addEventListener('blur', processIframeClick, false); }"
"window.addEventListener('load', init, false);"
"</script>";

View file

@ -38,3 +38,20 @@ void ArticleWebView::mouseDoubleClickEvent( QMouseEvent * event )
}
}
void ArticleWebView::focusInEvent( QFocusEvent * event )
{
QWebView::focusInEvent( event );
switch( event->reason() )
{
case Qt::MouseFocusReason:
case Qt::TabFocusReason:
case Qt::BacktabFocusReason:
page()->mainFrame()->evaluateJavaScript("top.focus();");
break;
default:
break;
}
}

View file

@ -38,6 +38,7 @@ protected:
void mousePressEvent( QMouseEvent * event );
void mouseReleaseEvent( QMouseEvent * event );
void mouseDoubleClickEvent( QMouseEvent * event );
void focusInEvent( QFocusEvent * event );
private: