aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-04-11 10:17:52 +0200
committerUlf Hermann <ulf.hermann@qt.io>2024-04-12 20:32:59 +0200
commit99c7fe45be00b694da4041c5a06e5484f2985dc6 (patch)
tree9e8a9d6cf436ae5f49a12249cf0ae0b160403ea3 /src/qml/qml
parent235bbe8c644415a83e3f5103eff7c4ef4181164a (diff)
QtQml: Add a wrapper builtin for QQmlV4Function*
This way qmltyperegistrar can recognize it and refrain from warning about it. Task-number: QTBUG-101143 Change-Id: I598140e7e90dbd3e27a78c26eff3d46f0fd3e989 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml')
-rw-r--r--src/qml/qml/qqmlbuiltinfunctions.cpp2
-rw-r--r--src/qml/qml/qqmlbuiltinfunctions_p.h2
-rw-r--r--src/qml/qml/qqmlcomponent.cpp4
-rw-r--r--src/qml/qml/qqmlcomponent.h5
-rw-r--r--src/qml/qml/qqmldelayedcallqueue.cpp4
-rw-r--r--src/qml/qml/qqmldelayedcallqueue_p.h6
-rw-r--r--src/qml/qml/qqmllocale.cpp4
-rw-r--r--src/qml/qml/qqmllocale_p.h4
-rw-r--r--src/qml/qml/qqmlprivate.h5
-rw-r--r--src/qml/qml/qqmlpropertycache.cpp2
-rw-r--r--src/qml/qml/qqmlpropertydata_p.h2
11 files changed, 21 insertions, 19 deletions
diff --git a/src/qml/qml/qqmlbuiltinfunctions.cpp b/src/qml/qml/qqmlbuiltinfunctions.cpp
index 9e07879833..5c6daa0969 100644
--- a/src/qml/qml/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/qqmlbuiltinfunctions.cpp
@@ -1688,7 +1688,7 @@ QJSValue QtObject::binding(const QJSValue &function) const
Encode(e->memoryManager->allocate<QQmlBindingFunction>(f)));
}
-void QtObject::callLater(QQmlV4Function *args)
+void QtObject::callLater(QQmlV4FunctionPtr args)
{
m_engine->delayedCallQueue()->addUniquelyAndExecuteLater(m_engine, args);
}
diff --git a/src/qml/qml/qqmlbuiltinfunctions_p.h b/src/qml/qml/qqmlbuiltinfunctions_p.h
index 5a49db62aa..9ceedad28b 100644
--- a/src/qml/qml/qqmlbuiltinfunctions_p.h
+++ b/src/qml/qml/qqmlbuiltinfunctions_p.h
@@ -154,7 +154,7 @@ public:
QObject *parent = nullptr) const;
Q_INVOKABLE QJSValue binding(const QJSValue &function) const;
- Q_INVOKABLE void callLater(QQmlV4Function *args);
+ Q_INVOKABLE void callLater(QQmlV4FunctionPtr args);
#if QT_CONFIG(translation)
QString uiLanguage() const;
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 7d691db750..8574c96bc1 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -1740,7 +1740,7 @@ QQmlError QQmlComponentPrivate::unsetRequiredPropertyToQQmlError(const RequiredP
/*!
\internal
*/
-void QQmlComponent::createObject(QQmlV4Function *args)
+void QQmlComponent::createObject(QQmlV4FunctionPtr args)
{
Q_D(QQmlComponent);
Q_ASSERT(d->engine);
@@ -1889,7 +1889,7 @@ QObject *QQmlComponent::createObject(QObject *parent, const QVariantMap &propert
/*!
\internal
*/
-void QQmlComponent::incubateObject(QQmlV4Function *args)
+void QQmlComponent::incubateObject(QQmlV4FunctionPtr args)
{
Q_D(QQmlComponent);
Q_ASSERT(d->engine);
diff --git a/src/qml/qml/qqmlcomponent.h b/src/qml/qml/qqmlcomponent.h
index e435aa2894..2d68c47c11 100644
--- a/src/qml/qml/qqmlcomponent.h
+++ b/src/qml/qml/qqmlcomponent.h
@@ -21,7 +21,6 @@ class QByteArray;
class QQmlEngine;
class QQmlComponent;
class QQmlIncubator;
-class QQmlV4Function;
class QQmlComponentPrivate;
class QQmlComponentAttached;
@@ -102,12 +101,12 @@ protected:
#if QT_DEPRECATED_SINCE(6, 3)
QT_DEPRECATED_X("Use the overload with proper arguments")
- Q_INVOKABLE void createObject(QQmlV4Function *);
+ Q_INVOKABLE void createObject(QQmlV4FunctionPtr);
#endif
Q_INVOKABLE QObject *createObject(
QObject *parent = nullptr, const QVariantMap &properties = {});
- Q_INVOKABLE void incubateObject(QQmlV4Function *);
+ Q_INVOKABLE void incubateObject(QQmlV4FunctionPtr);
private:
QQmlComponent(QQmlEngine *, QV4::ExecutableCompilationUnit *compilationUnit, int,
diff --git a/src/qml/qml/qqmldelayedcallqueue.cpp b/src/qml/qml/qqmldelayedcallqueue.cpp
index 96a5679599..efd8519a58 100644
--- a/src/qml/qml/qqmldelayedcallqueue.cpp
+++ b/src/qml/qml/qqmldelayedcallqueue.cpp
@@ -70,7 +70,7 @@ void QQmlDelayedCallQueue::init(QV4::ExecutionEngine* engine)
m_tickedMethod = metaObject.method(methodIndex);
}
-QV4::ReturnedValue QQmlDelayedCallQueue::addUniquelyAndExecuteLater(QV4::ExecutionEngine *engine, QQmlV4Function *args)
+QV4::ReturnedValue QQmlDelayedCallQueue::addUniquelyAndExecuteLater(QV4::ExecutionEngine *engine, QQmlV4FunctionPtr args)
{
QQmlDelayedCallQueue *self = engine->delayedCallQueue();
@@ -142,7 +142,7 @@ QV4::ReturnedValue QQmlDelayedCallQueue::addUniquelyAndExecuteLater(QV4::Executi
return QV4::Encode::undefined();
}
-void QQmlDelayedCallQueue::storeAnyArguments(DelayedFunctionCall &dfc, QQmlV4Function *args, int offset, QV4::ExecutionEngine *engine)
+void QQmlDelayedCallQueue::storeAnyArguments(DelayedFunctionCall &dfc, QQmlV4FunctionPtr args, int offset, QV4::ExecutionEngine *engine)
{
const int length = args->length() - offset;
if (length == 0) {
diff --git a/src/qml/qml/qqmldelayedcallqueue_p.h b/src/qml/qml/qqmldelayedcallqueue_p.h
index 9b66e85a14..88f0c4d118 100644
--- a/src/qml/qml/qqmldelayedcallqueue_p.h
+++ b/src/qml/qml/qqmldelayedcallqueue_p.h
@@ -24,8 +24,6 @@
QT_BEGIN_NAMESPACE
-class QQmlV4Function;
-
class QQmlDelayedCallQueue : public QObject
{
Q_OBJECT
@@ -36,7 +34,7 @@ public:
void init(QV4::ExecutionEngine *);
static QV4::ReturnedValue addUniquelyAndExecuteLater(QV4::ExecutionEngine *engine,
- QQmlV4Function *args);
+ QQmlV4FunctionPtr args);
public Q_SLOTS:
void ticked();
@@ -56,7 +54,7 @@ private:
bool m_guarded;
};
- void storeAnyArguments(DelayedFunctionCall& dfc, QQmlV4Function *args, int offset, QV4::ExecutionEngine *engine);
+ void storeAnyArguments(DelayedFunctionCall& dfc, QQmlV4FunctionPtr args, int offset, QV4::ExecutionEngine *engine);
void executeAllExpired_Later();
QV4::ExecutionEngine *m_engine;
diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp
index 50c460860b..3249f5a6eb 100644
--- a/src/qml/qml/qqmllocale.cpp
+++ b/src/qml/qml/qqmllocale.cpp
@@ -434,7 +434,7 @@ ReturnedValue QQmlNumberExtension::method_fromLocaleString(const QV4::FunctionOb
//--------------
// Locale object
-void QQmlLocaleValueType::formattedDataSize(QQmlV4Function *args) const
+void QQmlLocaleValueType::formattedDataSize(QQmlV4FunctionPtr args) const
{
QV4::Scope scope(args->v4engine());
const auto doThrow = [&](const QString &message) {
@@ -520,7 +520,7 @@ QList<QQmlLocale::DayOfWeek> QQmlLocaleValueType::weekDays() const
return result;
}
-void QQmlLocaleValueType::toString(QQmlV4Function *args) const
+void QQmlLocaleValueType::toString(QQmlV4FunctionPtr args) const
{
Scope scope(args->v4engine());
const auto doThrow = [&](const QString &message) {
diff --git a/src/qml/qml/qqmllocale_p.h b/src/qml/qml/qqmllocale_p.h
index 0fc9338015..5d26bf8a68 100644
--- a/src/qml/qml/qqmllocale_p.h
+++ b/src/qml/qml/qqmllocale_p.h
@@ -171,7 +171,7 @@ public:
return locale.standaloneDayName(index == 0 ? 7 : index, format);
}
- Q_INVOKABLE void formattedDataSize(QQmlV4Function *args) const;
+ Q_INVOKABLE void formattedDataSize(QQmlV4FunctionPtr args) const;
Q_INVOKABLE QString formattedDataSize(
double bytes, int precision = 2,
QLocale::DataSizeFormats format = QLocale::DataSizeIecFormat) const
@@ -180,7 +180,7 @@ public:
qint64(QV4::Value::toInteger(bytes)), precision, format);
}
- Q_INVOKABLE void toString(QQmlV4Function *args) const;
+ Q_INVOKABLE void toString(QQmlV4FunctionPtr args) const;
// As a special (undocumented) case, when called with no arguments,
// just forward to QDebug. This makes it consistent with other types
diff --git a/src/qml/qml/qqmlprivate.h b/src/qml/qml/qqmlprivate.h
index d7e1676633..93837741e1 100644
--- a/src/qml/qml/qqmlprivate.h
+++ b/src/qml/qml/qqmlprivate.h
@@ -82,6 +82,9 @@ class QQmlEngine;
class QQmlCustomParser;
class QQmlTypeNotAvailable;
+class QQmlV4Function;
+using QQmlV4FunctionPtr = QQmlV4Function *;
+
template<class T>
QQmlCustomParser *qmlCreateCustomParser()
{
@@ -1152,4 +1155,6 @@ namespace QQmlPrivate
QT_END_NAMESPACE
+Q_DECLARE_OPAQUE_POINTER(QQmlV4FunctionPtr)
+
#endif // QQMLPRIVATE_H
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp
index 14929d9a36..a225f94a3f 100644
--- a/src/qml/qml/qqmlpropertycache.cpp
+++ b/src/qml/qml/qqmlpropertycache.cpp
@@ -111,7 +111,7 @@ void QQmlPropertyData::load(const QMetaMethod &m)
m_flags.setHasArguments(true);
m_flags.setIsV4Function(
paramCount == 1 &&
- m.parameterMetaType(0) == QMetaType::fromType<QQmlV4Function *>());
+ m.parameterMetaType(0) == QMetaType::fromType<QQmlV4FunctionPtr>());
} else {
m_flags.setHasArguments(false);
m_flags.setIsV4Function(false);
diff --git a/src/qml/qml/qqmlpropertydata_p.h b/src/qml/qml/qqmlpropertydata_p.h
index 760e577ae1..0fa7984f05 100644
--- a/src/qml/qml/qqmlpropertydata_p.h
+++ b/src/qml/qml/qqmlpropertydata_p.h
@@ -71,7 +71,7 @@ public:
unsigned isWritableORhasArguments : 1; // Has WRITE function OR Function takes arguments
unsigned isResettableORisSignal : 1; // Has RESET function OR Function is a signal
unsigned isAliasORisVMESignal : 1; // Is a QML alias to another property OR Signal was added by QML
- unsigned isFinalORisV4Function : 1; // Has FINAL flag OR Function takes QQmlV4Function* args
+ unsigned isFinalORisV4Function : 1; // Has FINAL flag OR Function takes QQmlV4FunctionPtr args
unsigned isSignalHandler : 1; // Function is a signal handler
// TODO: Remove this once we can. Signals should not be overridable.