diff options
author | Christian Loose <christian.loose@hamburg.de> | 2014-01-27 12:27:38 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-31 21:51:35 +0100 |
commit | f40c28f91514356155a42f44f9eb69c7faa83eec (patch) | |
tree | 9d9c66652dd2294378e9cb2bbe1aeaca7861ea5f /src/widgets/widgets/qplaintextedit.cpp | |
parent | 17678bee8912b33219bbc1e4e5ce2b82f61744b2 (diff) |
Q(Plain)TextEdit: Add find() overload with QRegExp
Add overloads to the find() methods in QPlainTextEdit and QTextEdit
that find the next occurrence matching the passed regular expression.
These are convenience methods that eliminate the need to use the
document() method and the need to handle the QTextCursor return value.
[ChangeLog][QtWidgets][QPlainTextEdit] Added find method overload using QRegExp
[ChangeLog][QtWidgets][QTextEdit] Added find method overload using QRegExp
Change-Id: Ia6139b771e3ae4ca02e4b8ea7fde19e5dc71b9d8
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/widgets/widgets/qplaintextedit.cpp')
-rw-r--r-- | src/widgets/widgets/qplaintextedit.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index d67e4735b3..6b9e2640db 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -2799,6 +2799,27 @@ bool QPlainTextEdit::find(const QString &exp, QTextDocument::FindFlags options) } /*! + \fn bool QPlainTextEdit::find(const QRegExp &exp, QTextDocument::FindFlags options) + + \since 5.3 + \overload + + Finds the next occurrence, matching the regular expression, \a exp, using the given + \a options. The QTextDocument::FindCaseSensitively option is ignored for this overload, + use QRegExp::caseSensitivity instead. + + Returns \c true if a match was found and changes the cursor to select the match; + otherwise returns \c false. +*/ +#ifndef QT_NO_REGEXP +bool QPlainTextEdit::find(const QRegExp &exp, QTextDocument::FindFlags options) +{ + Q_D(QPlainTextEdit); + return d->control->find(exp, options); +} +#endif + +/*! \fn void QPlainTextEdit::copyAvailable(bool yes) This signal is emitted when text is selected or de-selected in the |