From 7de17a91bcc812a64bb3b42570ed9356e759bd5a Mon Sep 17 00:00:00 2001 From: Dheerendra Purohit Date: Wed, 16 Oct 2024 19:43:29 +0530 Subject: [PATCH] Make dumpObjectTree() and dumpObjectInfo() invokable from QML [ChangeLog][QtCore][QObject] QObject::dumpObjectTree() and QObject::dumpObjectInfo() are now invokable, allowing them to be used from QML. Fixes: QTBUG-126849 Change-Id: I98df0f57013eaf8e873e8901a4ada527e5ec605f Reviewed-by: Thiago Macieira --- src/corelib/kernel/qobject.h | 4 ++-- tests/auto/tools/moc/tst_moc.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 6b82a6ad4f6..ddc76aac84c 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -329,8 +329,8 @@ public: } #endif //Q_QDOC - void dumpObjectTree() const; - void dumpObjectInfo() const; + Q_REVISION(6, 9) Q_INVOKABLE void dumpObjectTree() const; + Q_REVISION(6, 9) Q_INVOKABLE void dumpObjectInfo() const; QT_CORE_INLINE_SINCE(6, 6) bool setProperty(const char *name, const QVariant &value); diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 8bad1965a1c..376073e5bef 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -1677,16 +1677,16 @@ void tst_Moc::specifyMetaTagsFromCmdline() { void tst_Moc::invokable() { - const int fooIndex = 4; + const int fooIndex = 6; { const QMetaObject &mobj = InvokableBeforeReturnType::staticMetaObject; - QCOMPARE(mobj.methodCount(), 5); + QCOMPARE(mobj.methodCount(), 7); QCOMPARE(mobj.method(fooIndex).methodSignature(), QByteArray("foo()")); } { const QMetaObject &mobj = InvokableBeforeInline::staticMetaObject; - QCOMPARE(mobj.methodCount(), 6); + QCOMPARE(mobj.methodCount(), 8); QCOMPARE(mobj.method(fooIndex).methodSignature(), QByteArray("foo()")); QCOMPARE(mobj.method(fooIndex + 1).methodSignature(), QByteArray("bar()")); } @@ -1694,24 +1694,24 @@ void tst_Moc::invokable() void tst_Moc::singleFunctionKeywordSignalAndSlot() { - const int mySignalIndex = 4; + const int mySignalIndex = 6; { const QMetaObject &mobj = SingleFunctionKeywordBeforeReturnType::staticMetaObject; - QCOMPARE(mobj.methodCount(), 6); + QCOMPARE(mobj.methodCount(), 8); QCOMPARE(mobj.method(mySignalIndex).methodSignature(), QByteArray("mySignal()")); QCOMPARE(mobj.method(mySignalIndex + 1).methodSignature(), QByteArray("mySlot()")); } { const QMetaObject &mobj = SingleFunctionKeywordBeforeInline::staticMetaObject; - QCOMPARE(mobj.methodCount(), 6); + QCOMPARE(mobj.methodCount(), 8); QCOMPARE(mobj.method(mySignalIndex).methodSignature(), QByteArray("mySignal()")); QCOMPARE(mobj.method(mySignalIndex + 1).methodSignature(), QByteArray("mySlot()")); } { const QMetaObject &mobj = SingleFunctionKeywordAfterInline::staticMetaObject; - QCOMPARE(mobj.methodCount(), 6); + QCOMPARE(mobj.methodCount(), 8); QCOMPARE(mobj.method(mySignalIndex).methodSignature(), QByteArray("mySignal()")); QCOMPARE(mobj.method(mySignalIndex + 1).methodSignature(), QByteArray("mySlot()")); }