Address compile error on gcc 4.8

This partly reverts b3b387698e.
The global static connect was not correct. Furthermore the new global
static variable was triggering

src/nfc/qnearfieldtarget_emulator_p.h:125:31:
    warning: 'globalTagActivator' defined but not used [-Wunused-variable]

The global static variable is shifted to no longer require exposure
inside the header file.

Fixes: QTBUG-74538
Change-Id: Ic5e8211d358bae9c2ed0418aec5c4316fb249c98
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Alex Blasche 2019-03-19 11:21:19 +01:00
parent a61ee48bc1
commit 16f033fb13
3 changed files with 12 additions and 6 deletions

View File

@ -49,10 +49,11 @@ QT_BEGIN_NAMESPACE
QNearFieldManagerPrivateImpl::QNearFieldManagerPrivateImpl()
{
globalTagActivator->initialize();
TagActivator *activator = TagActivator::instance();
activator->initialize();
connect(globalTagActivator, &TagActivator::tagActivated, this, &QNearFieldManagerPrivateImpl::tagActivated);
connect(globalTagActivator, &TagActivator::tagDeactivated, this, &QNearFieldManagerPrivateImpl::tagDeactivated);
connect(activator, &TagActivator::tagActivated, this, &QNearFieldManagerPrivateImpl::tagActivated);
connect(activator, &TagActivator::tagDeactivated, this, &QNearFieldManagerPrivateImpl::tagDeactivated);
}
QNearFieldManagerPrivateImpl::~QNearFieldManagerPrivateImpl()
@ -66,7 +67,7 @@ bool QNearFieldManagerPrivateImpl::isAvailable() const
void QNearFieldManagerPrivateImpl::reset()
{
globalTagActivator->reset();
TagActivator::instance()->reset();
}
void QNearFieldManagerPrivateImpl::tagActivated(TagBase *tag)

View File

@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE
static QMutex tagMutex;
static QMap<TagBase *, bool> tagMap;
Q_GLOBAL_STATIC(TagActivator, globalTagActivator);
TagType1::TagType1(TagBase *tag, QObject *parent)
: QNearFieldTagType1(parent), m_tag(tag)
{
@ -247,6 +249,11 @@ void TagActivator::reset()
tagMap.clear();
}
TagActivator *TagActivator::instance()
{
return globalTagActivator();
}
void TagActivator::timerEvent(QTimerEvent *e)
{
Q_UNUSED(e);

View File

@ -122,8 +122,6 @@ private:
int timerId;
};
Q_GLOBAL_STATIC(TagActivator, globalTagActivator);
QT_END_NAMESPACE
#endif // QNEARFIELDTARGET_EMULATOR_P_H