KoFind Class Reference
A generic implementation of the "find" function. More...
#include <koFind.h>
Inheritance diagram for KoFind:


Signals | |
void | highlight (const QString &text, int matchingIndex, int matchedLength, const QRect &expose) |
Public Member Functions | |
KoFind (const QString &pattern, long options, QWidget *parent=0) | |
~KoFind () | |
bool | find (const QString &text, const QRect &expose) |
Walk the text fragment (e.g. | |
virtual bool | validateMatch (const QString &, int, int) |
void | abort () |
Abort the current find process. | |
Static Public Member Functions | |
int | find (const QString &text, const QString &pattern, int index, long options, int *matchedlength) |
Search the given string, and returns whether a match was found. | |
int | find (const QString &text, const QRegExp &pattern, int index, long options, int *matchedlength) |
Private Slots | |
virtual void | slotUser1 () |
virtual void | slotClose () |
Static Private Member Functions | |
bool | isInWord (QChar ch) |
bool | isWholeWords (const QString &text, int starts, int matchedLength) |
Private Attributes | |
QString | m_pattern |
QRegExp * | m_regExp |
long | m_options |
QWidget * | m_parent |
unsigned | m_matches |
QString | m_text |
int | m_index |
QRect | m_expose |
int | m_matchedLength |
bool | m_cancelled |
KoFindPrivate * | d |
Detailed Description
A generic implementation of the "find" function.
- Author:
- S.R.Haque <srhaque@iee.org>
Example
To use the class to implement a complete find feature:
// This creates a find-next-prompt dialog if needed. dialog = new KoFind(find, options);
// Connect signals to code which handles highlighting // of found text. connect(dialog, SIGNAL( highlight( const QString &, int, int, const QRect & ) ), this, SLOT( highlight( const QString &, int, int, const QRect & ) ) );
// Loop over all the text fragments of our document or selection for (text chosen by option SelectedText and in a direction set by FindBackwards) // don't forget to honour FromCursor too { // Let KoFind inspect the text fragment, and display a dialog if a match is found if ( !dialog->find( text_fragment, region_to_expose ) ) break; // if cancelled by user } delete dialog;
Definition at line 260 of file koFind.h.
Constructor & Destructor Documentation
|
Definition at line 367 of file koFind.cpp. References m_cancelled, m_matches, m_options, m_parent, m_pattern, m_regExp, and KDialogBase::setMainWidget(). |
|
Definition at line 388 of file koFind.cpp. References KMessageBox::information(), m_matches, and m_parent. |
Member Function Documentation
|
Abort the current find process. Call this when the parent widget is getting destroyed. Definition at line 400 of file koFind.cpp. References slotClose(). Referenced by QEditorView::doFind(). |
|
Definition at line 514 of file koFind.cpp. References isWholeWords(), and text(). |
|
Search the given string, and returns whether a match was found. If one is, the length of the string matched is also returned. A performance optimised version of the function is provided for use with regular expressions.
Definition at line 444 of file koFind.cpp. References find(), isWholeWords(), and text(). |
|
Walk the text fragment (e.g. kwrite line, kspread cell) looking for matches. For each match, emits the expose() signal and displays the find-again dialog proceeding.
Definition at line 405 of file koFind.cpp. References highlight(), m_expose, m_index, m_matchedLength, m_options, m_pattern, m_regExp, m_text, text(), and validateMatch(). Referenced by find(), QEditorView::process(), and KoReplace::replace(). |
|
Referenced by find(). |
|
Definition at line 580 of file koFind.cpp. Referenced by isWholeWords(). |
|
Definition at line 585 of file koFind.cpp. References isInWord(), and text(). Referenced by find(). |
|
Reimplemented from KDialogBase. Definition at line 394 of file koFind.cpp. References m_cancelled. Referenced by abort(). |
|
Reimplemented from KDialogBase. Definition at line 598 of file koFind.cpp. |
|
Definition at line 282 of file koFind.h. Referenced by find(). |
Member Data Documentation
|
|
|
Definition at line 324 of file koFind.h. Referenced by KoFind(), and slotClose(). |
|
Definition at line 322 of file koFind.h. Referenced by find(). |
|
Definition at line 321 of file koFind.h. Referenced by find(), and slotUser1(). |
|
Definition at line 323 of file koFind.h. Referenced by find(). |
|
Definition at line 319 of file koFind.h. Referenced by KoFind(), slotUser1(), and ~KoFind(). |
|
Definition at line 317 of file koFind.h. Referenced by find(), KoFind(), and slotUser1(). |
|
|
|
|
|
|
|
Definition at line 320 of file koFind.h. Referenced by find(). |
The documentation for this class was generated from the following files:
- editors/qeditor/koFind.h
- editors/qeditor/koFind.cpp