QMetaMethod::tag() problem
-
Hi All,
I've got an odd problem related to QMetaMethod and the tag system.
I've got a function:MY_CUSTOM_TAG double playheadPosition() const;
And elsewhere in my code I do the usual,
QMetaMethod mm = win.metaObject()->method(functionIndex); qDebug() << mm.tag(); // prints MY_CUSTOM_TAG
As described at: QMetaMethod tag Howto
Most of the time this pattern works, However I have found a few instances where the tag is not being returned correctly from the tag() call?
ie. the tag(), returns nothing for the function with the MY_CUSTOM_TAG prepended to the function declaration.
One instance of this is the above example, however the really funky thing is that if I change the return type to be float instead of double it works!So, I would really appreciate it if anyone could provide some insight into a solution, and why the tag system might be working correctly with a float return type, but not a double?
I've looked at the moc file generated and it does appear to have some strangeness inside compared to the files that have functions that work with the tag stuff properly.
Namely there are functions inside the qt_static_metacall function in the moc file that mention the MY_CUSTOM_TAG , and I suspect that these functions are also not generating the correct tag either.I do have a lot of functions marked with my tag, ( in the 100's )
Is there any chance I could run into some limit here?
Is there something special about the double type?
Why would changing it to float solve the issue?
FWIW I think I also have instances of it happening with functions that return an int.
I need the precision of double so just changing to float is not really an option.Qt. 5.15.2, targeting x86_64, on windows building with VisualStudio
Thanks,
James -
I doubt there is a limit. Reduce your code until you only have one working and one non-working function and post it here then.
-
After a bit more research I'm pretty sure it's a Qt Bug.
MOC compiler get wrong metamethod tag in some casesNo information if the issue is fixed in newer version of Qt?
It lists 6.0.0 as an affected version, but nothing more recent.
but the resolution is still labeled unresolved?Looks like it will be possible to swap qreal for double, and qint32 for int though,
and things might work then.Cheers,
James -
@Jammin44fm said in QMetaMethod::tag() problem:
It lists 6.0.0 as an affected version, but nothing more recent
Then its not yet fixed. If there is no minimal reproducer you can add one.
-