14#include "ktextwidgets_export.h"
98 KReplace(
const QString &pattern,
const QString &replacement,
long options, QWidget *parent =
nullptr);
105 KReplace(
const QString &pattern,
const QString &replacement,
long options, QWidget *parent, QWidget *replaceDialog);
161 static int replace(QString &text,
const QString &pattern,
const QString &replacement,
int index,
long options,
int *replacedLength);
163#if KTEXTWIDGETS_ENABLE_DEPRECATED_SINCE(5, 70)
177 static int replace(QString &text,
const QRegExp &pattern,
const QString &replacement,
int index,
long options,
int *replacedLength);
194 bool shouldRestart(
bool forceAsking =
false,
bool showNumMatches =
true)
const override;
203#if KTEXTWIDGETS_ENABLE_DEPRECATED_SINCE(5, 83)
220 KTEXTWIDGETS_DEPRECATED_VERSION(5, 83,
"Use the KReplace::textReplaced(const QString &, int, int, int) signal instead.")
221 void replace(const QString &text,
int replacementIndex,
int replacedLength,
int matchedLength);
240 void textReplaced(
const QString &text,
int replacementIndex,
int replacedLength,
int matchedLength);
243 Q_DECLARE_PRIVATE_D(KFind::d,
KReplace)
244#if KTEXTWIDGETS_BUILD_DEPRECATED_SINCE(5, 79)
246 QT_WARNING_DISABLE_CLANG(
"-Wunused-private-field")
248 const
void *__ktextwidgets_d_do_not_use;
A generic implementation of the "find" function.
Definition kfind.h:94
A generic implementation of the "replace" function.
Definition kreplace.h:90
void resetCounts() override
Call this to reset the numMatches & numReplacements counts.
QDialog * replaceNextDialog(bool create=false)
Return (or create) the dialog that shows the "find next?" prompt.
void textReplaced(const QString &text, int replacementIndex, int replacedLength, int matchedLength)
Connect to this signal to implement updating of replaced text during the replace operation.
KReplace(const QString &pattern, const QString &replacement, long options, QWidget *parent, QWidget *replaceDialog)
This is the recommended constructor if you also use KReplaceDialog (non-modal).
int numReplacements() const
Return the number of replacements made (i.e.
Result replace()
Walk the text fragment (e.g.
void closeReplaceNextDialog()
Close the "replace next?" dialog.
bool shouldRestart(bool forceAsking=false, bool showNumMatches=true) const override
Returns true if we should restart the search from scratch.
static int replace(QString &text, const QString &pattern, const QString &replacement, int index, long options, int *replacedLength)
Searches the given text for pattern; if a match is found it is replaced with replacement and the inde...
void displayFinalDialog() const override
Displays the final dialog telling the user how many replacements were made.
KReplace(const QString &pattern, const QString &replacement, long options, QWidget *parent=nullptr)
Only use this constructor if you don't use KFindDialog, or if you use it as a modal dialog.