summaryrefslogtreecommitdiffstats
path: root/src/plugins/bearer
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2012-07-20 10:56:54 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-25 19:32:41 +0200
commit79b742b7e01ba5fa46b45578660d0e1f9ce0dae6 (patch)
treec17e06e84aed38d294e9d02ecca36bf51b4fc2a8 /src/plugins/bearer
parent7d110111da72f9af5c94b66d402c18355bc16fda (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 'src/plugins/bearer')
-rw-r--r--src/plugins/bearer/qbearerengine_impl.h2
-rw-r--r--src/plugins/bearer/qnetworksession_impl.cpp4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/bearer/qbearerengine_impl.h b/src/plugins/bearer/qbearerengine_impl.h
index aa4433115e..7c17d8d090 100644
--- a/src/plugins/bearer/qbearerengine_impl.h
+++ b/src/plugins/bearer/qbearerengine_impl.h
@@ -80,6 +80,8 @@ Q_SIGNALS:
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QBearerEngineImpl::ConnectionError)
+
#endif // QT_NO_BEARERMANAGEMENT
#endif // QBEARERENGINE_IMPL_H
diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp
index 31cea0bfc3..bea881fa25 100644
--- a/src/plugins/bearer/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/qnetworksession_impl.cpp
@@ -96,14 +96,14 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface()
state = QNetworkSession::Invalid;
lastError = QNetworkSession::UnknownSessionError;
- qRegisterMetaType<QBearerEngineImpl::ConnectionError>("QBearerEngineImpl::ConnectionError");
+ qRegisterMetaType<QBearerEngineImpl::ConnectionError>();
switch (publicConfig.type()) {
case QNetworkConfiguration::InternetAccessPoint:
activeConfig = publicConfig;
engine = getEngineFromId(activeConfig.identifier());
if (engine) {
- qRegisterMetaType<QNetworkConfigurationPrivatePointer>("QNetworkConfigurationPrivatePointer");
+ qRegisterMetaType<QNetworkConfigurationPrivatePointer>();
connect(engine, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)),
this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer)),
Qt::QueuedConnection);