diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2011-12-19 13:10:40 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-20 09:15:41 +0100 |
commit | 8754bf03f59203eef5ff189b1b8c1f54b2a31f87 (patch) | |
tree | 7080fee37f0938731947d5cc7418b91d332f8a10 /tests/auto/corelib | |
parent | 85a77cd5c8f4a9a2e71676ff7b600ba891983115 (diff) |
Better error reporting in case of connection failure.
Use Q_STATIC_ASSERT_X give a better error message.
If C++11 is used, you get the string in the error.
Else, clicking on the QStaticFailure error still shows you the
string in the qobject.h source code)
And report better failure if the return types do not match.
(Without the static assert, you would still have a compilation error,
but in an unrelated place, with no reference to the actual connect()
call. The error was thrown from the virtual call
QSlotObject::call, without saying where it was instantiated)
Previously the error was relying on the existence of a type inside
CheckCompatibleArguments, but the Q_STATIC_ASSERT requires a bool
(hence the introduction of CheckCompatibleArguments::value)
There also was a typo in the return value of
AreArgumentsCompatible::dummy that made that code not work, and that
error not be reported.
(Instead, the error was reported when QObjectSlot::call is instantiated)
Specialization of AreArgumentsCompatible for the void type have been
added because if the return value of a signal or slot is void, the
connection should work.
Change-Id: I5a93ec787ce2a4b94a26630ca31d5001cd294e4d
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'tests/auto/corelib')
0 files changed, 0 insertions, 0 deletions