summaryrefslogtreecommitdiffstats
path: root/src/nfc/qnearfieldmanager_emulator.cpp
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2018-12-05 11:45:36 +0100
committerOliver Wolff <oliver.wolff@qt.io>2018-12-06 06:30:57 +0000
commitb3b387698e8f685e8bd4f4843a170da40e17249b (patch)
treea1027fa8a541804d3c54bd95756b270b2848ba52 /src/nfc/qnearfieldmanager_emulator.cpp
parent65bea2ce743d628773591793d35f2048fda5820a (diff)
qnearfieldmanager_emulator: Use Q_GLOBAL_STATIC for tag activator
Using a Q_GLOBAL_STATIC here fixes an issue in the auto tests for winrt. If we use a static object that is created before the QCoreapplication has been created, TagActivator's timer will complain, that it was not created inside a QThread. By postponing the creation until first usage we can avoid that problem. Change-Id: I9beca89930bfca2c71e0fce3d9c000dfcb71f431 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/nfc/qnearfieldmanager_emulator.cpp')
-rw-r--r--src/nfc/qnearfieldmanager_emulator.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/nfc/qnearfieldmanager_emulator.cpp b/src/nfc/qnearfieldmanager_emulator.cpp
index c2c037f6..8a61a3a9 100644
--- a/src/nfc/qnearfieldmanager_emulator.cpp
+++ b/src/nfc/qnearfieldmanager_emulator.cpp
@@ -49,12 +49,10 @@ QT_BEGIN_NAMESPACE
QNearFieldManagerPrivateImpl::QNearFieldManagerPrivateImpl()
{
- TagActivator *tagActivator = TagActivator::instance();
+ globalTagActivator->initialize();
- tagActivator->initialize();
-
- connect(tagActivator, &TagActivator::tagActivated, this, &QNearFieldManagerPrivateImpl::tagActivated);
- connect(tagActivator, &TagActivator::tagDeactivated, this, &QNearFieldManagerPrivateImpl::tagDeactivated);
+ connect(globalTagActivator, &TagActivator::tagActivated, this, &QNearFieldManagerPrivateImpl::tagActivated);
+ connect(globalTagActivator, &TagActivator::tagDeactivated, this, &QNearFieldManagerPrivateImpl::tagDeactivated);
}
QNearFieldManagerPrivateImpl::~QNearFieldManagerPrivateImpl()
@@ -68,7 +66,7 @@ bool QNearFieldManagerPrivateImpl::isAvailable() const
void QNearFieldManagerPrivateImpl::reset()
{
- TagActivator::instance()->reset();
+ globalTagActivator->reset();
}
void QNearFieldManagerPrivateImpl::tagActivated(TagBase *tag)