[Development] Avoid overloading of 'error'
Sergio Martins
sergio.martins at kdab.com
Thu Oct 29 19:56:55 CET 2015
On Wednesday, June 10, 2015 01:55:01 PM Matthew Woehlke wrote:
> On 2015-06-10 10:20, Koehne Kai wrote:
> > Hi,
> >
> > I'm currently converting a codebase from old-style connects to new-style
> > ones. Thanks to Qt Creator's refactoring support this is actually quite
> > easy ... it gets ugly though when either the signal or slot method name
> > is overloaded, and you have to write nice code like>
> > connect(&process, static_cast<void
> > (QProcess::*)(QProcess::ProcessError)>(&QProcess::Error), this,
> > &MyClass::processError);
> Not exactly what you were getting at, but relating to the overloaded
> signals/slots problem in general:
>
> template<class... Args, class T, class R>
> auto qOverload(R (T::*m)(Args...)) -> decltype(m)
> { return m; }
>
> connect(&process, qOverload<QProcess::ProcessError>(&QProcess::error),
> this, &MyClass::processError);
Thanks for the tip, how about upstreaming qOverload ?
Regards,
--
SĂ©rgio Martins | sergio.martins at kdab.com | Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel: Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - The Qt Experts
More information about the Development
mailing list