aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/qmltooling/qmldbg_preview/qqmlpreviewposition.cpp1
-rw-r--r--src/qml/jsapi/qjsvalue.cpp2
-rw-r--r--src/qml/jsruntime/qv4engine.cpp6
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp14
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp2
-rw-r--r--src/qml/parser/qqmljsast.cpp1
-rw-r--r--src/qml/qml/qqmlboundsignal.cpp2
-rw-r--r--src/qml/qml/qqmlproperty.cpp6
-rw-r--r--src/qml/qml/qqmlvaluetype.cpp2
-rw-r--r--src/qml/qml/qqmlvaluetypewrapper.cpp4
-rw-r--r--src/qml/qml/qqmlvmemetaobject.cpp4
-rw-r--r--src/quick/items/qquickrendercontrol.h1
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp14
13 files changed, 31 insertions, 28 deletions
diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewposition.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewposition.cpp
index 52e197b1ed..47bb64140f 100644
--- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewposition.cpp
+++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewposition.cpp
@@ -42,6 +42,7 @@
#include <QtGui/qwindow.h>
#include <QtGui/qscreen.h>
#include <QtGui/qguiapplication.h>
+#include <QtCore/QIODevice>
#include <private/qhighdpiscaling_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp
index 1122700334..a3cf034096 100644
--- a/src/qml/jsapi/qjsvalue.cpp
+++ b/src/qml/jsapi/qjsvalue.cpp
@@ -579,7 +579,7 @@ QVariant QJSValue::toVariant() const
if (val.isUndefined())
return QVariant();
if (val.isNull())
- return QVariant(QMetaType::Nullptr, nullptr);
+ return QVariant(QMetaType::fromType<std::nullptr_t>(), nullptr);
if (val.isBoolean())
return QVariant(val.booleanValue());
if (val.isInt32()) // Includes doubles that can be losslessly casted to int
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 4d4013db48..f40fc3b780 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -1568,7 +1568,7 @@ static QVariant toVariant(QV4::ExecutionEngine *e, const QV4::Value &value, int
// the QVariant constructor will create a copy, so we have manually
// destroy the value returned by QMetaType::create
auto temp = QMetaType::create(typeHint);
- retn = QVariant(typeHint, temp);
+ retn = QVariant(QMetaType(typeHint), temp);
QMetaType::destroy(typeHint, temp);
auto retnAsIterable = retn.value<QtMetaTypePrivate::QSequentialIterableImpl>();
if (retnAsIterable.containerCapabilities() & QtMetaTypePrivate::ContainerIsAppendable) {
@@ -1596,7 +1596,7 @@ static QVariant toVariant(QV4::ExecutionEngine *e, const QV4::Value &value, int
QString::fromUtf8(QMetaType::typeName(originalType)),
QString::fromUtf8(QMetaType::typeName(retnAsIterable._metaType_id)));
// create default constructed value
- asVariant = QVariant(retnAsIterable._metaType_id, nullptr);
+ asVariant = QVariant(QMetaType(retnAsIterable._metaType_id), nullptr);
}
retnAsIterable.append(asVariant.constData());
}
@@ -1913,7 +1913,7 @@ QV4::ReturnedValue ExecutionEngine::metaTypeToJS(int type, const void *data)
{
Q_ASSERT(data != nullptr);
- QVariant variant(type, data);
+ QVariant variant(QMetaType(type), data);
if (QMetaType::Type(variant.userType()) == QMetaType::QVariant) {
// unwrap it: this is tested in QJSEngine, and makes the most sense for
// end-user code too.
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index d37f80ab0a..edd323286a 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -200,7 +200,7 @@ static QV4::ReturnedValue loadProperty(QV4::ExecutionEngine *v4, QObject *object
"'%s::%s'", p.typeName(), object->metaObject()->className(), p.name());
return QV4::Encode::undefined();
} else {
- QVariant v(property.propType(), (void *)nullptr);
+ QVariant v(QMetaType(property.propType()), (void *)nullptr);
property.readProperty(object, v.data());
return scope.engine->fromVariant(v);
}
@@ -956,7 +956,7 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
if (type == qMetaTypeId<QVariant>()) {
jsCallData->args[ii] = v4->fromVariant(*((QVariant *)metaArgs[ii + 1]));
} else {
- jsCallData->args[ii] = v4->fromVariant(QVariant(type, metaArgs[ii + 1]));
+ jsCallData->args[ii] = v4->fromVariant(QVariant(QMetaType(type), metaArgs[ii + 1]));
}
}
@@ -1775,7 +1775,7 @@ void CallArgument::initAsType(int callType)
jsonValuePtr = new (&allocData) QJsonValue();
} else {
type = -1;
- qvariantPtr = new (&allocData) QVariant(callType, (void *)nullptr);
+ qvariantPtr = new (&allocData) QVariant(QMetaType(callType), (void *)nullptr);
}
}
@@ -1916,7 +1916,7 @@ bool CallArgument::fromValue(int callType, QV4::ExecutionEngine *engine, const Q
& (QMetaType::PointerToQObject | QMetaType::PointerToGadget)) {
// You can assign null or undefined to any pointer. The result is a nullptr.
if (value.isNull() || value.isUndefined()) {
- qvariantPtr = new (&allocData) QVariant(callType, nullptr);
+ qvariantPtr = new (&allocData) QVariant(QMetaType(callType), nullptr);
type = callType;
} else {
queryEngine = true;
@@ -1943,15 +1943,15 @@ bool CallArgument::fromValue(int callType, QV4::ExecutionEngine *engine, const Q
QObject *obj = ep->toQObject(v);
if (obj != nullptr && !QQmlMetaObject::canConvert(obj, mo)) {
- *qvariantPtr = QVariant(callType, nullptr);
+ *qvariantPtr = QVariant(QMetaType(callType), nullptr);
return false;
}
- *qvariantPtr = QVariant(callType, &obj);
+ *qvariantPtr = QVariant(QMetaType(callType), &obj);
return true;
}
- *qvariantPtr = QVariant(callType, (void *)nullptr);
+ *qvariantPtr = QVariant(QMetaType(callType), (void *)nullptr);
return false;
}
}
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index 7772b34c82..5bb82aeadf 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -463,7 +463,7 @@ ReturnedValue VME::exec(CppStackFrame *frame, ExecutionEngine *engine)
Scope scope(engine);
Scoped<QmlContext> qmlContext(scope, engine->qmlContext());
- QVariant resultVariant(function->aotFunction->returnType.id(), nullptr);
+ QVariant resultVariant(function->aotFunction->returnType, nullptr);
function->aotFunction->functionPtr(qmlContext->qmlContext()->asQQmlContext(), qmlContext->qmlScope(), resultVariant.data());
result = engine->fromVariant(resultVariant);
} else {
diff --git a/src/qml/parser/qqmljsast.cpp b/src/qml/parser/qqmljsast.cpp
index f1f6102297..9885875499 100644
--- a/src/qml/parser/qqmljsast.cpp
+++ b/src/qml/parser/qqmljsast.cpp
@@ -37,6 +37,7 @@
**
****************************************************************************/
+#include <QLocale>
#include "qqmljsast_p.h"
#include "qqmljsastvisitor_p.h"
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp
index a818f0e944..b34ab18a72 100644
--- a/src/qml/qml/qqmlboundsignal.cpp
+++ b/src/qml/qml/qqmlboundsignal.cpp
@@ -214,7 +214,7 @@ void QQmlBoundSignalExpression::evaluate(void **a)
else
jsCall->args[ii] = QV4::QObjectWrapper::wrap(v4, *reinterpret_cast<QObject* const *>(a[ii + 1]));
} else {
- jsCall->args[ii] = scope.engine->fromVariant(QVariant(type, a[ii + 1]));
+ jsCall->args[ii] = scope.engine->fromVariant(QVariant(QMetaType(type), a[ii + 1]));
}
}
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index 5a2c87f221..0de097e81e 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -1088,12 +1088,12 @@ QVariant QQmlPropertyPrivate::readValueProperty()
if (core.propType() == QMetaType::QVariant) {
args[0] = &value;
} else {
- value = QVariant(core.propType(), (void*)nullptr);
+ value = QVariant(QMetaType(core.propType()), (void*)nullptr);
args[0] = value.data();
}
core.readPropertyWithArgs(object, args);
if (core.propType() != QMetaType::QVariant && args[0] != value.data())
- return QVariant((QVariant::Type)core.propType(), args[0]);
+ return QVariant(QMetaType(core.propType()), args[0]);
return value;
}
@@ -1244,7 +1244,7 @@ bool QQmlPropertyPrivate::write(
// This reflects the fact that you can assign a nullptr to a QObject pointer
// Without the change to QObjectStar, rawMetaObjectForType would not give us a QQmlMetaObject
varType = QMetaType::QObjectStar;
- val = QVariant(QMetaType::QObjectStar, nullptr);
+ val = QVariant(QMetaType::fromType<QObject *>(), nullptr);
}
QQmlMetaObject valMo = rawMetaObjectForType(enginePriv, varType);
if (valMo.isNull())
diff --git a/src/qml/qml/qqmlvaluetype.cpp b/src/qml/qml/qqmlvaluetype.cpp
index f326e86e64..d385013ff4 100644
--- a/src/qml/qml/qqmlvaluetype.cpp
+++ b/src/qml/qml/qqmlvaluetype.cpp
@@ -265,7 +265,7 @@ void QQmlGadgetPtrWrapper::write(QObject *obj, int idx, QQmlPropertyData::WriteF
QVariant QQmlGadgetPtrWrapper::value()
{
Q_ASSERT(m_gadgetPtr);
- return QVariant(metaTypeId(), m_gadgetPtr);
+ return QVariant(QMetaType(metaTypeId()), m_gadgetPtr);
}
void QQmlGadgetPtrWrapper::setValue(const QVariant &value)
diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp
index cfd9374b8a..272b8ebfc7 100644
--- a/src/qml/qml/qqmlvaluetypewrapper.cpp
+++ b/src/qml/qml/qqmlvaluetypewrapper.cpp
@@ -122,7 +122,7 @@ void Heap::QQmlValueTypeWrapper::setValue(const QVariant &value) const
QVariant Heap::QQmlValueTypeWrapper::toVariant() const
{
Q_ASSERT(gadgetPtr());
- return QVariant(valueType()->metaType.id(), gadgetPtr());
+ return QVariant(valueType()->metaType, gadgetPtr());
}
@@ -460,7 +460,7 @@ Q_ALWAYS_INLINE static ReturnedValue getGadgetProperty(ExecutionEngine *engine,
if (property->propType() == QMetaType::QVariant) {
args[0] = &v;
} else {
- v = QVariant(property->propType(), static_cast<void *>(nullptr));
+ v = QVariant(QMetaType(property->propType()), static_cast<void *>(nullptr));
args[0] = v.data();
}
metaObject->d.static_metacall(reinterpret_cast<QObject*>(valueTypeWrapper->gadgetPtr()), QMetaObject::ReadProperty,
diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp
index 9af7e539e3..fbfc387cc6 100644
--- a/src/qml/qml/qqmlvmemetaobject.cpp
+++ b/src/qml/qml/qqmlvmemetaobject.cpp
@@ -361,7 +361,7 @@ bool QQmlInterceptorMetaObject::intercept(QMetaObject::Call c, int id, void **a)
//
QMetaProperty valueProp = valueType->property(valueIndex);
- QVariant newValue(type, a[0]);
+ QVariant newValue(QMetaType(type), a[0]);
valueType->read(object, id);
QVariant prevComponentValue = valueProp.read(valueType);
@@ -382,7 +382,7 @@ bool QQmlInterceptorMetaObject::intercept(QMetaObject::Call c, int id, void **a)
if (updated)
return true;
} else {
- vi->write(QVariant(type, a[0]));
+ vi->write(QVariant(QMetaType(type), a[0]));
return true;
}
}
diff --git a/src/quick/items/qquickrendercontrol.h b/src/quick/items/qquickrendercontrol.h
index 6284203be3..81e5417f19 100644
--- a/src/quick/items/qquickrendercontrol.h
+++ b/src/quick/items/qquickrendercontrol.h
@@ -42,6 +42,7 @@
#include <QtQuick/qtquickglobal.h>
#include <QtGui/qimage.h>
+#include <QObject>
QT_BEGIN_NAMESPACE
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index ed6e6be398..8ac1e14e52 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -514,8 +514,8 @@ void tst_QJSEngine::toScriptValue_data()
{
QTest::addColumn<QVariant>("input");
- QTest::newRow("UnknownType") << QVariant(int(QMetaType::UnknownType), nullptr);
- QTest::newRow("Nullptr") << QVariant(int(QMetaType::Nullptr), nullptr);
+ QTest::newRow("UnknownType") << QVariant(QMetaType(QMetaType::UnknownType), nullptr);
+ QTest::newRow("Nullptr") << QVariant(QMetaType(QMetaType::Nullptr), nullptr);
QTest::newRow("true") << QVariant(true);
QTest::newRow("false") << QVariant(false);
QTest::newRow("int") << QVariant(int(42));
@@ -577,7 +577,7 @@ void tst_QJSEngine::toScriptValuenotroundtripped_data()
QTest::newRow("QObjectList") << QVariant::fromValue(QObjectList() << this) << QVariant(QVariantList() << QVariant::fromValue<QObject *>(this));
QTest::newRow("QList<QPoint>") << QVariant::fromValue(QList<QPointF>() << QPointF(42.24, 24.42) << QPointF(42.24, 24.42)) << QVariant(QVariantList() << QPointF(42.24, 24.42) << QPointF(42.24, 24.42));
QTest::newRow("QVector<QPoint>") << QVariant::fromValue(QVector<QPointF>() << QPointF(42.24, 24.42) << QPointF(42.24, 24.42)) << QVariant(QVariantList() << QPointF(42.24, 24.42) << QPointF(42.24, 24.42));
- QTest::newRow("VoidStar") << QVariant(int(QMetaType::VoidStar), nullptr) << QVariant(int(QMetaType::Nullptr), nullptr);
+ QTest::newRow("VoidStar") << QVariant(QMetaType(QMetaType::VoidStar), nullptr) << QVariant(QMetaType(QMetaType::Nullptr), nullptr);
}
// This is almost the same as toScriptValue, but the inputs don't roundtrip to
@@ -1568,7 +1568,7 @@ void tst_QJSEngine::valueConversion_QVariant()
// Checking nested QVariants
{
QVariant tmp1;
- QVariant tmp2(QMetaType::QVariant, &tmp1);
+ QVariant tmp2(QMetaType::fromType<QVariant>(), &tmp1);
QCOMPARE(QMetaType::Type(tmp2.userType()), QMetaType::QVariant);
QJSValue val1 = eng.toScriptValue(tmp1);
@@ -1582,8 +1582,8 @@ void tst_QJSEngine::valueConversion_QVariant()
}
{
QVariant tmp1(123);
- QVariant tmp2(QMetaType::QVariant, &tmp1);
- QVariant tmp3(QMetaType::QVariant, &tmp2);
+ QVariant tmp2(QMetaType::fromType<QVariant>(), &tmp1);
+ QVariant tmp3(QMetaType::fromType<QVariant>(), &tmp2);
QCOMPARE(QMetaType::Type(tmp1.userType()), QMetaType::Int);
QCOMPARE(QMetaType::Type(tmp2.userType()), QMetaType::QVariant);
QCOMPARE(QMetaType::Type(tmp3.userType()), QMetaType::QVariant);
@@ -1639,7 +1639,7 @@ void tst_QJSEngine::valueConversion_QVariant()
QCOMPARE(qjsvalue_cast<QVariant>(QJSValue(123)), QVariant(123));
- QVERIFY(eng.toScriptValue(QVariant(QMetaType::VoidStar, nullptr)).isNull());
+ QVERIFY(eng.toScriptValue(QVariant(QMetaType::fromType<void *>(), nullptr)).isNull());
QVERIFY(eng.toScriptValue(QVariant::fromValue(nullptr)).isNull());
{