> On 16 Aug 2022, at 22:39, Scott Bloom <sc...@towel42.com> wrote:
> 
> 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
> 
> Thanks
> Scott


Check QHostInfo::lookupHost for a Qt API that does that. It relies on private 
Qt APIs though.

There might be C++17-ways to simplify some of that using `if constexpr`, but 
the basics will probably be the same.

Volker

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to