12#include "ktextwidgets_export.h"
93class KTEXTWIDGETS_EXPORT
KFind :
public QObject
107 RegularExpression = 32,
108 FindIncremental = 64,
111 MinimumUserOption = 65536,
122 KFind(const QString &pattern,
long options, QWidget *parent);
130 KFind(const QString &pattern,
long options, QWidget *parent, QWidget *findDialog);
155 void setData(
const QString &data,
int startPos = -1);
168 void setData(
int id,
const QString &data,
int startPos = -1);
233 virtual bool validateMatch(
const QString &text,
int index,
int matchedlength);
248 virtual bool shouldRestart(
bool forceAsking =
false,
bool showNumMatches =
true)
const;
250#if KTEXTWIDGETS_ENABLE_DEPRECATED_SINCE(5, 70)
267 KTEXTWIDGETS_DEPRECATED_VERSION(5,
269 "Use find(const QString &text, const QString &pattern, int index, long options, \
270 int *matchedLength, QRegularExpressionMatch *rmatch).")
271 static
int find(const QString &text, const QString &pattern,
int index,
long options,
int *matchedlength);
274#if KTEXTWIDGETS_ENABLE_DEPRECATED_SINCE(5, 70)
278 KTEXTWIDGETS_DEPRECATED_VERSION_BELATED(5,
282 "Use find(const QString &, const QString &, int, long, \
283 int *, QRegularExpressionMatch *).")
284 static
int find(const QString &text, const QRegExp &pattern,
int index,
long options,
int *matchedlength);
309 static int find(
const QString &text,
const QString &pattern,
int index,
long options,
int *matchedLength, QRegularExpressionMatch *rmatch);
345#if KTEXTWIDGETS_ENABLE_DEPRECATED_SINCE(5, 81)
361 KTEXTWIDGETS_DEPRECATED_VERSION(5, 81,
"Use the KFind::textFound(const QString &, int, int) signal instead.")
362 void highlight(const QString &text,
int matchingIndex,
int matchedLength);
379 void textFound(
const QString &text,
int matchingIndex,
int matchedLength);
381#if KTEXTWIDGETS_ENABLE_DEPRECATED_SINCE(5, 81)
397 KTEXTWIDGETS_DEPRECATED_VERSION(5, 81,
"Use the KFind::textFoundAtId(int id, int matchingIndex, int matchedLength) signal instead.")
398 void highlight(
int id,
int matchingIndex,
int matchedLength);
439 QWidget *parentWidget()
const;
440 QWidget *dialogsParent()
const;
443 KTEXTWIDGETS_NO_EXPORT
KFind(KFindPrivate &dd,
const QString &pattern,
long options, QWidget *parent);
444 KTEXTWIDGETS_NO_EXPORT
KFind(KFindPrivate &dd,
const QString &pattern,
long options, QWidget *parent, QWidget *findDialog);
448 Q_DECLARE_PRIVATE_D(d,
KFind)
449 std::unique_ptr<class KFindPrivate>
const d;
A generic implementation of the "find" function.
Definition kfind.h:94
void setData(int id, const QString &data, int startPos=-1)
Call this when needData returns true, before calling find().
virtual void displayFinalDialog() const
Displays the final dialog saying "no match was found", if that was the case.
static int find(const QString &text, const QString &pattern, int index, long options, int *matchedLength, QRegularExpressionMatch *rmatch)
Search text for pattern.
virtual bool validateMatch(const QString &text, int index, int matchedlength)
Virtual method, which allows applications to add extra checks for validating a candidate match.
int numMatches() const
Returns the number of matches found (i.e.
void textFound(const QString &text, int matchingIndex, int matchedLength)
Connect to this signal to implement highlighting of found text during the find operation.
virtual void setOptions(long options)
Set new options.
void setPattern(const QString &pattern)
Change the pattern we're looking for.
void closeFindNextDialog()
Close the "find next?" dialog.
void dialogClosed()
Emitted when the 'find next' dialog is being closed.
QFlags< Options > SearchOptions
Stores a combination of #Options values.
Definition kfind.h:116
void optionsChanged()
Emitted when the options have changed.
virtual bool shouldRestart(bool forceAsking=false, bool showNumMatches=true) const
Returns true if we should restart the search from scratch.
Result find()
Walk the text fragment (e.g.
Options
Definition kfind.h:101
void setData(const QString &data, int startPos=-1)
Call this when needData returns true, before calling find().
void textFoundAtId(int id, int matchingIndex, int matchedLength)
Connect to this signal to implement highlighting of found text during the find operation.
long options() const
Return the current options.
virtual void resetCounts()
Call this to reset the numMatches count (and the numReplacements count for a KReplace).
QDialog * findNextDialog(bool create=false)
Return (or create) the dialog that shows the "find next?" prompt.
A generic implementation of the "replace" function.
Definition kreplace.h:90