[Interest] Convert to QMetaMethod from QObject + const char *

Scott Bloom scott at towel42.com
Tue Aug 16 22:39:22 CEST 2022

I have a function that takes in a QObject and const char * signal/slot

void func( ..., QObject * target, const char * member )
.... logic
QObject::connect( ....., target, member )
... more logic

So I can call it via

func( ...., m_target, SLOT( XXXX )

it works fine

I would like to modify the function so it can also take

func( ...., m_target, &TargetClass::XXXX

however, I cant for the life of me figure out to convert, if its even possible

Id prefer not to have to copy all the logic in func

Is this possible?

Yes, I know I can use std::enable_if, but that just copies the function logic

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20220816/486d917f/attachment.htm>

More information about the Interest mailing list