Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

QTextCursor QTextDocument::find ( const QRegExp expr,
const QTextCursor cursor,
FindFlags  options = 0 
) const

Finds the next occurrence, matching the regular expression, expr, in the document. The search starts at the position of the given cursor, and proceeds forwards through the document unless specified otherwise in the search options. The options control the type of search performed. The FindCaseSensitively option is ignored for this overload, use QRegExp::caseSensitivity instead.

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

If the given cursor has a selection, the search begins after the selection; otherwise it begins at the cursor's position.

By default the search is case-sensitive, and can match text anywhere in the document.

Definition at line 1116 of file qtextdocument.cpp.

References find(), QTextCursor::isNull(), QTextCursor::selectionEnd(), and QTextCursor::selectionStart().

{
    int pos = 0;
    if (!from.isNull()) {
        if (options & QTextDocument::FindBackward)
            pos = from.selectionStart();
        else
            pos = from.selectionEnd();
    }
    return find(expr, pos, options);
}


Generated by  Doxygen 1.6.0   Back to index