diff options
author | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2022-11-09 15:56:22 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-02-08 15:44:45 +0000 |
commit | b9ab0e98aaae740c8a97273742f56768ceb6ff76 (patch) | |
tree | cd8eb0fceb777f6bbc43b5403baaca3a6095bde2 /examples/nfc/ndefeditor/nfctarget.h | |
parent | 809f007d111b41263ff80ca8dcd157048cb88d03 (diff) |
QtNfc: Rewrite NDEF Editor example using Qt Quick Components
This makes the example look more native on mobile platforms.
Leave only the functionality related to reading and writing
of text and URI NDEF records to simplify the code. Removed
functionality includes saving/reading messages to files,
and support for image NDEF records.
Fixes: QTBUG-103949
Change-Id: Ie14e3009e2d0238b266eb9690795ca6b56c0010c
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 115b4d947adf90a706f76de831f34960e3c62a9c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples/nfc/ndefeditor/nfctarget.h')
-rw-r--r-- | examples/nfc/ndefeditor/nfctarget.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/examples/nfc/ndefeditor/nfctarget.h b/examples/nfc/ndefeditor/nfctarget.h new file mode 100644 index 00000000..8631687c --- /dev/null +++ b/examples/nfc/ndefeditor/nfctarget.h @@ -0,0 +1,34 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#ifndef NFCTARGET_H +#define NFCTARGET_H + +#include <QObject> + +#include <QNdefMessage> +#include <QNearFieldTarget> +#include <QQmlEngine> + +class NfcTarget : public QObject +{ + Q_OBJECT + QML_ELEMENT + QML_UNCREATABLE("Created by NfcManager") + +public: + explicit NfcTarget(QNearFieldTarget *target, QObject *parent = nullptr); + + Q_INVOKABLE bool readNdefMessages(); + Q_INVOKABLE bool writeNdefMessage(const QNdefMessage &message); + +Q_SIGNALS: + void ndefMessageRead(const QNdefMessage &message); + void requestCompleted(); + void error(QNearFieldTarget::Error error); + +private: + QPointer<QNearFieldTarget> m_target; +}; + +#endif // NFCTARGET_H |