Results 1 to 5 of 5

Thread: Problem with Finding the Text

  1. #1
    Join Date
    Feb 2011
    Posts
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Problem with Finding the Text

    Hi, am Using a Find Function in QTextEdit. I can find the Text.But I got some problem now..

    Lets say i have 500 lines in the TextEdit. Whenever i click the Find Next Button, the text is found but i can see the word only by scrolling. So what i need is , whenever i click the Find Next Button, the Window should display the Current Found word

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Problem with Finding the Text

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Feb 2011
    Posts
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem with Finding the Text

    Thanks for Reply..
    Even i tried that thing , but its not working.

    i will post my code:

    Using QTextEdit::ExtraSelection //selecting the word.
    Using QList<QTextEdit::ExtraSelection> //store the selected word.

    i tried like this..
    cursor.movePosition(selection[find].cursor.Start);
    textEdit->setTextCursor(cursor);
    textEdit->ensureCursorVisible();

    Help me out.......

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Problem with Finding the Text

    QTextEdit::find() already repositions the cursor. Just call ensureCursorVisible() then.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Feb 2011
    Posts
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Unhappy Re: Problem with Finding the Text

    Thanks for reply....

    i got a solution ....

    cursor.setPosition(selection[i].cursor.position()); //set the textcursor poistion
    textEdit->ensureCursorVisible();

    its working fine .

Similar Threads

  1. Problem in FINDING Previous Word
    By charlesprime in forum Qt Programming
    Replies: 10
    Last Post: 23rd February 2011, 05:32
  2. Problem finding text in a QTextEdit
    By Vash5556 in forum Qt Programming
    Replies: 8
    Last Post: 18th May 2009, 14:19
  3. Finding text on Text edit
    By jyoti kumar in forum Qt Programming
    Replies: 2
    Last Post: 18th May 2006, 13:20
  4. Replies: 7
    Last Post: 15th February 2006, 11:34

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.