diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2012-07-20 10:56:54 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-25 19:32:41 +0200 |
commit | 79b742b7e01ba5fa46b45578660d0e1f9ce0dae6 (patch) | |
tree | c17e06e84aed38d294e9d02ecca36bf51b4fc2a8 /tests/auto/network/access | |
parent | 7d110111da72f9af5c94b66d402c18355bc16fda (diff) |
QtNetwork: use nullary version of qRegisterMetaType<T>("T")
Using the nullary version has the advantage that multiple calls
during a program run are much more efficient, since an inlined
atomic is used to store the result. It also ensures that
Q_DECLARE_METATYPE(T) has been used, whereas qRegisterMetaType<T>("T")
will happily register anything. So I've added the macro where it
was missing, or moved it to a central place when it existed
hidden.
In tst_qnetworkreply, this became a bit tricky, because a private
header is conditionally included, so moved the Q_DECLARE_METATYPE()
into a conditional section, too.
Change-Id: I71484523e4277f4697b7d4b2ddc3505375162727
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'tests/auto/network/access')
3 files changed, 3 insertions, 12 deletions
diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp index fb898c4b89..d35173298c 100644 --- a/tests/auto/network/access/qftp/tst_qftp.cpp +++ b/tests/auto/network/access/qftp/tst_qftp.cpp @@ -57,10 +57,6 @@ #include "../../../network-settings.h" -#ifndef QT_NO_BEARERMANAGEMENT -Q_DECLARE_METATYPE(QNetworkConfiguration) -#endif - class tst_QFtp : public QObject { Q_OBJECT diff --git a/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp index f9f3b26898..8de5174739 100644 --- a/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp +++ b/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp @@ -746,7 +746,6 @@ void tst_QHttpNetworkConnection::ignoresslerror() #endif #ifdef QT_NO_SSL -Q_DECLARE_METATYPE(QNetworkReply::NetworkError) void tst_QHttpNetworkConnection::nossl_data() { QTest::addColumn<QString>("protocol"); diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 9b43185384..a7ac2661d5 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -78,7 +78,10 @@ #include <QtNetwork/private/qnetworksession_p.h> #endif #ifdef QT_BUILD_INTERNAL +#include <QtNetwork/private/qnetworkreplyimpl_p.h> // implicitly included by qnetworkaccessmanager_p.h currently, but don't rely on that being true forever #include <QtNetwork/private/qnetworkaccessmanager_p.h> +#else +Q_DECLARE_METATYPE(QSharedPointer<char>) #endif #ifdef Q_OS_UNIX @@ -89,19 +92,12 @@ #include "../../../network-settings.h" -Q_DECLARE_METATYPE(QSharedPointer<char>) Q_DECLARE_METATYPE(QNetworkReply*) Q_DECLARE_METATYPE(QAuthenticator*) -Q_DECLARE_METATYPE(QNetworkProxy) Q_DECLARE_METATYPE(QNetworkProxyQuery) -Q_DECLARE_METATYPE(QList<QNetworkProxy>) -Q_DECLARE_METATYPE(QNetworkReply::NetworkError) Q_DECLARE_METATYPE(QBuffer*) Q_DECLARE_METATYPE(QHttpMultiPart *) Q_DECLARE_METATYPE(QList<QFile*>) // for multiparts -#ifndef QT_NO_SSL -Q_DECLARE_METATYPE(QSslConfiguration) -#endif typedef QSharedPointer<QNetworkReply> QNetworkReplyPtr; |