Universally pass QMetaType by value

... and add Qt7 TODOs where we can't because of BC.

Change-Id: Idce8b677ae95231e1690ac4265dc6f06818052e7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Ulf Hermann 2021-06-07 14:54:20 +02:00
parent c2839843f2
commit 68b855c215
5 changed files with 9 additions and 4 deletions

View File

@ -122,12 +122,14 @@ public:
{
}
// ### Qt7: Pass QMetaType as value rather than const ref.
QAssociativeIterable(const QMetaAssociation &metaAssociation, const QMetaType &metaType,
void *iterable)
: QIterable(metaAssociation, metaType.alignOf(), iterable)
{
}
// ### Qt7: Pass QMetaType as value rather than const ref.
QAssociativeIterable(const QMetaAssociation &metaAssociation, const QMetaType &metaType,
const void *iterable)
: QIterable(metaAssociation, metaType.alignOf(), iterable)

View File

@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
namespace QIterablePrivate {
template<typename Callback>
static QVariant retrieveElement(const QMetaType &type, Callback callback)
static QVariant retrieveElement(QMetaType type, Callback callback)
{
QVariant v(type);
void *dataPtr;

View File

@ -115,12 +115,14 @@ public:
{
}
// ### Qt7: Pass QMetaType as value rather than const ref.
QSequentialIterable(const QMetaSequence &metaSequence, const QMetaType &metaType,
void *iterable)
: QIterable(metaSequence, metaType.alignOf(), iterable)
{
}
// ### Qt7: Pass QMetaType as value rather than const ref.
QSequentialIterable(const QMetaSequence &metaSequence, const QMetaType &metaType,
const void *iterable)
: QIterable(metaSequence, metaType.alignOf(), iterable)

View File

@ -666,6 +666,7 @@ namespace QtPrivate {
class Q_CORE_EXPORT QVariantTypeCoercer
{
public:
// ### Qt7: Pass QMetaType as value rather than const ref.
const void *convert(const QVariant &value, const QMetaType &type);
const void *coerce(const QVariant &value, const QMetaType &type);

View File

@ -738,7 +738,7 @@ void tst_QProperty::genericPropertyBinding()
{
QUntypedPropertyBinding doubleBinding(QMetaType::fromType<double>(),
[](const QMetaType &, void *) -> bool {
[](QMetaType , void *) -> bool {
Q_ASSERT(false);
return true;
}, QPropertyBindingSourceLocation());
@ -746,7 +746,7 @@ void tst_QProperty::genericPropertyBinding()
}
QUntypedPropertyBinding intBinding(QMetaType::fromType<int>(),
[](const QMetaType &metaType, void *dataPtr) -> bool {
[](QMetaType metaType, void *dataPtr) -> bool {
Q_ASSERT(metaType.id() == qMetaTypeId<int>());
int *intPtr = reinterpret_cast<int*>(dataPtr);
@ -766,7 +766,7 @@ void tst_QProperty::genericPropertyBindingBool()
QVERIFY(!property.value());
QUntypedPropertyBinding boolBinding(QMetaType::fromType<bool>(),
[](const QMetaType &, void *dataPtr) -> bool {
[](QMetaType, void *dataPtr) -> bool {
auto boolPtr = reinterpret_cast<bool *>(dataPtr);
*boolPtr = true;
return true;