mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
Extract ArticleView::highlightAllFtsOccurences()
Extracting this function allows to simplify the code and facilitates optimizing it in the next commit. Remove `#if QT_VERSION >= 0x040600` along the way as GoldenDict does not support Qt versions older than 4.6 for several years now.
This commit is contained in:
parent
9f5788ee11
commit
bd5b36cac7
|
@ -2643,17 +2643,9 @@ void ArticleView::highlightFTSResults()
|
||||||
if( ftsSearchMatchCase )
|
if( ftsSearchMatchCase )
|
||||||
flags |= QWebPage::FindCaseSensitively;
|
flags |= QWebPage::FindCaseSensitively;
|
||||||
|
|
||||||
#if QT_VERSION >= 0x040600
|
|
||||||
flags |= QWebPage::HighlightAllOccurrences;
|
|
||||||
|
|
||||||
for( int x = 0; x < allMatches.size(); x++ )
|
|
||||||
ui.definition->findText( allMatches.at( x ), flags );
|
|
||||||
|
|
||||||
flags &= ~QWebPage::HighlightAllOccurrences;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( !allMatches.isEmpty() )
|
if( !allMatches.isEmpty() )
|
||||||
{
|
{
|
||||||
|
highlightAllFtsOccurences( flags );
|
||||||
if( ui.definition->findText( allMatches.at( 0 ), flags ) )
|
if( ui.definition->findText( allMatches.at( 0 ), flags ) )
|
||||||
{
|
{
|
||||||
ui.definition->page()->currentFrame()->
|
ui.definition->page()->currentFrame()->
|
||||||
|
@ -2669,6 +2661,13 @@ void ArticleView::highlightFTSResults()
|
||||||
ftsSearchIsOpened = true;
|
ftsSearchIsOpened = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ArticleView::highlightAllFtsOccurences( QWebPage::FindFlags flags )
|
||||||
|
{
|
||||||
|
flags |= QWebPage::HighlightAllOccurrences;
|
||||||
|
for( int x = 0; x < allMatches.size(); x++ )
|
||||||
|
ui.definition->findText( allMatches.at( x ), flags );
|
||||||
|
}
|
||||||
|
|
||||||
void ArticleView::performFtsFindOperation( bool backwards )
|
void ArticleView::performFtsFindOperation( bool backwards )
|
||||||
{
|
{
|
||||||
if( !ftsSearchIsOpened )
|
if( !ftsSearchIsOpened )
|
||||||
|
|
|
@ -61,6 +61,7 @@ class ArticleView: public QFrame
|
||||||
int ftsPosition;
|
int ftsPosition;
|
||||||
|
|
||||||
void highlightFTSResults();
|
void highlightFTSResults();
|
||||||
|
void highlightAllFtsOccurences( QWebPage::FindFlags flags );
|
||||||
void performFtsFindOperation( bool backwards );
|
void performFtsFindOperation( bool backwards );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in a new issue