| QDocumentSearch (QEditor *e, const QString &f, Options opt, const QString &r=QString()) | |
| int | indexedMatchCount () const |
| Number of availables indexed matches. | |
| QString | searchText () const |
| void | setSearchText (const QString &f) |
| Set the search pattern. | |
| bool | hasOption (Option opt) const |
| Test whether a given option is enabled. | |
| void | setOption (Option opt, bool on) |
| Set a search option. | |
| QString | replaceText () const |
| void | setReplaceText (const QString &r) |
| Set the replacement text. | |
| QDocumentCursor | origin () const |
| void | setOrigin (const QDocumentCursor &c) |
| Set the cursor. | |
| QDocumentCursor | cursor () const |
| void | setCursor (const QDocumentCursor &c) |
| Set the cursor. | |
| QDocumentCursor | scope () const |
| void | setScope (const QDocumentCursor &c) |
| Set the search scope. | |
| void | next (bool backward, bool all=false) |
| Perform a search. | |
Public Types | |
| enum | Option { WholeWords = 1, CaseSensitive = 2, RegExp = 4, Replace = 8, Prompt = 16, Silent = 32, HighlightAll = 64 } |
Public Member Functions | |
| Q_DECLARE_FLAGS (Options, Option) | |
QDocumentSearch offer means to perform complex search in documents.
| QDocumentCursor QDocumentSearch::cursor | ( | ) | const |
| int QDocumentSearch::indexedMatchCount | ( | ) | const |
Number of availables indexed matches.
Indexed matches are only available when the whole scope is searched, i.e when either the HighlightAll option is set to true or when next() is called with the all parameter set to true.
Referenced by next(), and setOption().
| void QDocumentSearch::next | ( | bool | backward, | |
| bool | all = false | |||
| ) |
Perform a search.
| backward | whether to go backward or forward | |
| all | if true, the whole document will be searched first, all matches recorded and available for further navigation |
References QDocument::addMatch(), QDocumentCursor::anchorColumnNumber(), QDocumentCursor::beginEditBlock(), QDocumentCursor::columnNumber(), QDocumentCursor::document(), QDocumentCursor::endEditBlock(), QDocument::formatScheme(), QDocument::getNextGroupId(), hasOption(), QDocumentCursor::hasSelection(), QFormatScheme::id(), indexedMatchCount(), QDocumentCursor::insertText(), QDocumentCursor::isNull(), QDocumentCursor::isValid(), QDocumentCursor::line(), QDocumentCursor::lineNumber(), QDocumentCursor::movePosition(), QDocumentCursor::removeSelectedText(), QDocumentCursor::selection(), QDocumentCursor::selectionEnd(), QDocumentCursor::selectionStart(), QDocumentCursor::setColumnNumber(), and QDocumentLine::text().
| QDocumentCursor QDocumentSearch::origin | ( | ) | const |
| QString QDocumentSearch::replaceText | ( | ) | const |
| QDocumentCursor QDocumentSearch::scope | ( | ) | const |
| QString QDocumentSearch::searchText | ( | ) | const |
| void QDocumentSearch::setCursor | ( | const QDocumentCursor & | c | ) |
Set the cursor.
If the related option is set, search will start from that cursor position
| void QDocumentSearch::setOption | ( | Option | opt, | |
| bool | on | |||
| ) |
Set a search option.
| opt | option to set | |
| on | whether to enable the option |
References QDocument::addMatch(), QDocumentCursor::anchorColumnNumber(), QDocument::clearMatches(), QDocumentCursor::columnNumber(), QDocument::flushMatches(), QDocument::formatScheme(), QDocument::getNextGroupId(), QFormatScheme::id(), indexedMatchCount(), and QDocumentCursor::lineNumber().
| void QDocumentSearch::setOrigin | ( | const QDocumentCursor & | c | ) |
Set the cursor.
If the related option is set, search will start from that cursor position
This also changes the cursor()
| void QDocumentSearch::setScope | ( | const QDocumentCursor & | c | ) |
Set the search scope.
If the given cursor has no selection (a fortiori if it is invalid) then the scope is the whole document.
References QDocumentCursor::hasSelection().
1.5.7.1