Revert "Make dumpObjectTree() and dumpObjectInfo() invokable from QML"

This reverts commit 7de17a91bcc812a64bb3b42570ed9356e759bd5a.

The methods were made invokable to make them accessible from QML.
However, the act of introducing revisions into the root of the class
hierarchy creates undue overhead for QML since now every module that
registers types has to account for the possibility of different
revisions of QObject being exposed by different modules. Therefore,
every module that registers types derived from QObject has to register
their own anonymous revisions of QObject and all intermediate classes.
This is clearly not acceptable for functionality only meant to help with
debugging.

Fixes: QTBUG-132387
Change-Id: I8de0b41f384f3ed8f5ef00c8a76c8ad80b36e98f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ulf Hermann 2025-01-02 10:29:04 +01:00
parent fbd7c7c45a
commit 2f5b46731d
2 changed files with 9 additions and 9 deletions

View File

@ -329,8 +329,8 @@ public:
}
#endif //Q_QDOC
Q_REVISION(6, 9) Q_INVOKABLE void dumpObjectTree() const;
Q_REVISION(6, 9) Q_INVOKABLE void dumpObjectInfo() const;
void dumpObjectTree() const;
void dumpObjectInfo() const;
QT_CORE_INLINE_SINCE(6, 6)
bool setProperty(const char *name, const QVariant &value);

View File

@ -1673,16 +1673,16 @@ void tst_Moc::specifyMetaTagsFromCmdline() {
void tst_Moc::invokable()
{
const int fooIndex = 6;
const int fooIndex = 4;
{
const QMetaObject &mobj = InvokableBeforeReturnType::staticMetaObject;
QCOMPARE(mobj.methodCount(), 7);
QCOMPARE(mobj.methodCount(), 5);
QCOMPARE(mobj.method(fooIndex).methodSignature(), QByteArray("foo()"));
}
{
const QMetaObject &mobj = InvokableBeforeInline::staticMetaObject;
QCOMPARE(mobj.methodCount(), 8);
QCOMPARE(mobj.methodCount(), 6);
QCOMPARE(mobj.method(fooIndex).methodSignature(), QByteArray("foo()"));
QCOMPARE(mobj.method(fooIndex + 1).methodSignature(), QByteArray("bar()"));
}
@ -1690,24 +1690,24 @@ void tst_Moc::invokable()
void tst_Moc::singleFunctionKeywordSignalAndSlot()
{
const int mySignalIndex = 6;
const int mySignalIndex = 4;
{
const QMetaObject &mobj = SingleFunctionKeywordBeforeReturnType::staticMetaObject;
QCOMPARE(mobj.methodCount(), 8);
QCOMPARE(mobj.methodCount(), 6);
QCOMPARE(mobj.method(mySignalIndex).methodSignature(), QByteArray("mySignal()"));
QCOMPARE(mobj.method(mySignalIndex + 1).methodSignature(), QByteArray("mySlot()"));
}
{
const QMetaObject &mobj = SingleFunctionKeywordBeforeInline::staticMetaObject;
QCOMPARE(mobj.methodCount(), 8);
QCOMPARE(mobj.methodCount(), 6);
QCOMPARE(mobj.method(mySignalIndex).methodSignature(), QByteArray("mySignal()"));
QCOMPARE(mobj.method(mySignalIndex + 1).methodSignature(), QByteArray("mySlot()"));
}
{
const QMetaObject &mobj = SingleFunctionKeywordAfterInline::staticMetaObject;
QCOMPARE(mobj.methodCount(), 8);
QCOMPARE(mobj.methodCount(), 6);
QCOMPARE(mobj.method(mySignalIndex).methodSignature(), QByteArray("mySignal()"));
QCOMPARE(mobj.method(mySignalIndex + 1).methodSignature(), QByteArray("mySlot()"));
}