QDocumentSearch Class Reference
[Document related classes]

An helper class to perform search in document. More...

List of all members.
 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)


Detailed Description

An helper class to perform search in document.

QDocumentSearch offer means to perform complex search in documents.


Member Function Documentation

QDocumentCursor QDocumentSearch::cursor (  )  const

Returns:
The current cursor position
This is useful to examine matches after performing a search.

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 
)

QDocumentCursor QDocumentSearch::origin (  )  const

Returns:
The current cursor position
This is useful to examine matches after performing a search.

QString QDocumentSearch::replaceText (  )  const

Returns:
the replacement text

QDocumentCursor QDocumentSearch::scope (  )  const

Returns:
The scope of the search
An invalid cursor indicate that the scope is the whole document, otherwise the scope is the selection of the returned cursor.

QString QDocumentSearch::searchText (  )  const

Returns:
The search pattern

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 
)

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().


The documentation for this class was generated from the following files:

Generated on Sun Feb 15 22:50:20 2009 for QCodeEdit by  doxygen 1.5.7.1