summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/nfc/qndefrecord_p.h7
-rw-r--r--src/nfc/qqmlndefrecord.cpp19
2 files changed, 12 insertions, 14 deletions
diff --git a/src/nfc/qndefrecord_p.h b/src/nfc/qndefrecord_p.h
index d55c1724..0dfe583a 100644
--- a/src/nfc/qndefrecord_p.h
+++ b/src/nfc/qndefrecord_p.h
@@ -53,8 +53,11 @@ QT_BEGIN_NAMESPACE
class QNdefRecordPrivate : public QSharedData
{
public:
- //bool messageBegin : 1;
- //bool messageEnd : 1;
+ QNdefRecordPrivate() : QSharedData()
+ {
+ typeNameFormat = 0; //TypeNameFormat::Empty
+ }
+
unsigned int typeNameFormat : 3;
QByteArray type;
diff --git a/src/nfc/qqmlndefrecord.cpp b/src/nfc/qqmlndefrecord.cpp
index fd154d74..8a3f24d7 100644
--- a/src/nfc/qqmlndefrecord.cpp
+++ b/src/nfc/qqmlndefrecord.cpp
@@ -294,22 +294,17 @@ void QQmlNdefRecord::setType(const QString &newtype)
}
/*!
- Sets the type name format of the NDEF record to \a typeNameFormat.
+ Sets the type name format of the NDEF record to \a newTypeNameFormat.
*/
-void QQmlNdefRecord::setTypeNameFormat(QQmlNdefRecord::TypeNameFormat typeNameFormat)
+void QQmlNdefRecord::setTypeNameFormat(QQmlNdefRecord::TypeNameFormat newTypeNameFormat)
{
- Q_D(QQmlNdefRecord);
- bool emitChanged = true;
- if (static_cast<QQmlNdefRecord::TypeNameFormat>(d->record.typeNameFormat()) == typeNameFormat) {
- emitChanged = false;
- }
+ if (newTypeNameFormat == typeNameFormat())
+ return;
- //We always have to set the tnf, otherwise we run into problems when tnf is empty. Then
- //the QNdefRecordPrivate is not created
- d->record.setTypeNameFormat(static_cast<QNdefRecord::TypeNameFormat>(typeNameFormat));
+ Q_D(QQmlNdefRecord);
+ d->record.setTypeNameFormat(static_cast<QNdefRecord::TypeNameFormat>(newTypeNameFormat));
- if (emitChanged)
- Q_EMIT(typeNameFormatChanged());
+ emit typeNameFormatChanged();
}
/*!