diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-09-17 13:27:54 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@qt.io> | 2020-09-21 14:57:27 +0200 |
commit | f91531a056740c2e3a9b2ead8cd6c3456d7cb99f (patch) | |
tree | 6b6ee6b64c7ad7930256f722f0fe893307fed1e4 | |
parent | 848927b688d4709d0b71590518e2c32fe7866147 (diff) |
Fix a bug when streaming QVariants containing a QRegExp
Fix a logic error. QRegExp is a UserType in Qt 6 and we need to
check for it in the right place.
Fixes an autotest failure in the qregexp autotest in qt5compat.
Change-Id: I454cfcfd12b36f756b24b69a5412455db9dccbe7
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
-rw-r--r-- | src/corelib/kernel/qvariant.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 65cdfc8580..efc90595bf 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -1248,6 +1248,9 @@ void QVariant::save(QDataStream &s) const // map to Qt 5 values if (typeId == QMetaType::User) { typeId = Qt5UserType; + if (!strcmp(d.type().name(), "QRegExp")) { + typeId = 27; // QRegExp in Qt 4/5 + } } else if (typeId > Qt5LastCoreType && typeId <= QMetaType::LastCoreType) { // the type didn't exist in Qt 5 typeId = Qt5UserType; @@ -1260,10 +1263,6 @@ void QVariant::save(QDataStream &s) const } } else if (typeId == QMetaType::QSizePolicy) { typeId = Qt5SizePolicy; - } else if (saveAsUserType) { - if (!strcmp(d.type().name(), "QRegExp")) { - typeId = 27; // QRegExp in Qt 4/5 - } } } if (s.version() < QDataStream::Qt_4_0) { |