summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2023-03-13 16:27:29 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-03-15 15:04:36 +0000
commitef9043ea139b2c383c00772a7140be5837e732a8 (patch)
tree8a9fc99d0a918bf7920b41d204b12fb32c86677e
parent3a4474295f7982021301d5c7c717d2ea7c0a2258 (diff)
Revamp annotatedurl example
The example was already updated not so long ago, so this patch mostly introduces cosmetical changes: * Fix CMakeLists.txt to use PRIVATE linking and also use qt_standard_project_setup() * Fix includes according to code guidelines * Do not use 'Example' in the example name * Add proper category Fixes: QTBUG-111906 Change-Id: I09dc19699858f24d3d83ff9e71e8233a036f710c Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> (cherry picked from commit 7f1c6e44c8b18876ab978d2311866b3ddeed7267) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--examples/nfc/annotatedurl/CMakeLists.txt6
-rw-r--r--examples/nfc/annotatedurl/annotatedurl.cpp22
-rw-r--r--examples/nfc/annotatedurl/annotatedurl.h12
-rw-r--r--examples/nfc/annotatedurl/doc/src/annotatedurl.qdoc5
-rw-r--r--examples/nfc/annotatedurl/main.cpp2
-rw-r--r--examples/nfc/annotatedurl/mainwindow.cpp10
-rw-r--r--examples/nfc/annotatedurl/mainwindow.h4
7 files changed, 32 insertions, 29 deletions
diff --git a/examples/nfc/annotatedurl/CMakeLists.txt b/examples/nfc/annotatedurl/CMakeLists.txt
index d9007ef7..6378dde4 100644
--- a/examples/nfc/annotatedurl/CMakeLists.txt
+++ b/examples/nfc/annotatedurl/CMakeLists.txt
@@ -4,8 +4,6 @@
cmake_minimum_required(VERSION 3.16)
project(annotatedurl LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/nfc/annotatedurl")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Nfc Widgets)
+qt_standard_project_setup()
+
qt_add_executable(annotatedurl
MANUAL_FINALIZATION
annotatedurl.cpp annotatedurl.h
@@ -32,7 +32,7 @@ if(IOS)
)
endif()
-target_link_libraries(annotatedurl PUBLIC
+target_link_libraries(annotatedurl PRIVATE
Qt::Core
Qt::Gui
Qt::Nfc
diff --git a/examples/nfc/annotatedurl/annotatedurl.cpp b/examples/nfc/annotatedurl/annotatedurl.cpp
index f181c35f..c3cfec0e 100644
--- a/examples/nfc/annotatedurl/annotatedurl.cpp
+++ b/examples/nfc/annotatedurl/annotatedurl.cpp
@@ -2,20 +2,22 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "annotatedurl.h"
-#include <QtNfc/qnearfieldmanager.h>
-#include <QtNfc/qnearfieldtarget.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qlocale.h>
+#include <QtCore/qurl.h>
+
+#include <QtGui/qdesktopservices.h>
+#include <QtGui/qevent.h>
+
#include <QtNfc/qndefmessage.h>
-#include <QtNfc/qndefrecord.h>
#include <QtNfc/qndefnfctextrecord.h>
#include <QtNfc/qndefnfcurirecord.h>
+#include <QtNfc/qndefrecord.h>
+#include <QtNfc/qnearfieldmanager.h>
+#include <QtNfc/qnearfieldtarget.h>
-#include <QtWidgets/QGridLayout>
-#include <QtWidgets/QLabel>
-#include <QtGui/QMouseEvent>
-#include <QtGui/QDesktopServices>
-#include <QtCore/QDebug>
-#include <QtCore/QLocale>
-#include <QtCore/QUrl>
+#include <QtWidgets/qgridlayout.h>
+#include <QtWidgets/qlabel.h>
AnnotatedUrl::AnnotatedUrl(QObject *parent)
: QObject(parent),
diff --git a/examples/nfc/annotatedurl/annotatedurl.h b/examples/nfc/annotatedurl/annotatedurl.h
index 866d5dba..887e82d5 100644
--- a/examples/nfc/annotatedurl/annotatedurl.h
+++ b/examples/nfc/annotatedurl/annotatedurl.h
@@ -4,15 +4,15 @@
#ifndef ANNOTATEDURL_H
#define ANNOTATEDURL_H
-#include <QtNfc/QNdefMessage>
-#include <QtNfc/QNearFieldManager>
-#include <QtNfc/QNdefFilter>
+#include <QtNfc/qndeffilter.h>
+#include <QtNfc/qndefmessage.h>
+#include <QtNfc/qnearfieldmanager.h>
-#include <QtCore/QObject>
-#include <QtCore/QUrl>
+#include <QtCore/qobject.h>
-QT_FORWARD_DECLARE_CLASS(QPixmap)
QT_FORWARD_DECLARE_CLASS(QNearFieldTarget)
+QT_FORWARD_DECLARE_CLASS(QPixmap)
+QT_FORWARD_DECLARE_CLASS(QUrl)
//! [0]
class AnnotatedUrl : public QObject
diff --git a/examples/nfc/annotatedurl/doc/src/annotatedurl.qdoc b/examples/nfc/annotatedurl/doc/src/annotatedurl.qdoc
index 74e6c95a..9bdb3090 100644
--- a/examples/nfc/annotatedurl/doc/src/annotatedurl.qdoc
+++ b/examples/nfc/annotatedurl/doc/src/annotatedurl.qdoc
@@ -3,8 +3,9 @@
/*!
\example annotatedurl
-\title Annotated URL Example
-\brief An example showing reading from formatted NFC Data Exchange Format (NDEF) messages.
+\title Annotated URL
+\meta category {Connectivity}
+\brief The example shows reading from formatted NFC Data Exchange Format (NDEF) messages.
The Annotated URL example displays the contents of specifically
formatted NFC Data Exchange Format (NDEF) messages read from an NFC
diff --git a/examples/nfc/annotatedurl/main.cpp b/examples/nfc/annotatedurl/main.cpp
index 7bb41670..199d7c7c 100644
--- a/examples/nfc/annotatedurl/main.cpp
+++ b/examples/nfc/annotatedurl/main.cpp
@@ -8,7 +8,7 @@
#include <QtNfc/qndefnfctextrecord.h>
#include <QtNfc/qndefnfcurirecord.h>
-#include <QtWidgets/QApplication>
+#include <QtWidgets/qapplication.h>
//! [0]
int main(int argc, char *argv[])
diff --git a/examples/nfc/annotatedurl/mainwindow.cpp b/examples/nfc/annotatedurl/mainwindow.cpp
index 379d6f5a..233c7fb5 100644
--- a/examples/nfc/annotatedurl/mainwindow.cpp
+++ b/examples/nfc/annotatedurl/mainwindow.cpp
@@ -3,11 +3,11 @@
#include "mainwindow.h"
-#include <QUrl>
-#include <QDesktopServices>
-#include <QLabel>
-#include <QLayout>
-#include <QScreen>
+#include <QtCore/qurl.h>
+#include <QtGui/qdesktopservices.h>
+#include <QtGui/qscreen.h>
+#include <QtWidgets/qlabel.h>
+#include <QtWidgets/qlayout.h>
MainWindow::MainWindow(QWidget *parent)
: QWidget(parent),
diff --git a/examples/nfc/annotatedurl/mainwindow.h b/examples/nfc/annotatedurl/mainwindow.h
index 09fc2ea8..13c214ac 100644
--- a/examples/nfc/annotatedurl/mainwindow.h
+++ b/examples/nfc/annotatedurl/mainwindow.h
@@ -4,8 +4,8 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
-#include <QWidget>
-#include <QPixmap>
+#include <QtGui/qpixmap.h>
+#include <QtWidgets/qwidget.h>
QT_FORWARD_DECLARE_CLASS(QMouseEvent)
QT_FORWARD_DECLARE_CLASS(QUrl)