[Interest] Connect to signal QProcess::finished on MSVC 2017
giuseppe.dangelo at kdab.com
Wed May 15 23:40:33 CEST 2019
Il 15/05/19 03:55, Konstantin Shegunov ha scritto:
> If you can't use qOverload or QOverload<...>::of(), then you have only
> two other options. Static casting the signal to the exact method type,
> or specifying the template parameter explicitly.
> QObject::connect(process, static_cast<void (QProcess::*)(int,
> QProcess::ExitStatus)>(&QProcess::finished), receiver, slot);
> QObject::connect<void (QProcess::*)(int, QProcess::ExitStatus)>(process,
> &QProcess::finished, receiver, slot);
I would actually recommend against this second form; I don't think
there's an official stance by Qt (yet), but if one day we decide to
change the template parameters of connect(), it may break. I'd follow to
the rule to let the compiler deduce them, at least for connect().
I'd say to stick with QOverload::of() if you can't use a more modern
compiler yet. Note that MSVC 2017 (15.8) / 2019 now have finally support
for SD-6 feature-test macros, which should make qOverload also work there.
My 2 c,
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4329 bytes
Desc: Firma crittografica S/MIME
More information about the Interest