Results 1 to 2 of 2

Thread: QTextBrowser Problem

  1. #1
    Join Date
    Dec 2006
    Location
    Bangalore, India
    Posts
    38
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Question QTextBrowser Problem

    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:
    Qt Code:
    1. bool DWCHelpWindow::findTextInWindow ( const QString& searchStr, QString& resultStr, bool cs, bool wo, bool forward ) {
    2. if ( !bIsLimitReached ) {
    3. if ( m_browser->find ( searchStr, cs, wo, forward ) ) {//m_browser is member of QTextBrowser
    4. resultStr = "";
    5. bIsLimitReached = FALSE;
    6. return TRUE;
    7. } else {
    8. if ( m_browser->find ( searchStr, cs, wo, ( !forward ) ) ) {
    9. if ( !bIsLimitReached ) {
    10. if ( forward ) {
    11. m_browser->find ( searchStr, cs, wo, ( forward ) );
    12. resultStr = "Search reached end of the document";
    13. } else {
    14. m_browser->find ( searchStr, cs, wo, ( forward ) );
    15. resultStr = "Search reached start of the document";
    16. }
    17. }
    18. bIsLimitReached = TRUE;
    19. } else {
    20. resultStr = "Text not found";
    21. }
    22. return FALSE;
    23. }
    24. } else
    25. return FALSE;
    26. }
    To copy to clipboard, switch view to plain text mode 
    I could not figure out the problem.
    plz any help.
    WINNERS DON`T D DIFFERENT THINGS THEY D THINGS differently.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTextBrowser Problem

    What is the actual problem? From what I see it looks like you search backwards in some other way than when you search forwards. When you set bIsLimitReached to true, it stays true which implies that the inner branch (if(!bIsLimitReached)) is never entered when searching backwards.

Similar Threads

  1. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54
  2. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  3. [QT4] QtextBrowser and image size (win)
    By sebgui in forum Qt Programming
    Replies: 0
    Last Post: 28th March 2006, 21:01
  4. Replies: 16
    Last Post: 7th March 2006, 15:57
  5. how to adjust sizes of QTextBrowser?
    By Pan Wojtas in forum Qt Programming
    Replies: 2
    Last Post: 7th February 2006, 22:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.