Cutey
17th January 2007, 15:18
Hi,
In my application, I have a problem with find a word in the QTextBrowser.
For some texts,
It finds occurrence of the text in the whole document when it reached end of document, it reports "Text not found" rather than "Search reached end of the document".
At the same time if the user presses the "FIND" subsequently, find process goes one step backwardly to the document and then proceed from the starting of the document.
Note:
The above problem is not for all the text in the document.
This is my Code snippet:
bool DWCHelpWindow::findTextInWindow ( const QString& searchStr, QString& resultStr, bool cs, bool wo, bool forward ) {
if ( !bIsLimitReached ) {
if ( m_browser->find ( searchStr, cs, wo, forward ) ) {//m_browser is member of QTextBrowser
resultStr = "";
bIsLimitReached = FALSE;
return TRUE;
} else {
if ( m_browser->find ( searchStr, cs, wo, ( !forward ) ) ) {
if ( !bIsLimitReached ) {
if ( forward ) {
m_browser->find ( searchStr, cs, wo, ( forward ) );
resultStr = "Search reached end of the document";
} else {
m_browser->find ( searchStr, cs, wo, ( forward ) );
resultStr = "Search reached start of the document";
}
}
bIsLimitReached = TRUE;
} else {
resultStr = "Text not found";
}
return FALSE;
}
} else
return FALSE;
}I could not figure out the problem.
plz any help.
In my application, I have a problem with find a word in the QTextBrowser.
For some texts,
It finds occurrence of the text in the whole document when it reached end of document, it reports "Text not found" rather than "Search reached end of the document".
At the same time if the user presses the "FIND" subsequently, find process goes one step backwardly to the document and then proceed from the starting of the document.
Note:
The above problem is not for all the text in the document.
This is my Code snippet:
bool DWCHelpWindow::findTextInWindow ( const QString& searchStr, QString& resultStr, bool cs, bool wo, bool forward ) {
if ( !bIsLimitReached ) {
if ( m_browser->find ( searchStr, cs, wo, forward ) ) {//m_browser is member of QTextBrowser
resultStr = "";
bIsLimitReached = FALSE;
return TRUE;
} else {
if ( m_browser->find ( searchStr, cs, wo, ( !forward ) ) ) {
if ( !bIsLimitReached ) {
if ( forward ) {
m_browser->find ( searchStr, cs, wo, ( forward ) );
resultStr = "Search reached end of the document";
} else {
m_browser->find ( searchStr, cs, wo, ( forward ) );
resultStr = "Search reached start of the document";
}
}
bIsLimitReached = TRUE;
} else {
resultStr = "Text not found";
}
return FALSE;
}
} else
return FALSE;
}I could not figure out the problem.
plz any help.