qt5base-lts/tests/auto/corelib
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
..
animation Fix deadlock in QPropertyAnimation 2012-03-07 12:48:49 +01:00
codecs UTF8-Codec test: Fix compilation with g++/C++0X. 2012-03-15 14:51:50 +01:00
global Add Q_IS_ENUM(), and provide as flag in QMetaType::typeFlags() 2012-03-11 23:58:39 +01:00
io Merge master into api_changes 2012-03-16 10:01:29 +01:00
itemmodels Eliminate duplicate data row names from corelib autotests. 2012-02-14 06:19:16 +01:00
json Trailing comma should result in an error during JSON parsing 2012-03-12 21:38:51 +01:00
kernel QMetaMethod::typeName() should return "void" if the return type is void 2012-03-21 18:55:51 +01:00
mimetypes QMimeDatabase: Fix crash on empty filename 2012-03-06 12:10:42 +01:00
plugin Fix QLibrary autotest for Windows 2012-02-28 12:45:28 +01:00
statemachine Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
thread Fix indentation of QWaitCondition autotest. 2012-03-12 13:14:05 +01:00
tools QRegularExpression: support for QStringList overloads 2012-03-21 11:43:30 +01:00
xml Eliminate duplicate data row names from corelib autotests. 2012-02-14 06:19:16 +01:00
corelib.pro Import QMimeType / QMimeDatabase into QtCore. 2012-02-18 22:19:43 +01:00