summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothaddress.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bluetooth/qbluetoothaddress.cpp')
-rw-r--r--src/bluetooth/qbluetoothaddress.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/bluetooth/qbluetoothaddress.cpp b/src/bluetooth/qbluetoothaddress.cpp
index 8e3c29c6..5a0abf45 100644
--- a/src/bluetooth/qbluetoothaddress.cpp
+++ b/src/bluetooth/qbluetoothaddress.cpp
@@ -59,15 +59,13 @@ QT_BEGIN_NAMESPACE
Returns true if the Bluetooth addresses are not equal, otherwise returns false.
*/
-namespace {
-class BluetoothAddressRegisterMetaTypes
+static void registerQBluetoothAddressMetaType()
{
-public:
- BluetoothAddressRegisterMetaTypes()
- {
+ static bool initDone = false;
+ if (!initDone) {
qRegisterMetaType<QBluetoothAddress>();
+ initDone = true;
}
-} _registerBluetoothAddressMetaTypes;
}
/*!
@@ -76,6 +74,7 @@ public:
QBluetoothAddress::QBluetoothAddress() :
d_ptr(new QBluetoothAddressPrivate)
{
+ registerQBluetoothAddressMetaType();
}
/*!
@@ -84,6 +83,8 @@ QBluetoothAddress::QBluetoothAddress() :
QBluetoothAddress::QBluetoothAddress(quint64 address) :
d_ptr(new QBluetoothAddressPrivate)
{
+ registerQBluetoothAddressMetaType();
+
Q_D(QBluetoothAddress);
d->m_address = address;
}
@@ -97,6 +98,8 @@ QBluetoothAddress::QBluetoothAddress(quint64 address) :
QBluetoothAddress::QBluetoothAddress(const QString &address) :
d_ptr(new QBluetoothAddressPrivate)
{
+ registerQBluetoothAddressMetaType();
+
Q_D(QBluetoothAddress);
QString a = address;