Skip to content

Commit 7818d38

Browse files
author
Ahmad Samir
committed
QMetaObject: document what a "cloned" function is wrt. the meta-object
This is copied, with some modifications, from the comment in handleDefaultArguments() in moc.cpp. Change-Id: Idef95f3873ae3e7447ee4065adbc14ca5e34a57f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
1 parent f792454 commit 7818d38

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/corelib/kernel/qmetaobject.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,7 @@ bool QMetaObject::invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase *
18831883
\internal
18841884
18851885
\value Compatibility
1886-
\value Cloned
1886+
\value Cloned // See QMetaObjectPrivate::originalClone()
18871887
\value Scriptable
18881888
*/
18891889

@@ -4563,9 +4563,15 @@ const char *QMetaClassInfo::value() const
45634563

45644564
/*!
45654565
\internal
4566-
If the local_method_index is a cloned method, return the index of the original.
4566+
If the \a local_method_index is a cloned method, return the index of the original.
45674567
4568-
Example: if the index of "destroyed()" is passed, the index of "destroyed(QObject*)" is returned
4568+
A "cloned" method is a function with a default argument, this is handled by
4569+
pretending there is an overload without the argument, and the original function
4570+
is the overload with all arguments present.
4571+
4572+
Example: for a function \c {QObject::destroyed(QObject *o = nullptr}, if the
4573+
index of \c {destroyed()} is passed, the index of \c {destroyed(QObject*)}
4574+
is returned.
45694575
*/
45704576
int QMetaObjectPrivate::originalClone(const QMetaObject *mobj, int local_method_index)
45714577
{

src/corelib/kernel/qtmocconstants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ enum MethodFlags : uint {
7070
MethodTypeMask = 0x0c,
7171

7272
MethodCompatibility = 0x10,
73-
MethodCloned = 0x20,
73+
MethodCloned = 0x20, // Used for methods with default arguments
7474
MethodScriptable = 0x40,
7575
MethodRevisioned = 0x80,
7676

0 commit comments

Comments
 (0)