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>
This commit is contained in:
Lars Knoll 2020-09-17 13:27:54 +02:00 committed by Karsten Heimrich
parent 848927b688
commit f91531a056

View File

@ -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) {