Results 1 to 2 of 2

Thread: QTextCursor

  1. #1
    Join Date
    May 2009
    Posts
    94
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default QTextCursor

    1. QTextCursor QTextDocument::find ( const QString & subString, const QTextCursor & cursor, FindFlags options = 0 ) const

    Returns a cursor with the match selected if subString was found; otherwise returns a null cursor.

    How can we check that the cursor is a null cursor or the cursor of the selected substring.
    if(cursor) ---giving error.

  2. #2
    Join Date
    May 2009
    Posts
    62
    Thanks
    2
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTextCursor

    Use QTextCursor::isNull:


    Qt Code:
    1. QTextCursor cursor = textDocument->find( /* ... */ );
    2. if (!cursor.isNull())
    3. {
    4. // text found!
    5. }
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to shentian for this useful post:

    bismitapadhy (18th June 2009)

Similar Threads

  1. Replies: 1
    Last Post: 11th April 2009, 23:27
  2. QTextCursor and QScriptEngine
    By roxton in forum Qt Programming
    Replies: 1
    Last Post: 31st October 2008, 20:47
  3. Replies: 1
    Last Post: 1st June 2008, 12:04
  4. QTextCursor select part of a word?
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 13th February 2008, 18:01
  5. a annoying problem about QTextCursor
    By kaos33 in forum Qt Programming
    Replies: 1
    Last Post: 31st August 2006, 06:00

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.