Results 1 to 5 of 5

Thread: Modified TextFinder example

  1. #1
    Join Date
    Aug 2009
    Location
    Finland
    Posts
    6
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Question Modified TextFinder example

    Hi!

    I´m totally new to Qt and i´m trying to modify TextFinder example (http://doc.trolltech.com/4.5/uitools-textfinder.html) to copy specified number of characters AFTER the highlighted text? Example if we have a text...

    ""GNU General Public License Usage
    ** Alternatively, this file may be used under the terms of the GNU
    ** General Public License version 3.0 as published by the Free Software"

    and we try to find string "version"... program finds string "version" and copies 5 characters " 3.0 " after that to elsewhere (TextEdit). Any help how to do this would be great...

    Thanks...

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

    Default Re: Modified TextFinder example

    What did you already try?
    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
    Aug 2009
    Location
    Finland
    Posts
    6
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Modified TextFinder example

    I created a new TextEdit Widget and I managed to copy searchString there with

    ui->plainTextEdit->setPlainText(searchString);

    OK, I know how to use TextEdit Widget (whee! ) but that doesn´t help me much because printed text it is the search string not the found text.

    Also I managed to highlight rest of the line... so that highlighted text "version 3.0 as published by the Free Software" now includes the text "3.0" what i´m interested in. So the actual question is that what function i can use to copy the highlighted text?
    Last edited by LoomVortex; 25th August 2009 at 09:51.

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

    Default Re: Modified TextFinder example

    See QTextCursor interface.
    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. The following user says thank you to wysota for this useful post:

    LoomVortex (26th August 2009)

  6. #5
    Join Date
    Aug 2009
    Location
    Finland
    Posts
    6
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Modified TextFinder example

    Ok, it was easier than I expected.

    "QTextCursor::selectedText ()" did the job. Thanks!

Similar Threads

  1. Check file is modified?
    By mamyte03@gmail.com in forum Qt Programming
    Replies: 6
    Last Post: 20th September 2007, 13:03
  2. QDataTable to bloquer modified value
    By cristiano in forum Qt Programming
    Replies: 5
    Last Post: 17th January 2007, 00:58
  3. Retrieving modified date of file using QHttp
    By hardgeus in forum Qt Programming
    Replies: 9
    Last Post: 3rd December 2006, 23:20
  4. How to link modified file
    By awalesminfo in forum Newbie
    Replies: 4
    Last Post: 22nd March 2006, 17:24
  5. Modified tableview
    By dkite in forum Qt Programming
    Replies: 2
    Last Post: 14th March 2006, 01:58

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
  •  
Qt is a trademark of The Qt Company.