qt5base-lts/tests/auto/corelib/kernel
Kent Hansen 22d621dd99 QMetaMethod::typeName() should return "void" if the return type is void
QMetaMethod::typeName() is documented to return an empty string if
the return type is void. But after the introduction of
QMetaType::UnknownType (where void was made a distinct type),
returning an empty string causes the idiom

   QMetaType::type(method.typeName())

to break; the result will be QMetaType::UnknownType rather than
the expected QMetaType::Void for methods that return void.

New code should use the new function QMetaMethod::returnType()
instead, but it would be good if existing code still did the right
thing.

The consequence of returning "void" instead of an empty string is
that it breaks existing logic that uses the typeName() length to
determine whether a method returns void. But we judge this as the
lesser of the two evils; it's better to have a typeName() function
that is consistent and keeps the QMetaType::type(method.typeName())
idiom working, than to force the typeName() inconsistency for void
only to keep code that does "strlen(method.typeName()) == 0"
working.

The places in Qt that were relying on a zero-length typeName()
(testlib, dbus, declarative) have already been changed to use
returnType().

Also adapt QMetaObjectBuilder, which is internal API.

Change-Id: I70249174029811c5b5d2a08c24b6db33b3723d19
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-21 18:55:51 +01:00
..
qcoreapplication Fix compile warnings in QCoreApplication autotest. 2012-03-12 05:26:21 +01:00
qeventdispatcher Test posted events in tst_QEventDispatcher with various flags 2012-02-10 15:22:11 +01:00
qeventloop QEvent (and subclasses): make ctors explicit 2012-03-01 08:44:34 +01:00
qmath Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
qmetamethod QMetaMethod::typeName() should return "void" if the return type is void 2012-03-21 18:55:51 +01:00
qmetaobject Fix QMetaObject::normalizedType() for "void" argument 2012-03-21 18:55:27 +01:00
qmetaobjectbuilder QMetaMethod::typeName() should return "void" if the return type is void 2012-03-21 18:55:51 +01:00
qmetaproperty Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
qmetatype Add QtJson types to meta-type system 2012-03-20 22:22:41 +01:00
qmimedata QMimeData: export URLs as text too 2012-02-17 05:26:47 +01:00
qobject Fix QMetaObject::normalizedType() for "void" argument 2012-03-21 18:55:27 +01:00
qpointer Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
qsignalmapper Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
qsocketnotifier Fix tst_QSocketNotifier on Mac OS X 2012-02-13 22:16:17 +01:00
qtimer Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
qtranslator Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
qvariant Crash fix in ~QVariant 2012-03-21 11:43:14 +01:00
qwineventnotifier Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
kernel.pro Add autotest for QMetaMethod introspection 2012-02-15 17:27:04 +01:00