diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-04-03 20:58:30 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-05-14 12:19:47 +0000 |
commit | 45ed28a9d3790707b18798454d976f3a818a7740 (patch) | |
tree | a757ffb39ed2a9a5891cb56affc81db9617f7a68 /src/corelib/text/qregexp.cpp | |
parent | b2ee684a13d01363c121d3ba597feaf274786fdb (diff) |
Remove QRegExp from QVariant
Add an operator QVariant() to QRegExp to keep things at source compatible
as possible.
Add a hack to QVariant::load/save() to recognize the old typeid
for QRegExp and stream them correctly as long as the streaming operators
for QRegExp are registered.
Also move the datastream test for QRegExp to tst_qregexp, and adjust it to
the qvariant changes.
Change-Id: I120b38a7541b43ec07a21b17f7f35c55f071eb75
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/text/qregexp.cpp')
-rw-r--r-- | src/corelib/text/qregexp.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/corelib/text/qregexp.cpp b/src/corelib/text/qregexp.cpp index 85086c7a40..9ae96a805e 100644 --- a/src/corelib/text/qregexp.cpp +++ b/src/corelib/text/qregexp.cpp @@ -4388,6 +4388,18 @@ bool QRegExp::exactMatch(const QString &str) const } } +/*! + Returns the regexp as a QVariant +*/ +QRegExp::operator QVariant() const +{ +QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED + QVariant v; + v.setValue(*this); + return v; +QT_WARNING_POP +} + // ### Qt 5: make non-const /*! Attempts to find a match in \a str from position \a offset (0 by |