summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools/moc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/tools/moc')
-rw-r--r--tests/auto/tools/moc/CMakeLists.txt28
-rw-r--r--tests/auto/tools/moc/Test.framework/Headers/testinterface.h29
-rw-r--r--tests/auto/tools/moc/allmocs_baseline_in.json201
-rw-r--r--tests/auto/tools/moc/assign-namespace.h29
-rw-r--r--tests/auto/tools/moc/backslash-newlines.h30
-rw-r--r--tests/auto/tools/moc/c-comments.h29
-rw-r--r--tests/auto/tools/moc/cstyle-enums.h29
-rw-r--r--tests/auto/tools/moc/cxx-attributes.h31
-rw-r--r--tests/auto/tools/moc/cxx11-enums.h45
-rw-r--r--tests/auto/tools/moc/cxx11-explicit-override-control.h29
-rw-r--r--tests/auto/tools/moc/cxx11-final-classes.h29
-rw-r--r--tests/auto/tools/moc/cxx11-trailing-return.h29
-rw-r--r--tests/auto/tools/moc/cxx17-namespaces.h29
-rw-r--r--tests/auto/tools/moc/dir-in-include-path.h29
-rw-r--r--tests/auto/tools/moc/dollars.h29
-rw-r--r--tests/auto/tools/moc/enum_with_include.h29
-rw-r--r--tests/auto/tools/moc/error-on-wrong-notify.h29
-rw-r--r--tests/auto/tools/moc/escapes-in-string-literals.h29
-rw-r--r--tests/auto/tools/moc/extraqualification.h29
-rw-r--r--tests/auto/tools/moc/forgotten-qinterface.h29
-rw-r--r--tests/auto/tools/moc/forward-declared-param.h29
-rw-r--r--tests/auto/tools/moc/function-with-attributes.h29
-rw-r--r--tests/auto/tools/moc/fwdclass1.h29
-rw-r--r--tests/auto/tools/moc/fwdclass2.h29
-rw-r--r--tests/auto/tools/moc/fwdclass3.h29
-rw-r--r--tests/auto/tools/moc/gadgetwithnoenums.h29
-rw-r--r--tests/auto/tools/moc/grand-parent-gadget-class.h29
-rw-r--r--tests/auto/tools/moc/interface-from-framework.h29
-rw-r--r--tests/auto/tools/moc/interface-from-include.h29
-rw-r--r--tests/auto/tools/moc/macro-on-cmdline.h29
-rw-r--r--tests/auto/tools/moc/moc_include.h29
-rw-r--r--tests/auto/tools/moc/namespace.h29
-rw-r--r--tests/auto/tools/moc/namespace_no_merge.h29
-rw-r--r--tests/auto/tools/moc/namespaced-base-class.h20
-rw-r--r--tests/auto/tools/moc/namespaced-flags.h29
-rw-r--r--tests/auto/tools/moc/no-keywords.h29
-rw-r--r--tests/auto/tools/moc/non-gadget-parent-class.h29
-rw-r--r--tests/auto/tools/moc/oldstyle-casts.h29
-rw-r--r--tests/auto/tools/moc/os9-newlines.h2
-rw-r--r--tests/auto/tools/moc/parse-boost.h29
-rw-r--r--tests/auto/tools/moc/parse-defines.h29
-rw-r--r--tests/auto/tools/moc/plugin_metadata.h29
-rw-r--r--tests/auto/tools/moc/pointery_to_incomplete.h35
-rw-r--r--tests/auto/tools/moc/pp-dollar-signs.h29
-rw-r--r--tests/auto/tools/moc/pure-virtual-signals.h29
-rw-r--r--tests/auto/tools/moc/qinvokable.h29
-rw-r--r--tests/auto/tools/moc/qmlmacro.h19
-rw-r--r--tests/auto/tools/moc/qprivateslots.h29
-rw-r--r--tests/auto/tools/moc/qtbug-35657-gadget.h29
-rw-r--r--tests/auto/tools/moc/related-metaobjects-in-gadget.h29
-rw-r--r--tests/auto/tools/moc/related-metaobjects-in-namespaces.h29
-rw-r--r--tests/auto/tools/moc/related-metaobjects-name-conflict.h29
-rw-r--r--tests/auto/tools/moc/signal-with-default-arg.h16
-rw-r--r--tests/auto/tools/moc/single-quote-digit-separator-n3781.h29
-rw-r--r--tests/auto/tools/moc/single_function_keyword.h29
-rw-r--r--tests/auto/tools/moc/slots-with-void-template.h29
-rw-r--r--tests/auto/tools/moc/task192552.h29
-rw-r--r--tests/auto/tools/moc/task234909.h29
-rw-r--r--tests/auto/tools/moc/task240368.h29
-rw-r--r--tests/auto/tools/moc/task87883.h29
-rw-r--r--tests/auto/tools/moc/tech-preview.h43
-rw-r--r--tests/auto/tools/moc/template-gtgt.h29
-rw-r--r--tests/auto/tools/moc/testproject/Plugin/Plugin.h29
-rw-r--r--tests/auto/tools/moc/trigraphs.h29
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp672
-rw-r--r--tests/auto/tools/moc/unterminated-function-macro.h29
-rw-r--r--tests/auto/tools/moc/using-namespaces.h29
-rw-r--r--tests/auto/tools/moc/warn-on-multiple-qobject-subclasses.h29
-rw-r--r--tests/auto/tools/moc/warn-on-property-without-read.h29
-rw-r--r--tests/auto/tools/moc/win-newlines.h29
70 files changed, 985 insertions, 1839 deletions
diff --git a/tests/auto/tools/moc/CMakeLists.txt b/tests/auto/tools/moc/CMakeLists.txt
index 44c9ee3fa9..1377c48306 100644
--- a/tests/auto/tools/moc/CMakeLists.txt
+++ b/tests/auto/tools/moc/CMakeLists.txt
@@ -1,10 +1,15 @@
-# special case skip regeneration
-# Generated from moc.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_moc Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_moc LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
set(JSON_HEADERS
backslash-newlines.h
@@ -25,6 +30,7 @@ set(JSON_HEADERS
moc_include.h
namespace.h
namespaced-flags.h
+ namespaced-base-class.h
no-keywords.h
non-gadget-parent-class.h
oldstyle-casts.h
@@ -38,6 +44,7 @@ set(JSON_HEADERS
related-metaobjects-in-gadget.h
related-metaobjects-in-namespaces.h
related-metaobjects-name-conflict.h
+ signal-with-default-arg.h
single-quote-digit-separator-n3781.h
single_function_keyword.h
slots-with-void-template.h
@@ -78,7 +85,7 @@ qt_internal_add_test(tst_moc
EXCEPTIONS
)
-qt_internal_extend_target(tst_moc PUBLIC_LIBRARIES Qt::CorePrivate)
+qt_internal_extend_target(tst_moc LIBRARIES Qt::CorePrivate)
qt_internal_extend_target(tst_moc CONDITION CMAKE_CROSSCOMPILING
DEFINES
@@ -102,22 +109,22 @@ qt_internal_extend_target(tst_moc CONDITION CLANG OR GCC
)
qt_internal_extend_target(tst_moc CONDITION TARGET Qt::DBus
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::DBus
)
qt_internal_extend_target(tst_moc CONDITION TARGET Qt::Concurrent
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Concurrent
)
qt_internal_extend_target(tst_moc CONDITION TARGET Qt::Network
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Network
)
qt_internal_extend_target(tst_moc CONDITION TARGET Qt::Sql
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Sql
)
@@ -142,4 +149,11 @@ add_custom_command(TARGET tst_moc
-o "allmocs.json"
--collect-json "@${moc_json_out}"
COMMENT "Running moc with --collect-json"
+ VERBATIM
+)
+
+# Add dependencies that are implicitly used inside the test
+add_dependencies(tst_moc
+ Qt::qtpaths
+ Qt::moc
)
diff --git a/tests/auto/tools/moc/Test.framework/Headers/testinterface.h b/tests/auto/tools/moc/Test.framework/Headers/testinterface.h
index 491e42772b..486648e312 100644
--- a/tests/auto/tools/moc/Test.framework/Headers/testinterface.h
+++ b/tests/auto/tools/moc/Test.framework/Headers/testinterface.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TESTINTERFACE_H
#define TESTINTERFACE_H
diff --git a/tests/auto/tools/moc/allmocs_baseline_in.json b/tests/auto/tools/moc/allmocs_baseline_in.json
index d362f94c7b..5cbcb99e68 100644
--- a/tests/auto/tools/moc/allmocs_baseline_in.json
+++ b/tests/auto/tools/moc/allmocs_baseline_in.json
@@ -91,6 +91,7 @@
"isClass": false,
"isFlag": false,
"name": "TypedEnum",
+ "type": "char",
"values": [
"B0",
"B1",
@@ -102,6 +103,7 @@
"isClass": true,
"isFlag": false,
"name": "TypedEnumClass",
+ "type": "char",
"values": [
"C0",
"C1",
@@ -147,6 +149,7 @@
"isClass": true,
"isFlag": false,
"name": "TypedEnumStruct",
+ "type": "char",
"values": [
"H0",
"H1",
@@ -188,6 +191,7 @@
"isClass": false,
"isFlag": false,
"name": "TypedEnum",
+ "type": "char",
"values": [
"B0",
"B1",
@@ -199,6 +203,7 @@
"isClass": true,
"isFlag": false,
"name": "TypedEnumClass",
+ "type": "char",
"values": [
"C0",
"C1",
@@ -232,6 +237,65 @@
],
"gadget": true,
"qualifiedClassName": "CXX11Enums2"
+ },
+ {
+ "className": "CXX11Enums3",
+ "enums": [
+ {
+ "isClass": true,
+ "isFlag": false,
+ "name": "EnumClass",
+ "values": [
+ "A0",
+ "A1",
+ "A2",
+ "A3"
+ ]
+ },
+ {
+ "isClass": false,
+ "isFlag": false,
+ "name": "TypedEnum",
+ "type": "char",
+ "values": [
+ "B0",
+ "B1",
+ "B2",
+ "B3"
+ ]
+ },
+ {
+ "isClass": true,
+ "isFlag": false,
+ "name": "TypedEnumClass",
+ "type": "char",
+ "values": [
+ "C0",
+ "C1",
+ "C2",
+ "C3"
+ ]
+ },
+ {
+ "isClass": false,
+ "isFlag": false,
+ "name": "NormalEnum",
+ "values": [
+ "D2",
+ "D3",
+ "D0",
+ "D1"
+ ]
+ }
+ ],
+ "object": true,
+ "qualifiedClassName": "CXX11Enums3",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
}
],
"inputFile": "cxx11-enums.h",
@@ -1258,6 +1322,35 @@
{
"classes": [
{
+ "className": "Base",
+ "object": true,
+ "qualifiedClassName": "QTBUG_101141::Base",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ },
+ {
+ "className": "Derived",
+ "object": true,
+ "qualifiedClassName": "QTBUG_101141::Derived",
+ "superClasses": [
+ {
+ "access": "public",
+ "fullyQualifiedName": "QTBUG_101141::Base",
+ "name": "Base"
+ }
+ ]
+ }
+ ],
+ "inputFile": "namespaced-base-class.h",
+ "outputRevision": 68
+ },
+ {
+ "classes": [
+ {
"className": "Bar",
"enums": [
{
@@ -1671,6 +1764,78 @@
"className": "TestPointeeCanBeIncomplete",
"object": true,
"qualifiedClassName": "TestPointeeCanBeIncomplete",
+ "slots": [
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "QPointer<FwdClass>"
+ }
+ ],
+ "name": "setProp1",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "QSharedPointer<FwdClass>"
+ }
+ ],
+ "name": "setProp2",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "QWeakPointer<FwdClass>"
+ }
+ ],
+ "name": "setProp3",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "FwdClass*"
+ }
+ ],
+ "name": "setProp4",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "const FwdClass*"
+ }
+ ],
+ "name": "setProp5",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "void*"
+ }
+ ],
+ "name": "setProp6",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "const void*"
+ }
+ ],
+ "name": "setProp7",
+ "returnType": "void"
+ }
+ ],
"superClasses": [
{
"access": "public",
@@ -2378,6 +2543,42 @@
{
"classes": [
{
+ "className": "SignalWithDefaultArg",
+ "object": true,
+ "qualifiedClassName": "SignalWithDefaultArg",
+ "signals": [
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "name": "i",
+ "type": "int"
+ }
+ ],
+ "name": "signalWithDefaultArg",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "isCloned": true,
+ "name": "signalWithDefaultArg",
+ "returnType": "void"
+ }
+ ],
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ }
+ ],
+ "inputFile": "signal-with-default-arg.h",
+ "outputRevision": 68
+ },
+ {
+ "classes": [
+ {
"className": "KDAB",
"enums": [
{
diff --git a/tests/auto/tools/moc/assign-namespace.h b/tests/auto/tools/moc/assign-namespace.h
index e6de8461c8..6e375d676c 100644
--- a/tests/auto/tools/moc/assign-namespace.h
+++ b/tests/auto/tools/moc/assign-namespace.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef ASSIGN_NAMESPACE_H
#define ASSIGN_NAMESPACE_H
diff --git a/tests/auto/tools/moc/backslash-newlines.h b/tests/auto/tools/moc/backslash-newlines.h
index cb2a7f6558..d4c1492a21 100644
--- a/tests/auto/tools/moc/backslash-newlines.h
+++ b/tests/auto/tools/moc/backslash-newlines.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef BACKSLASH_NEWLINES_H
#define BACKSLASH_NEWLINES_H
@@ -55,6 +30,7 @@ public slots:
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wcomment")
+QT_WARNING_DISABLE_GCC("-Wcomment")
// ends with \\\r should not make moc crash (QTBUG-53441) (no new lines on purpose!!) \
diff --git a/tests/auto/tools/moc/c-comments.h b/tests/auto/tools/moc/c-comments.h
index 0c4d60bef9..b83549715d 100644
--- a/tests/auto/tools/moc/c-comments.h
+++ b/tests/auto/tools/moc/c-comments.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef C_COMMENTS_H
#define C_COMMENTS_H
diff --git a/tests/auto/tools/moc/cstyle-enums.h b/tests/auto/tools/moc/cstyle-enums.h
index ef065c636d..a173913e06 100644
--- a/tests/auto/tools/moc/cstyle-enums.h
+++ b/tests/auto/tools/moc/cstyle-enums.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef CSTYLE_ENUMS_H
#define CSTYLE_ENUMS_H
diff --git a/tests/auto/tools/moc/cxx-attributes.h b/tests/auto/tools/moc/cxx-attributes.h
index c4f27eb8c4..54649b93fa 100644
--- a/tests/auto/tools/moc/cxx-attributes.h
+++ b/tests/auto/tools/moc/cxx-attributes.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef CXXATTRIBUTE_H
#define CXXATTRIBUTE_H
@@ -35,7 +10,7 @@ QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wunknown-attributes")
QT_WARNING_DISABLE_GCC("-Wattributes")
-class CppAttribute : public QObject
+class [[deprecated]] CppAttribute : public QObject
{
Q_OBJECT
signals:
diff --git a/tests/auto/tools/moc/cxx11-enums.h b/tests/auto/tools/moc/cxx11-enums.h
index d5bd228f12..7547ed81c1 100644
--- a/tests/auto/tools/moc/cxx11-enums.h
+++ b/tests/auto/tools/moc/cxx11-enums.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Olivier Goffart.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2011 Olivier Goffart.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef CXX11_ENUMS_H
#define CXX11_ENUMS_H
@@ -72,4 +47,20 @@ public:
Q_FLAGS(ClassFlags)
};
+class CXX11Enums3 : public QObject
+{
+ Q_OBJECT
+public:
+ enum class EnumClass { A0, A1, A2, A3 };
+ enum TypedEnum : char { B0, B1 , B2, B3 };
+ enum class TypedEnumClass : char { C0, C1, C2, C3 };
+ enum NormalEnum { D2 = 2, D3, D0 =0 , D1 };
+ enum class ClassFlag { F0 = 1, F1 = 2, F2 = 4, F3 = 8 };
+
+ Q_ENUM(EnumClass)
+ Q_ENUM(TypedEnum)
+ Q_ENUM(TypedEnumClass)
+ Q_ENUM(NormalEnum)
+};
+
#endif // CXX11_ENUMS_H
diff --git a/tests/auto/tools/moc/cxx11-explicit-override-control.h b/tests/auto/tools/moc/cxx11-explicit-override-control.h
index 2fcf0fdb2d..c741558419 100644
--- a/tests/auto/tools/moc/cxx11-explicit-override-control.h
+++ b/tests/auto/tools/moc/cxx11-explicit-override-control.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TESTS_AUTO_CORELIB_TOOLS_MOC_CXX11_EXPLICIT_OVERRIDE_CONTROL_H
#define TESTS_AUTO_CORELIB_TOOLS_MOC_CXX11_EXPLICIT_OVERRIDE_CONTROL_H
diff --git a/tests/auto/tools/moc/cxx11-final-classes.h b/tests/auto/tools/moc/cxx11-final-classes.h
index 4bb5181eae..9d1a21bf96 100644
--- a/tests/auto/tools/moc/cxx11-final-classes.h
+++ b/tests/auto/tools/moc/cxx11-final-classes.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TESTS_AUTO_CORELIB_TOOLS_MOC_CXX11_FINAL_CLASSES_H
#define TESTS_AUTO_CORELIB_TOOLS_MOC_CXX11_FINAL_CLASSES_H
diff --git a/tests/auto/tools/moc/cxx11-trailing-return.h b/tests/auto/tools/moc/cxx11-trailing-return.h
index 50f341e1c3..f8ee031dae 100644
--- a/tests/auto/tools/moc/cxx11-trailing-return.h
+++ b/tests/auto/tools/moc/cxx11-trailing-return.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef CXX11_TRAILING_RETURN_H
#define CXX11_TRAILING_RETURN_H
diff --git a/tests/auto/tools/moc/cxx17-namespaces.h b/tests/auto/tools/moc/cxx17-namespaces.h
index 97f534c697..9c346c7993 100644
--- a/tests/auto/tools/moc/cxx17-namespaces.h
+++ b/tests/auto/tools/moc/cxx17-namespaces.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Olivier Goffart.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2011 Olivier Goffart.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef CXX17_NAMESPACES_H
#define CXX17_NAMESPACES_H
diff --git a/tests/auto/tools/moc/dir-in-include-path.h b/tests/auto/tools/moc/dir-in-include-path.h
index ae889f02a1..94f420ea6c 100644
--- a/tests/auto/tools/moc/dir-in-include-path.h
+++ b/tests/auto/tools/moc/dir-in-include-path.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef DIR_IN_INCLUDE_PATH_H
#define DIR_IN_INCLUDE_PATH_H
diff --git a/tests/auto/tools/moc/dollars.h b/tests/auto/tools/moc/dollars.h
index e7eeef3ef7..36cc864fc6 100644
--- a/tests/auto/tools/moc/dollars.h
+++ b/tests/auto/tools/moc/dollars.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef DOLLARS_H
#define DOLLARS_H
diff --git a/tests/auto/tools/moc/enum_with_include.h b/tests/auto/tools/moc/enum_with_include.h
index cd53ba6a28..7cf6bf512c 100644
--- a/tests/auto/tools/moc/enum_with_include.h
+++ b/tests/auto/tools/moc/enum_with_include.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef ENUM_WITH_INCLUDE_H
#define ENUM_WITH_INCLUDE_H
diff --git a/tests/auto/tools/moc/error-on-wrong-notify.h b/tests/auto/tools/moc/error-on-wrong-notify.h
index 9e6b27bff3..90d1eded31 100644
--- a/tests/auto/tools/moc/error-on-wrong-notify.h
+++ b/tests/auto/tools/moc/error-on-wrong-notify.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef ERROR_ON_WRONG_NOTIFY_H
#define ERROR_ON_WRONG_NOTIFY_H
diff --git a/tests/auto/tools/moc/escapes-in-string-literals.h b/tests/auto/tools/moc/escapes-in-string-literals.h
index ddeccd897f..5514bc1000 100644
--- a/tests/auto/tools/moc/escapes-in-string-literals.h
+++ b/tests/auto/tools/moc/escapes-in-string-literals.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef ESCAPES_IN_STRING_LITERALS_H
#define ESCAPES_IN_STRING_LITERALS_H
diff --git a/tests/auto/tools/moc/extraqualification.h b/tests/auto/tools/moc/extraqualification.h
index 4c150415b4..33cc48158f 100644
--- a/tests/auto/tools/moc/extraqualification.h
+++ b/tests/auto/tools/moc/extraqualification.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef EXTRAQUALIFICATION_H
#define EXTRAQUALIFICATION_H
diff --git a/tests/auto/tools/moc/forgotten-qinterface.h b/tests/auto/tools/moc/forgotten-qinterface.h
index fcf7fdd4ff..663ab162f8 100644
--- a/tests/auto/tools/moc/forgotten-qinterface.h
+++ b/tests/auto/tools/moc/forgotten-qinterface.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef FORGOTTEN_QINTERFACE_H
#define FORGOTTEN_QINTERFACE_H
diff --git a/tests/auto/tools/moc/forward-declared-param.h b/tests/auto/tools/moc/forward-declared-param.h
index 8438ca9128..e494b18ba5 100644
--- a/tests/auto/tools/moc/forward-declared-param.h
+++ b/tests/auto/tools/moc/forward-declared-param.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Intel Corporation.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef FORWARD_DECLARED_PARAM_H
#define FORWARD_DECLARED_PARAM_H
diff --git a/tests/auto/tools/moc/function-with-attributes.h b/tests/auto/tools/moc/function-with-attributes.h
index 12c231371f..be7c8d9aaa 100644
--- a/tests/auto/tools/moc/function-with-attributes.h
+++ b/tests/auto/tools/moc/function-with-attributes.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef FUNCTION_WITH_ATTRIBUTES_H
#define FUNCTION_WITH_ATTRIBUTES_H
diff --git a/tests/auto/tools/moc/fwdclass1.h b/tests/auto/tools/moc/fwdclass1.h
index a8457cca77..eaaa7c380f 100644
--- a/tests/auto/tools/moc/fwdclass1.h
+++ b/tests/auto/tools/moc/fwdclass1.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Olivier Goffart <ogoffart@woboq.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Olivier Goffart <ogoffart@woboq.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifdef FWDCLASS1_H
#error "This file can only be included once"
diff --git a/tests/auto/tools/moc/fwdclass2.h b/tests/auto/tools/moc/fwdclass2.h
index 650da18116..588f5b4de3 100644
--- a/tests/auto/tools/moc/fwdclass2.h
+++ b/tests/auto/tools/moc/fwdclass2.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Olivier Goffart <ogoffart@woboq.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Olivier Goffart <ogoffart@woboq.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifdef FWDCLASS2_H
#error "This file can only be included once"
diff --git a/tests/auto/tools/moc/fwdclass3.h b/tests/auto/tools/moc/fwdclass3.h
index 080ac0340d..5ecdb2ce6e 100644
--- a/tests/auto/tools/moc/fwdclass3.h
+++ b/tests/auto/tools/moc/fwdclass3.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Olivier Goffart <ogoffart@woboq.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Olivier Goffart <ogoffart@woboq.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifdef FWDCLASS3_H
#error "This file can only be included once"
diff --git a/tests/auto/tools/moc/gadgetwithnoenums.h b/tests/auto/tools/moc/gadgetwithnoenums.h
index 3b182ab875..5ef8bced8c 100644
--- a/tests/auto/tools/moc/gadgetwithnoenums.h
+++ b/tests/auto/tools/moc/gadgetwithnoenums.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TASK175491
#define TASK175491
diff --git a/tests/auto/tools/moc/grand-parent-gadget-class.h b/tests/auto/tools/moc/grand-parent-gadget-class.h
index c7720a1ab9..d5adfb9974 100644
--- a/tests/auto/tools/moc/grand-parent-gadget-class.h
+++ b/tests/auto/tools/moc/grand-parent-gadget-class.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef GRANDPARENTGADGETCLASS_H
#define GRANDPARENTGADGETCLASS_H
diff --git a/tests/auto/tools/moc/interface-from-framework.h b/tests/auto/tools/moc/interface-from-framework.h
index f0fc5df7af..f8f80cbafb 100644
--- a/tests/auto/tools/moc/interface-from-framework.h
+++ b/tests/auto/tools/moc/interface-from-framework.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef INTERFACE_FROM_FRAMEWORK_H
#define INTERFACE_FROM_FRAMEWORK_H
diff --git a/tests/auto/tools/moc/interface-from-include.h b/tests/auto/tools/moc/interface-from-include.h
index 2b3929582b..6e92d30142 100644
--- a/tests/auto/tools/moc/interface-from-include.h
+++ b/tests/auto/tools/moc/interface-from-include.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef INTERFACE_FROM_INCLUDE_H
#define INTERFACE_FROM_INCLUDE_H
diff --git a/tests/auto/tools/moc/macro-on-cmdline.h b/tests/auto/tools/moc/macro-on-cmdline.h
index 32a2b72cf4..d7530cdcb1 100644
--- a/tests/auto/tools/moc/macro-on-cmdline.h
+++ b/tests/auto/tools/moc/macro-on-cmdline.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef MACRO_ON_CMDLINE_H
#define MACRO_ON_CMDLINE_H
diff --git a/tests/auto/tools/moc/moc_include.h b/tests/auto/tools/moc/moc_include.h
index 49b484a0c9..398459766e 100644
--- a/tests/auto/tools/moc/moc_include.h
+++ b/tests/auto/tools/moc/moc_include.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Olivier Goffart <ogoffart@woboq.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Olivier Goffart <ogoffart@woboq.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef MOC_INCLUDE_H
#define MOC_INCLUDE_H
diff --git a/tests/auto/tools/moc/namespace.h b/tests/auto/tools/moc/namespace.h
index 7f1e46cd62..22fe0b91f5 100644
--- a/tests/auto/tools/moc/namespace.h
+++ b/tests/auto/tools/moc/namespace.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef NAMESPACE_H
#define NAMESPACE_H
diff --git a/tests/auto/tools/moc/namespace_no_merge.h b/tests/auto/tools/moc/namespace_no_merge.h
index 8d1639ad4c..e2f277fde5 100644
--- a/tests/auto/tools/moc/namespace_no_merge.h
+++ b/tests/auto/tools/moc/namespace_no_merge.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef NAMESPACE_NO_MERGE_H
#define NAMESPACE_NO_MERGE_H
diff --git a/tests/auto/tools/moc/namespaced-base-class.h b/tests/auto/tools/moc/namespaced-base-class.h
new file mode 100644
index 0000000000..46bd2bae29
--- /dev/null
+++ b/tests/auto/tools/moc/namespaced-base-class.h
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef TST_MOC_NAMESPACED_BASE_CLASS_H
+#define TST_MOC_NAMESPACED_BASE_CLASS_H
+
+#include <QObject>
+
+namespace QTBUG_101141 {
+ class Base : public QObject {
+ Q_OBJECT
+ };
+
+ class Derived : public Base
+ {
+ Q_OBJECT
+ };
+}
+
+#endif // TST_MOC_NAMESPACED_BASE_CLASS_H
diff --git a/tests/auto/tools/moc/namespaced-flags.h b/tests/auto/tools/moc/namespaced-flags.h
index d49ac9829d..39ff5c1f9a 100644
--- a/tests/auto/tools/moc/namespaced-flags.h
+++ b/tests/auto/tools/moc/namespaced-flags.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef NAMESPACED_FLAGS_H
#define NAMESPACED_FLAGS_H
diff --git a/tests/auto/tools/moc/no-keywords.h b/tests/auto/tools/moc/no-keywords.h
index cb0bca7a19..bf9beb4663 100644
--- a/tests/auto/tools/moc/no-keywords.h
+++ b/tests/auto/tools/moc/no-keywords.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef NO_KEYWORDS_H
#define NO_KEYWORDS_H
diff --git a/tests/auto/tools/moc/non-gadget-parent-class.h b/tests/auto/tools/moc/non-gadget-parent-class.h
index 517fc616f5..c64075b572 100644
--- a/tests/auto/tools/moc/non-gadget-parent-class.h
+++ b/tests/auto/tools/moc/non-gadget-parent-class.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef NONGADGETPARENTCLASS_H
#define NONGADGETPARENTCLASS_H
diff --git a/tests/auto/tools/moc/oldstyle-casts.h b/tests/auto/tools/moc/oldstyle-casts.h
index d812a1b184..017f195b7b 100644
--- a/tests/auto/tools/moc/oldstyle-casts.h
+++ b/tests/auto/tools/moc/oldstyle-casts.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef OLDSTYLE_CASTS_H
#define OLDSTYLE_CASTS_H
diff --git a/tests/auto/tools/moc/os9-newlines.h b/tests/auto/tools/moc/os9-newlines.h
index 41b3cb883d..82bddd117d 100644
--- a/tests/auto/tools/moc/os9-newlines.h
+++ b/tests/auto/tools/moc/os9-newlines.h
@@ -1 +1 @@
-/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include <QObject> class Os9Newlines : public QObject { Q_OBJECT public Q_SLOTS: inline void testSlot() {} }; \ No newline at end of file
+// Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include <QObject> class Os9Newlines : public QObject { Q_OBJECT public Q_SLOTS: inline void testSlot() {} }; \ No newline at end of file
diff --git a/tests/auto/tools/moc/parse-boost.h b/tests/auto/tools/moc/parse-boost.h
index c9c492ed69..8f327a131d 100644
--- a/tests/auto/tools/moc/parse-boost.h
+++ b/tests/auto/tools/moc/parse-boost.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef PARSE_BOOST_H
#define PARSE_BOOST_H
diff --git a/tests/auto/tools/moc/parse-defines.h b/tests/auto/tools/moc/parse-defines.h
index b88fe63e4a..238d33246f 100644
--- a/tests/auto/tools/moc/parse-defines.h
+++ b/tests/auto/tools/moc/parse-defines.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef PARSE_DEFINES_H
#define PARSE_DEFINES_H
diff --git a/tests/auto/tools/moc/plugin_metadata.h b/tests/auto/tools/moc/plugin_metadata.h
index 927addd9e4..5f2a1885f6 100644
--- a/tests/auto/tools/moc/plugin_metadata.h
+++ b/tests/auto/tools/moc/plugin_metadata.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TESTPLUGINMETADATA
#define TESTPLUGINMETADATA
diff --git a/tests/auto/tools/moc/pointery_to_incomplete.h b/tests/auto/tools/moc/pointery_to_incomplete.h
index 63591bc0f7..5d0ac859d6 100644
--- a/tests/auto/tools/moc/pointery_to_incomplete.h
+++ b/tests/auto/tools/moc/pointery_to_incomplete.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef POINTERY_TO_INCOMPLETE_H
#define POINTERY_TO_INCOMPLETE_H
@@ -39,10 +14,14 @@ class FwdClass;
class TestPointeeCanBeIncomplete : public QObject
{
Q_OBJECT
-public:
+public slots:
void setProp1(QPointer<FwdClass>) {}
void setProp2(QSharedPointer<FwdClass>) {}
void setProp3(const QWeakPointer<FwdClass> &) {}
+ void setProp4(FwdClass *) {}
+ void setProp5(const FwdClass *) {}
+ void setProp6(void *) {}
+ void setProp7(const void *) {}
};
#endif // POINTERY_TO_INCOMPLETE_H
diff --git a/tests/auto/tools/moc/pp-dollar-signs.h b/tests/auto/tools/moc/pp-dollar-signs.h
index 4235d5fe18..6ba39cb903 100644
--- a/tests/auto/tools/moc/pp-dollar-signs.h
+++ b/tests/auto/tools/moc/pp-dollar-signs.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef PP_DOLLAR_SIGNS_H
#define PP_DOLLAR_SIGNS_H
diff --git a/tests/auto/tools/moc/pure-virtual-signals.h b/tests/auto/tools/moc/pure-virtual-signals.h
index f8b3a80f91..3c996a8628 100644
--- a/tests/auto/tools/moc/pure-virtual-signals.h
+++ b/tests/auto/tools/moc/pure-virtual-signals.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef PURE_VIRTUAL_SIGNALS_H
#define PURE_VIRTUAL_SIGNALS_H
diff --git a/tests/auto/tools/moc/qinvokable.h b/tests/auto/tools/moc/qinvokable.h
index 856d795b45..e2181d909d 100644
--- a/tests/auto/tools/moc/qinvokable.h
+++ b/tests/auto/tools/moc/qinvokable.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QINVOKABLE_H
#define QINVOKABLE_H
diff --git a/tests/auto/tools/moc/qmlmacro.h b/tests/auto/tools/moc/qmlmacro.h
new file mode 100644
index 0000000000..e44138a3b6
--- /dev/null
+++ b/tests/auto/tools/moc/qmlmacro.h
@@ -0,0 +1,19 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+
+#ifndef QMlMACRO_H
+#define QMlMACRO_H
+
+#include <QObject>
+#include <QByteArray>
+
+struct QmlMacro : QObject
+{
+ Q_OBJECT
+ Q_CLASSINFO("QML.Element", "auto")
+
+ signals:
+ void f(QByteArray &b);
+};
+#endif
diff --git a/tests/auto/tools/moc/qprivateslots.h b/tests/auto/tools/moc/qprivateslots.h
index 1e4cb21921..d4b158bbc4 100644
--- a/tests/auto/tools/moc/qprivateslots.h
+++ b/tests/auto/tools/moc/qprivateslots.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QPRIVATESLOTS_H
#define QPRIVATESLOTS_H
diff --git a/tests/auto/tools/moc/qtbug-35657-gadget.h b/tests/auto/tools/moc/qtbug-35657-gadget.h
index 5008c26865..d97e1f7f45 100644
--- a/tests/auto/tools/moc/qtbug-35657-gadget.h
+++ b/tests/auto/tools/moc/qtbug-35657-gadget.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QTBUG_35657_GADGET_H
#define QTBUG_35657_GADGET_H
diff --git a/tests/auto/tools/moc/related-metaobjects-in-gadget.h b/tests/auto/tools/moc/related-metaobjects-in-gadget.h
index ac00b642c3..0ea6c09a73 100644
--- a/tests/auto/tools/moc/related-metaobjects-in-gadget.h
+++ b/tests/auto/tools/moc/related-metaobjects-in-gadget.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef RELATED_METAOBJECTS_IN_GADGET_H
#define RELATED_METAOBJECTS_IN_GADGET_H
diff --git a/tests/auto/tools/moc/related-metaobjects-in-namespaces.h b/tests/auto/tools/moc/related-metaobjects-in-namespaces.h
index f6c0a64c9b..efd8210767 100644
--- a/tests/auto/tools/moc/related-metaobjects-in-namespaces.h
+++ b/tests/auto/tools/moc/related-metaobjects-in-namespaces.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef RELATED_METAOBJECTS_IN_NAMESPACES_H
#define RELATED_METAOBJECTS_IN_NAMESPACES_H
diff --git a/tests/auto/tools/moc/related-metaobjects-name-conflict.h b/tests/auto/tools/moc/related-metaobjects-name-conflict.h
index 14307a4c1b..cccd97e4e7 100644
--- a/tests/auto/tools/moc/related-metaobjects-name-conflict.h
+++ b/tests/auto/tools/moc/related-metaobjects-name-conflict.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef RELATED_METAOBJECTS_NAME_CONFLICT_H
#define RELATED_METAOBJECTS_NAME_CONFLICT_H
diff --git a/tests/auto/tools/moc/signal-with-default-arg.h b/tests/auto/tools/moc/signal-with-default-arg.h
new file mode 100644
index 0000000000..3fd98712eb
--- /dev/null
+++ b/tests/auto/tools/moc/signal-with-default-arg.h
@@ -0,0 +1,16 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef SIGNAL_WITH_DEFAULT_ARG_H
+#define SIGNAL_WITH_DEFAULT_ARG_H
+
+#include <QtCore/qobject.h>
+
+class SignalWithDefaultArg : public QObject
+{
+ Q_OBJECT
+signals:
+ void signalWithDefaultArg(int i = 12);
+};
+
+#endif // SIGNAL_WITH_DEFAULT_ARG_H
diff --git a/tests/auto/tools/moc/single-quote-digit-separator-n3781.h b/tests/auto/tools/moc/single-quote-digit-separator-n3781.h
index 1b4aeab890..f272ecbddf 100644
--- a/tests/auto/tools/moc/single-quote-digit-separator-n3781.h
+++ b/tests/auto/tools/moc/single-quote-digit-separator-n3781.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2013 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef SINGLE_QUOTE_DIGIT_SEPARATOR_N3781_H
#define SINGLE_QUOTE_DIGIT_SEPARATOR_N3781_H
diff --git a/tests/auto/tools/moc/single_function_keyword.h b/tests/auto/tools/moc/single_function_keyword.h
index 6abcc42a04..0c907db9ef 100644
--- a/tests/auto/tools/moc/single_function_keyword.h
+++ b/tests/auto/tools/moc/single_function_keyword.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef SINGLE_FUNCTION_KEYWORD_H
#define SINGLE_FUNCTION_KEYWORD_H
diff --git a/tests/auto/tools/moc/slots-with-void-template.h b/tests/auto/tools/moc/slots-with-void-template.h
index 4bdb587372..5b51041155 100644
--- a/tests/auto/tools/moc/slots-with-void-template.h
+++ b/tests/auto/tools/moc/slots-with-void-template.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef SLOTS_WITH_VOID_TEMPLATE_H
#define SLOTS_WITH_VOID_TEMPLATE_H
diff --git a/tests/auto/tools/moc/task192552.h b/tests/auto/tools/moc/task192552.h
index 302ead0e20..aad545292f 100644
--- a/tests/auto/tools/moc/task192552.h
+++ b/tests/auto/tools/moc/task192552.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TASK192552_H
#define TASK192552_H
diff --git a/tests/auto/tools/moc/task234909.h b/tests/auto/tools/moc/task234909.h
index 661df19fa9..4be1383f4a 100644
--- a/tests/auto/tools/moc/task234909.h
+++ b/tests/auto/tools/moc/task234909.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TASK234909_H
#define TASK234909_H
diff --git a/tests/auto/tools/moc/task240368.h b/tests/auto/tools/moc/task240368.h
index 0913517c16..1e728d373f 100644
--- a/tests/auto/tools/moc/task240368.h
+++ b/tests/auto/tools/moc/task240368.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
// moc parsing issue with "unsigned" subphrase
#ifndef TASK240368_H
diff --git a/tests/auto/tools/moc/task87883.h b/tests/auto/tools/moc/task87883.h
index be0b505c95..60ca529d53 100644
--- a/tests/auto/tools/moc/task87883.h
+++ b/tests/auto/tools/moc/task87883.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TASK87883_H
#define TASK87883_H
diff --git a/tests/auto/tools/moc/tech-preview.h b/tests/auto/tools/moc/tech-preview.h
new file mode 100644
index 0000000000..8f285048e4
--- /dev/null
+++ b/tests/auto/tools/moc/tech-preview.h
@@ -0,0 +1,43 @@
+// Copyright (C) 2024 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef TECH_PREVIEW_H
+#define TECH_PREVIEW_H
+
+#include <QObject>
+
+class QT_TECH_PREVIEW_API MyTechPreviewObject : public QObject
+{
+ QT_TECH_PREVIEW_API
+ Q_OBJECT
+
+ QT_TECH_PREVIEW_API
+ Q_PROPERTY(int status MEMBER m_status)
+
+ int m_status = 0;
+
+public:
+ void myMethod() {}
+ QT_TECH_PREVIEW_API void myTPMethod() {}
+
+ Q_INVOKABLE QT_TECH_PREVIEW_API void myTPInvokable1() {}
+ QT_TECH_PREVIEW_API Q_INVOKABLE void myTPInvokable2() {}
+
+ enum class QT_TECH_PREVIEW_API MyTechPreviewEnum
+ {
+ A, B, C,
+ TP QT_TECH_PREVIEW_API,
+ X, Y, Z
+ };
+
+signals:
+ void mySignal();
+ QT_TECH_PREVIEW_API void myTPSignal();
+
+public Q_SLOTS:
+ void mySlot() {}
+ QT_TECH_PREVIEW_API void myTPSlot() {}
+};
+
+
+#endif // TECH_PREVIEW_H
diff --git a/tests/auto/tools/moc/template-gtgt.h b/tests/auto/tools/moc/template-gtgt.h
index 3f504c053b..ed2da17405 100644
--- a/tests/auto/tools/moc/template-gtgt.h
+++ b/tests/auto/tools/moc/template-gtgt.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TEMPLATE_GTGT_H
#define TEMPLATE_GTGT_H
diff --git a/tests/auto/tools/moc/testproject/Plugin/Plugin.h b/tests/auto/tools/moc/testproject/Plugin/Plugin.h
index 63534f6176..a947bf968a 100644
--- a/tests/auto/tools/moc/testproject/Plugin/Plugin.h
+++ b/tests/auto/tools/moc/testproject/Plugin/Plugin.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QObject>
struct MyInterface
diff --git a/tests/auto/tools/moc/trigraphs.h b/tests/auto/tools/moc/trigraphs.h
index 43b9d26d85..6d0ce2cf69 100644
--- a/tests/auto/tools/moc/trigraphs.h
+++ b/tests/auto/tools/moc/trigraphs.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TRIGRAPHS_H
#define TRIGRAPHS_H
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 1fb153ac09..d24dfa11f7 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -1,40 +1,18 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Copyright (C) 2020 Olivier Goffart <ogoffart@woboq.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// Copyright (C) 2020 Olivier Goffart <ogoffart@woboq.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
#include <QSignalSpy>
#include <stdio.h>
+#include <optional>
#include <qobject.h>
#include <qmetaobject.h>
#include <qjsondocument.h>
-#include <qversionnumber.h>
#include <qregularexpression.h>
+#include <qtyperevision.h>
+
+#include <private/qobject_p.h>
#include "using-namespaces.h"
#include "assign-namespace.h"
@@ -81,16 +59,69 @@
#include "fwdclass2.h"
#include "fwdclass3.h"
+#include "signal-with-default-arg.h"
+
+#include "qmlmacro.h"
+
+#include "tech-preview.h"
+
+using namespace Qt::StringLiterals;
+
#ifdef Q_MOC_RUN
// check that moc can parse these constructs, they are being used in Windows winsock2.h header
#define STRING_HASH_HASH(x) ("foo" ## x ## "bar")
const char *string_hash_hash = STRING_HASH_HASH("baz");
#endif
+#if defined(Q_MOC_RUN) || __cplusplus > 202002L
+/* Check that nested inline namespaces are at least not causing moc to break.
+ Check it even outside of C++20 mode as moc gets passed the wrong __cplusplus version
+ and also to increase coverage, given how few C++20 configurations exist in the CI at the time
+ of writing this comment.
+*/
+namespace A::inline B {}
+namespace A {
+ namespace B::inline C {}
+}
+#endif
+
+
+namespace TokenStartingWithNumber
+{
+Q_NAMESPACE
+
+#define FOR_EACH_ITEM( CALL ) \
+ CALL( EXAMPLE ) \
+ CALL( 123_EXAMPLE ) \
+ CALL( OTHER_EXAMPLE )
+
+enum FooItems
+{
+
+#define ENUM_ITEM(NAME, ...) FOO ## NAME,
+ FOR_EACH_ITEM( ENUM_ITEM )
+};
+
+Q_ENUM_NS(FooItems)
+}
+
Q_DECLARE_METATYPE(const QMetaObject*);
#define TESTEXPORTMACRO Q_DECL_EXPORT
+#if !defined(Q_MOC_RUN) && !defined(Q_NOREPLY)
+# define Q_NOREPLY
+#endif
+
+struct TagTest : QObject {
+ Q_OBJECT
+
+ Q_INVOKABLE Q_NOREPLY inline int test() {return 0;}
+public slots:
+ Q_NOREPLY virtual inline void pamOpen(int){}
+};
+
+
namespace TestNonQNamespace {
struct TestGadget {
@@ -108,6 +139,12 @@ public:
Key2
};
Q_ENUM(TestGEnum2)
+
+ enum TestGEnum3: quint8 {
+ Key1 = 23,
+ Key2
+ };
+ Q_ENUM(TestGEnum3)
};
}
@@ -126,6 +163,12 @@ namespace TestQNamespace {
};
Q_ENUM_NS(TestEnum2)
+ enum TestEnum3: qint8 {
+ Key1 = 23,
+ Key2
+ };
+ Q_ENUM_NS(TestEnum3)
+
// try to dizzy moc by adding a struct in between
struct TestGadget {
Q_GADGET
@@ -138,8 +181,13 @@ namespace TestQNamespace {
Key1 = 23,
Key2
};
+ enum TestGEnum3: qint16 {
+ Key1 = 33,
+ Key2
+ };
Q_ENUM(TestGEnum1)
Q_ENUM(TestGEnum2)
+ Q_ENUM(TestGEnum3)
};
struct TestGadgetExport {
@@ -156,6 +204,12 @@ namespace TestQNamespace {
Key2
};
Q_ENUM(TestGeEnum2)
+ enum TestGeEnum3: quint16 {
+ Key1 = 26,
+ Key2
+ };
+ Q_ENUM(TestGeEnum3)
+
};
enum class TestFlag1 {
@@ -175,6 +229,27 @@ namespace TestQNamespace {
Q_FLAG_NS(TestFlag2)
}
+namespace TestSameEnumNamespace {
+ Q_NAMESPACE
+
+ enum class TestSameEnumNamespace {
+ Key1 = 1,
+ Key2 = 2,
+ };
+ Q_ENUM_NS(TestSameEnumNamespace)
+}
+
+namespace TestNestedSameEnumNamespace {
+namespace a {
+ Q_NAMESPACE
+ // enum class with the same name as the enclosing nested namespace
+ enum class a {
+ Key11 = 11,
+ Key12 = 12,
+ };
+ Q_ENUM_NS(a)
+}
+}
namespace TestExportNamespace {
Q_NAMESPACE_EXPORT(TESTEXPORTMACRO)
@@ -205,6 +280,24 @@ public:
CreatableGadget creatableGadget; // Force the compiler to use the constructor
+struct ParentWithSignalWithArgument : QObject {
+ Q_OBJECT
+ Q_PROPERTY(int i READ i WRITE setI NOTIFY iChanged)
+
+public:
+ int i() const {return 0;}
+ void setI(int) {}
+
+signals:
+ void iChanged(int);
+};
+
+struct SignalWithArgumentInParent : ParentWithSignalWithArgument
+{
+ Q_OBJECT
+ Q_PROPERTY(int otherI READ i WRITE setI NOTIFY iChanged)
+};
+
struct MyStruct {};
struct MyStruct2 {};
@@ -324,6 +417,7 @@ class TestClassinfoWithEscapes: public QObject
Q_CLASSINFO("cpp c*/omment", "f/*oo")
Q_CLASSINFO("endswith\\", "Or?\?/")
Q_CLASSINFO("newline\n inside\n", "Or \r")
+ Q_CLASSINFO("\xffz", "\0012")
public slots:
void slotWithAReallyLongName(int)
{ }
@@ -362,6 +456,8 @@ QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wignored-qualifiers")
QT_WARNING_DISABLE_GCC("-Wignored-qualifiers")
+using ObjectCRef = const QObject &;
+
class TestClass : public MyNamespace::TestSuperClass, public DONT_CONFUSE_MOC(MyStruct),
public DONT_CONFUSE_MOC_EVEN_MORE(MyStruct2, dummy, ignored)
{
@@ -557,6 +653,7 @@ signals:
//
public slots:
void const slotWithSillyConst() {}
+ void slotTakingCRefViaTypedef(ObjectCRef o) { this->setObjectName(o.objectName()); }
public:
Q_INVOKABLE void const slotWithSillyConst2() {}
@@ -585,6 +682,10 @@ private slots:
QT_WARNING_POP
+// quick test to verify that moc handles the L suffix
+// correctly in the preprocessor
+#if 2000L < 1
+#else
class PropertyTestClass : public QObject
{
Q_OBJECT
@@ -594,6 +695,7 @@ public:
Q_ENUM(TestEnum)
};
+#endif
class PropertyUseClass : public QObject
{
@@ -686,6 +788,7 @@ private slots:
void preprocessorConditionals();
void blackslashNewlines();
void slotWithSillyConst();
+ void slotTakingCRefViaTypedef();
void testExtraData();
void testExtraDataForEnum();
void namespaceTypeProperty();
@@ -711,6 +814,7 @@ private slots:
void templateGtGt();
void qprivateslots();
void qprivateproperties();
+ void anonymousProperties();
void warnOnPropertyWithoutREAD();
void constructors();
void typenameWithUnsigned();
@@ -755,6 +859,7 @@ private slots:
void optionsFileError_data();
void optionsFileError();
void testQNamespace();
+ void testNestedQNamespace();
void cxx17Namespaces();
void cxxAttributes();
void mocJsonOutput();
@@ -764,6 +869,10 @@ private slots:
void observerMetaCall();
void setQPRopertyBinding();
void privateQPropertyShim();
+ void readWriteThroughBindable();
+ void invokableCtors();
+ void virtualInlineTaggedSlot();
+ void tokenStartingWithNumber();
signals:
void sigWithUnsignedArg(unsigned foo);
@@ -775,6 +884,7 @@ signals:
void constSignal2(int arg) const;
void member4Changed();
void member5Changed(const QString &newVal);
+ void sigWithDefaultArg(int i = 12);
private:
bool user1() { return true; };
@@ -800,6 +910,14 @@ private:
};
+#define VERIFY_NO_ERRORS(proc) do { \
+ auto &&p = proc; \
+ const QByteArray stderr = p.readAllStandardError(); \
+ QVERIFY2(stderr.isEmpty(), stderr.data()); \
+ QCOMPARE(p.exitCode(), 0); \
+ } while (false)
+
+
void tst_Moc::initTestCase()
{
QString binpath = QLibraryInfo::path(QLibraryInfo::BinariesPath);
@@ -814,10 +932,9 @@ void tst_Moc::initTestCase()
QProcess proc;
proc.start(qtpaths, QStringList() << "-query" << "QT_INSTALL_HEADERS");
QVERIFY(proc.waitForFinished());
- QCOMPARE(proc.exitCode(), 0);
+ VERIFY_NO_ERRORS(proc);
QByteArray output = proc.readAllStandardOutput();
QVERIFY(!output.isEmpty());
- QCOMPARE(proc.readAllStandardError(), QByteArray());
qtIncludePath = QString::fromLocal8Bit(output).trimmed();
QFileInfo fi(qtIncludePath);
QVERIFY(fi.exists());
@@ -852,10 +969,9 @@ void tst_Moc::oldStyleCasts()
QProcess proc;
proc.start(m_moc, QStringList(m_sourceDirectory + QStringLiteral("/oldstyle-casts.h")));
QVERIFY(proc.waitForFinished());
- QCOMPARE(proc.exitCode(), 0);
+ VERIFY_NO_ERRORS(proc);
QByteArray mocOut = proc.readAllStandardOutput();
QVERIFY(!mocOut.isEmpty());
- QCOMPARE(proc.readAllStandardError(), QByteArray());
QStringList args;
args << "-c" << "-x" << "c++" << "-Wold-style-cast" << "-I" << "."
@@ -866,8 +982,7 @@ void tst_Moc::oldStyleCasts()
proc.closeWriteChannel();
QVERIFY(proc.waitForFinished());
- QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardError()), QString());
- QCOMPARE(proc.exitCode(), 0);
+ VERIFY_NO_ERRORS(proc);
#else
QSKIP("Only tested on linux/gcc");
#endif
@@ -888,8 +1003,8 @@ void tst_Moc::warnOnExtraSignalSlotQualifiaction()
QVERIFY(!mocOut.isEmpty());
QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
QCOMPARE(mocWarning, header +
- QString(":43:1: warning: Function declaration Test::badFunctionDeclaration contains extra qualification. Ignoring as signal or slot.\n") +
- header + QString(":46:1: warning: parsemaybe: Function declaration Test::anotherOne contains extra qualification. Ignoring as signal or slot.\n"));
+ QString(":18:1: warning: Function declaration Test::badFunctionDeclaration contains extra qualification. Ignoring as signal or slot.\n") +
+ header + QString(":21:1: warning: parsemaybe: Function declaration Test::anotherOne contains extra qualification. Ignoring as signal or slot.\n"));
#else
QSKIP("Only tested on unix/gcc");
#endif
@@ -924,10 +1039,9 @@ void tst_Moc::inputFileNameWithDotsButNoExtension()
proc.setWorkingDirectory(m_sourceDirectory + QStringLiteral("/task71021"));
proc.start(m_moc, QStringList("../Header"));
QVERIFY(proc.waitForFinished());
- QCOMPARE(proc.exitCode(), 0);
+ VERIFY_NO_ERRORS(proc);
QByteArray mocOut = proc.readAllStandardOutput();
QVERIFY(!mocOut.isEmpty());
- QCOMPARE(proc.readAllStandardError(), QByteArray());
QStringList args;
args << "-c" << "-x" << "c++" << "-I" << ".."
@@ -938,8 +1052,7 @@ void tst_Moc::inputFileNameWithDotsButNoExtension()
proc.closeWriteChannel();
QVERIFY(proc.waitForFinished());
- QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardError()), QString());
- QCOMPARE(proc.exitCode(), 0);
+ VERIFY_NO_ERRORS(proc);
#else
QSKIP("Only tested on linux/gcc");
#endif
@@ -962,12 +1075,12 @@ void tst_Moc::supportConstSignals()
QSignalSpy spy1(this, SIGNAL(constSignal1()));
QVERIFY(spy1.isEmpty());
emit constSignal1();
- QCOMPARE(spy1.count(), 1);
+ QCOMPARE(spy1.size(), 1);
QSignalSpy spy2(this, SIGNAL(constSignal2(int)));
QVERIFY(spy2.isEmpty());
emit constSignal2(42);
- QCOMPARE(spy2.count(), 1);
+ QCOMPARE(spy2.size(), 1);
QCOMPARE(spy2.at(0).at(0).toInt(), 42);
}
@@ -990,13 +1103,15 @@ void tst_Moc::classinfoWithEscapes()
const QMetaObject *mobj = &TestClassinfoWithEscapes::staticMetaObject;
QCOMPARE(mobj->methodCount() - mobj->methodOffset(), 1);
- QCOMPARE(mobj->classInfoCount(), 5);
+ QCOMPARE(mobj->classInfoCount(), 6);
QCOMPARE(mobj->classInfo(2).name(), "cpp c*/omment");
QCOMPARE(mobj->classInfo(2).value(), "f/*oo");
QCOMPARE(mobj->classInfo(3).name(), "endswith\\");
QCOMPARE(mobj->classInfo(3).value(), "Or?\?/");
QCOMPARE(mobj->classInfo(4).name(), "newline\n inside\n");
QCOMPARE(mobj->classInfo(4).value(), "Or \r");
+ QCOMPARE(mobj->classInfo(5).name(), "\xff" "z");
+ QCOMPARE(mobj->classInfo(5).value(), "\001" "2");
QMetaMethod mm = mobj->method(mobj->methodOffset());
QCOMPARE(mm.methodSignature(), QByteArray("slotWithAReallyLongName(int)"));
@@ -1074,6 +1189,15 @@ void tst_Moc::slotWithSillyConst()
QVERIFY(mobj->indexOfSlot("slotWithVoidStar(void*)") != -1);
}
+void tst_Moc::slotTakingCRefViaTypedef()
+{
+ TestClass tst;
+ QObject obj;
+ obj.setObjectName("works");
+ QMetaObject::invokeMethod(&tst, "slotTakingCRefViaTypedef", Q_ARG(ObjectCRef, obj));
+ QCOMPARE(obj.objectName(), "works");
+}
+
void tst_Moc::testExtraData()
{
const QMetaObject *mobj = &PropertyTestClass::staticMetaObject;
@@ -1182,7 +1306,7 @@ void tst_Moc::warnOnMultipleInheritance()
QVERIFY(!mocOut.isEmpty());
QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
QCOMPARE(mocWarning, header +
- QString(":43:1: warning: Class Bar inherits from two QObject subclasses QWindow and Foo. This is not supported!\n"));
+ QString(":18:1: warning: Class Bar inherits from two QObject subclasses QWindow and Foo. This is not supported!\n"));
#else
QSKIP("Only tested on linux/gcc");
#endif
@@ -1205,11 +1329,7 @@ void tst_Moc::ignoreOptionClashes()
if (!finished)
qWarning("waitForFinished failed. QProcess error: %d", (int)proc.error());
QVERIFY(finished);
- if (proc.exitCode() != 0) {
- qDebug() << proc.readAllStandardError();
- }
- QCOMPARE(proc.exitCode(), 0);
- QCOMPARE(proc.readAllStandardError(), QByteArray());
+ VERIFY_NO_ERRORS(proc);
QByteArray mocOut = proc.readAllStandardOutput();
// If -pthread wasn't ignored, it was parsed as a prefix of "thread/", which breaks compilation.
@@ -1223,7 +1343,7 @@ void tst_Moc::ignoreOptionClashes()
proc.closeWriteChannel();
QVERIFY(proc.waitForFinished());
- QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardError()), QString());
+ VERIFY_NO_ERRORS(proc);
#else
QSKIP("Only tested on linux/gcc");
#endif
@@ -1246,7 +1366,7 @@ void tst_Moc::forgottenQInterface()
QVERIFY(!mocOut.isEmpty());
QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
QCOMPARE(mocWarning, header +
- QString(":45:1: warning: Class Test implements the interface MyInterface but does not list it in Q_INTERFACES. qobject_cast to MyInterface will not work!\n"));
+ QString(":20:1: warning: Class Test implements the interface MyInterface but does not list it in Q_INTERFACES. qobject_cast to MyInterface will not work!\n"));
#else
QSKIP("Only tested on linux/gcc");
#endif
@@ -1275,9 +1395,9 @@ void tst_Moc::winNewline()
QVERIFY(f.open(QIODevice::ReadOnly)); // no QIODevice::Text!
QByteArray data = f.readAll();
f.close();
- for (int i = 0; i < data.count(); ++i) {
+ for (int i = 0; i < data.size(); ++i) {
if (data.at(i) == QLatin1Char('\r')) {
- QVERIFY(i < data.count() - 1);
+ QVERIFY(i < data.size() - 1);
++i;
QCOMPARE(data.at(i), '\n');
} else {
@@ -1328,11 +1448,7 @@ void tst_Moc::frameworkSearchPath()
if (!finished)
qWarning("waitForFinished failed. QProcess error: %d", (int)proc.error());
QVERIFY(finished);
- if (proc.exitCode() != 0) {
- qDebug() << proc.readAllStandardError();
- }
- QCOMPARE(proc.exitCode(), 0);
- QCOMPARE(proc.readAllStandardError(), QByteArray());
+ VERIFY_NO_ERRORS(proc);
#else
QSKIP("Only tested/relevant on unixy platforms");
#endif
@@ -1364,11 +1480,9 @@ void tst_Moc::templateGtGt()
QProcess proc;
proc.start(m_moc, QStringList(m_sourceDirectory + QStringLiteral("/template-gtgt.h")));
QVERIFY(proc.waitForFinished());
- QCOMPARE(proc.exitCode(), 0);
+ VERIFY_NO_ERRORS(proc);
QByteArray mocOut = proc.readAllStandardOutput();
QVERIFY(!mocOut.isEmpty());
- QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
- QVERIFY(mocWarning.isEmpty());
#else
QSKIP("Only tested on unix/gcc");
#endif
@@ -1385,8 +1499,7 @@ void tst_Moc::defineMacroViaCmdline()
proc.start(m_moc, args);
QVERIFY(proc.waitForFinished());
- QCOMPARE(proc.exitCode(), 0);
- QCOMPARE(proc.readAllStandardError(), QByteArray());
+ VERIFY_NO_ERRORS(proc);
QByteArray mocOut = proc.readAllStandardOutput();
QVERIFY(!mocOut.isEmpty());
#else
@@ -1405,8 +1518,7 @@ void tst_Moc::defineMacroViaForcedInclude()
proc.start(m_moc, args);
QVERIFY(proc.waitForFinished());
- QCOMPARE(proc.exitCode(), 0);
- QCOMPARE(proc.readAllStandardError(), QByteArray());
+ VERIFY_NO_ERRORS(proc);
QByteArray mocOut = proc.readAllStandardOutput();
QVERIFY(!mocOut.isEmpty());
#else
@@ -1425,8 +1537,7 @@ void tst_Moc::defineMacroViaForcedIncludeRelative()
proc.start(m_moc, args);
QVERIFY(proc.waitForFinished());
- QCOMPARE(proc.exitCode(), 0);
- QCOMPARE(proc.readAllStandardError(), QByteArray());
+ VERIFY_NO_ERRORS(proc);
QByteArray mocOut = proc.readAllStandardOutput();
QVERIFY(!mocOut.isEmpty());
#else
@@ -1471,8 +1582,7 @@ void tst_Moc::environmentIncludePaths()
proc.setProcessEnvironment(env);
proc.start(m_moc, args);
QVERIFY(proc.waitForFinished());
- QCOMPARE(proc.exitCode(), 0);
- QCOMPARE(proc.readAllStandardError(), QByteArray());
+ VERIFY_NO_ERRORS(proc);
QByteArray mocOut = proc.readAllStandardOutput();
QVERIFY(!mocOut.isEmpty());
#else
@@ -1482,9 +1592,9 @@ void tst_Moc::environmentIncludePaths()
// tst_Moc::specifyMetaTagsFromCmdline()
// plugin_metadata.h contains a plugin which we register here. Since we're not building this
-// application as a plugin, we need top copy some of the initializer code found in qplugin.h:
-extern "C" QObject *qt_plugin_instance();
-extern "C" QPluginMetaData qt_plugin_query_metadata_v2();
+// application as a plugin, we need to copy some of the initializer code found in qplugin.h:
+extern "C" Q_DECL_EXPORT QObject *qt_plugin_instance();
+extern "C" Q_DECL_EXPORT QPluginMetaData qt_plugin_query_metadata_v2();
class StaticPluginInstance{
public:
StaticPluginInstance() {
@@ -1495,7 +1605,8 @@ public:
static StaticPluginInstance staticInstance;
void tst_Moc::specifyMetaTagsFromCmdline() {
- foreach (const QStaticPlugin &plugin, QPluginLoader::staticPlugins()) {
+ const auto staticPlugins = QPluginLoader::staticPlugins();
+ for (const QStaticPlugin &plugin : staticPlugins) {
const QString iid = plugin.metaData().value(QLatin1String("IID")).toString();
if (iid == QLatin1String("test.meta.tags")) {
const QJsonArray metaTagsUriList = plugin.metaData().value("uri").toArray();
@@ -1513,41 +1624,43 @@ void tst_Moc::specifyMetaTagsFromCmdline() {
void tst_Moc::invokable()
{
+ const int fooIndex = 4;
{
const QMetaObject &mobj = InvokableBeforeReturnType::staticMetaObject;
- QCOMPARE(mobj.methodCount(), 6);
- QCOMPARE(mobj.method(5).methodSignature(), QByteArray("foo()"));
+ QCOMPARE(mobj.methodCount(), 5);
+ QCOMPARE(mobj.method(fooIndex).methodSignature(), QByteArray("foo()"));
}
{
const QMetaObject &mobj = InvokableBeforeInline::staticMetaObject;
- QCOMPARE(mobj.methodCount(), 7);
- QCOMPARE(mobj.method(5).methodSignature(), QByteArray("foo()"));
- QCOMPARE(mobj.method(6).methodSignature(), QByteArray("bar()"));
+ QCOMPARE(mobj.methodCount(), 6);
+ QCOMPARE(mobj.method(fooIndex).methodSignature(), QByteArray("foo()"));
+ QCOMPARE(mobj.method(fooIndex + 1).methodSignature(), QByteArray("bar()"));
}
}
void tst_Moc::singleFunctionKeywordSignalAndSlot()
{
+ const int mySignalIndex = 4;
{
const QMetaObject &mobj = SingleFunctionKeywordBeforeReturnType::staticMetaObject;
- QCOMPARE(mobj.methodCount(), 7);
- QCOMPARE(mobj.method(5).methodSignature(), QByteArray("mySignal()"));
- QCOMPARE(mobj.method(6).methodSignature(), QByteArray("mySlot()"));
+ QCOMPARE(mobj.methodCount(), 6);
+ QCOMPARE(mobj.method(mySignalIndex).methodSignature(), QByteArray("mySignal()"));
+ QCOMPARE(mobj.method(mySignalIndex + 1).methodSignature(), QByteArray("mySlot()"));
}
{
const QMetaObject &mobj = SingleFunctionKeywordBeforeInline::staticMetaObject;
- QCOMPARE(mobj.methodCount(), 7);
- QCOMPARE(mobj.method(5).methodSignature(), QByteArray("mySignal()"));
- QCOMPARE(mobj.method(6).methodSignature(), QByteArray("mySlot()"));
+ QCOMPARE(mobj.methodCount(), 6);
+ QCOMPARE(mobj.method(mySignalIndex).methodSignature(), QByteArray("mySignal()"));
+ QCOMPARE(mobj.method(mySignalIndex + 1).methodSignature(), QByteArray("mySlot()"));
}
{
const QMetaObject &mobj = SingleFunctionKeywordAfterInline::staticMetaObject;
- QCOMPARE(mobj.methodCount(), 7);
- QCOMPARE(mobj.method(5).methodSignature(), QByteArray("mySignal()"));
- QCOMPARE(mobj.method(6).methodSignature(), QByteArray("mySlot()"));
+ QCOMPARE(mobj.methodCount(), 6);
+ QCOMPARE(mobj.method(mySignalIndex).methodSignature(), QByteArray("mySignal()"));
+ QCOMPARE(mobj.method(mySignalIndex + 1).methodSignature(), QByteArray("mySlot()"));
}
}
@@ -1635,6 +1748,54 @@ void tst_Moc::qprivateproperties()
QVERIFY(zapBindable.isBindable());
}
+
+class AnonymousPropertyTest1 : public QObject
+{
+ Q_OBJECT
+ QT_ANONYMOUS_PROPERTY(int READ foo WRITE setFoo)
+public:
+ int foo() { return mFoo ; }
+ void setFoo(int value) { mFoo = value; }
+
+private:
+ int mFoo = 0;
+};
+
+class AnonymousPropertyTest2 : public QObject
+{
+ Q_OBJECT
+ QT_ANONYMOUS_PRIVATE_PROPERTY(d, int READ bar WRITE setBar)
+
+ class MyDPointer {
+ public:
+ int bar() { return mBar ; }
+ void setBar(int value) { mBar = value; }
+ private:
+ int mBar = 0;
+ };
+
+public:
+ AnonymousPropertyTest2(QObject *parent = nullptr) : QObject(parent), d (new MyDPointer) {}
+ MyDPointer *d_func() {return d.data();}
+ const MyDPointer *d_func() const {return d.data();}
+
+private:
+ QScopedPointer<MyDPointer> d;
+};
+
+void tst_Moc::anonymousProperties()
+{
+ AnonymousPropertyTest1 test1;
+
+ test1.setProperty("", 17);
+ QCOMPARE(test1.property(""), QVariant::fromValue(17));
+
+ AnonymousPropertyTest2 test2;
+
+ test2.setProperty("", 27);
+ QCOMPARE(test2.property(""), QVariant::fromValue(27));
+}
+
void tst_Moc::warnOnPropertyWithoutREAD()
{
#ifdef MOC_CROSS_COMPILED
@@ -1650,7 +1811,7 @@ void tst_Moc::warnOnPropertyWithoutREAD()
QVERIFY(!mocOut.isEmpty());
QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
QCOMPARE(mocWarning, header +
- QString(":36:1: warning: Property declaration foo has neither an associated QProperty<> member, nor a READ accessor function nor an associated MEMBER variable. The property will be invalid.\n"));
+ QString(":11:1: warning: Property declaration foo has neither an associated QProperty<> member, nor a READ accessor function nor an associated MEMBER variable. The property will be invalid.\n"));
#else
QSKIP("Only tested on unix/gcc");
#endif
@@ -1760,8 +1921,8 @@ void tst_Moc::warnOnVirtualSignal()
QByteArray mocOut = proc.readAllStandardOutput();
QVERIFY(!mocOut.isEmpty());
QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
- QCOMPARE(mocWarning, header + QString(":38:1: warning: Signals cannot be declared virtual\n") +
- header + QString(":40:1: warning: Signals cannot be declared virtual\n"));
+ QCOMPARE(mocWarning, header + QString(":13:1: warning: Signals cannot be declared virtual\n") +
+ header + QString(":15:1: warning: Signals cannot be declared virtual\n"));
#else
QSKIP("Only tested on unix/gcc");
#endif
@@ -1879,11 +2040,10 @@ void tst_Moc::notifyError()
const QString header = m_sourceDirectory + QStringLiteral("/error-on-wrong-notify.h");
proc.start(m_moc, QStringList(header));
QVERIFY(proc.waitForFinished());
- QCOMPARE(proc.exitCode(), 0);
+ VERIFY_NO_ERRORS(proc);
QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
QByteArray mocOut = proc.readAllStandardOutput();
QVERIFY(!mocOut.isEmpty());
- QCOMPARE(proc.readAllStandardError(), QByteArray());
QStringList args;
args << "-c" << "-x" << "c++" << "-I" << "."
@@ -2101,7 +2261,7 @@ void tst_Moc::warnings_data()
<< QStringList()
<< 0
<< QString()
- << QString("standard input:0:1: note: No relevant classes found. No output generated.");
+ << QString("standard input: note: No relevant classes found. No output generated.");
// passing "-nn" should suppress "no relevant classes" note
QTest::newRow("-nn")
@@ -2243,7 +2403,7 @@ void tst_Moc::warnings_data()
<< QStringList()
<< 1
<< QString("IGNORE_ALL_STDOUT")
- << QString(":-1:1: error: Unexpected character in macro argument list.");
+ << QString(": error: Unexpected character in macro argument list.");
QTest::newRow("Missing header warning")
<< QByteArray("class X : public QObject { Q_OBJECT };")
@@ -2290,6 +2450,13 @@ void tst_Moc::warnings_data()
<< QString()
<< QString("standard input:3:1: error: Parse error at \"decltype\"");
+ QTest::newRow("QTBUG-36367: report correct error location")
+ << "class X { \n Q_PROPERTY(Foo* foo NONSENSE foo) \n };"_ba
+ << QStringList()
+ << 1
+ << QString()
+ << u"standard input:2:1: error: Parse error at \"NONSENSE\""_s;
+
#ifdef Q_OS_UNIX // Limit to Unix because the error message is platform-dependent
QTest::newRow("Q_PLUGIN_METADATA: unreadable file")
<< QByteArray("class X { \n Q_PLUGIN_METADATA(FILE \".\") \n };")
@@ -2370,23 +2537,29 @@ void tst_Moc::cxx11Enums_data()
QTest::addColumn<QByteArray>("enumName");
QTest::addColumn<char>("prefix");
QTest::addColumn<bool>("isScoped");
+ QTest::addColumn<bool>("isTyped");
const QMetaObject *meta1 = &CXX11Enums::staticMetaObject;
const QMetaObject *meta2 = &CXX11Enums2::staticMetaObject;
-
- QTest::newRow("EnumClass") << meta1 << QByteArray("EnumClass") << QByteArray("EnumClass") << 'A' << true;
- QTest::newRow("EnumClass 2") << meta2 << QByteArray("EnumClass") << QByteArray("EnumClass") << 'A' << true;
- QTest::newRow("TypedEnum") << meta1 << QByteArray("TypedEnum") << QByteArray("TypedEnum") << 'B' << false;
- QTest::newRow("TypedEnum 2") << meta2 << QByteArray("TypedEnum") << QByteArray("TypedEnum") << 'B' << false;
- QTest::newRow("TypedEnumClass") << meta1 << QByteArray("TypedEnumClass") << QByteArray("TypedEnumClass") << 'C' << true;
- QTest::newRow("TypedEnumClass 2") << meta2 << QByteArray("TypedEnumClass") << QByteArray("TypedEnumClass") << 'C' << true;
- QTest::newRow("NormalEnum") << meta1 << QByteArray("NormalEnum") << QByteArray("NormalEnum") << 'D' << false;
- QTest::newRow("NormalEnum 2") << meta2 << QByteArray("NormalEnum") << QByteArray("NormalEnum") << 'D' << false;
- QTest::newRow("ClassFlags") << meta1 << QByteArray("ClassFlags") << QByteArray("ClassFlag") << 'F' << true;
- QTest::newRow("ClassFlags 2") << meta2 << QByteArray("ClassFlags") << QByteArray("ClassFlag") << 'F' << true;
- QTest::newRow("EnumStruct") << meta1 << QByteArray("EnumStruct") << QByteArray("EnumStruct") << 'G' << true;
- QTest::newRow("TypedEnumStruct") << meta1 << QByteArray("TypedEnumStruct") << QByteArray("TypedEnumStruct") << 'H' << true;
- QTest::newRow("StructFlags") << meta1 << QByteArray("StructFlags") << QByteArray("StructFlag") << 'I' << true;
+ const QMetaObject *meta3 = &CXX11Enums3::staticMetaObject;
+
+ QTest::newRow("EnumClass") << meta1 << QByteArray("EnumClass") << QByteArray("EnumClass") << 'A' << true << false;
+ QTest::newRow("EnumClass 2") << meta2 << QByteArray("EnumClass") << QByteArray("EnumClass") << 'A' << true << false;
+ QTest::newRow("EnumClass 3") << meta3 << QByteArray("EnumClass") << QByteArray("EnumClass") << 'A' << true << false;
+ QTest::newRow("TypedEnum") << meta1 << QByteArray("TypedEnum") << QByteArray("TypedEnum") << 'B' << false << true;
+ QTest::newRow("TypedEnum 2") << meta2 << QByteArray("TypedEnum") << QByteArray("TypedEnum") << 'B' << false << true;
+ QTest::newRow("TypedEnum 3") << meta3 << QByteArray("TypedEnum") << QByteArray("TypedEnum") << 'B' << false << true;
+ QTest::newRow("TypedEnumClass") << meta1 << QByteArray("TypedEnumClass") << QByteArray("TypedEnumClass") << 'C' << true << true;
+ QTest::newRow("TypedEnumClass 2") << meta2 << QByteArray("TypedEnumClass") << QByteArray("TypedEnumClass") << 'C' << true << true;
+ QTest::newRow("TypedEnumClass 3") << meta3 << QByteArray("TypedEnumClass") << QByteArray("TypedEnumClass") << 'C' << true << true;
+ QTest::newRow("NormalEnum") << meta1 << QByteArray("NormalEnum") << QByteArray("NormalEnum") << 'D' << false << false;
+ QTest::newRow("NormalEnum 2") << meta2 << QByteArray("NormalEnum") << QByteArray("NormalEnum") << 'D' << false << false;
+ QTest::newRow("NormalEnum 3") << meta3 << QByteArray("NormalEnum") << QByteArray("NormalEnum") << 'D' << false << false;
+ QTest::newRow("ClassFlags") << meta1 << QByteArray("ClassFlags") << QByteArray("ClassFlag") << 'F' << true << false;
+ QTest::newRow("ClassFlags 2") << meta2 << QByteArray("ClassFlags") << QByteArray("ClassFlag") << 'F' << true << false;
+ QTest::newRow("EnumStruct") << meta1 << QByteArray("EnumStruct") << QByteArray("EnumStruct") << 'G' << true << false;
+ QTest::newRow("TypedEnumStruct") << meta1 << QByteArray("TypedEnumStruct") << QByteArray("TypedEnumStruct") << 'H' << true << true;
+ QTest::newRow("StructFlags") << meta1 << QByteArray("StructFlags") << QByteArray("StructFlag") << 'I' << true << false;
}
void tst_Moc::cxx11Enums()
@@ -2398,24 +2571,39 @@ void tst_Moc::cxx11Enums()
QFETCH(QByteArray, enumName);
QFETCH(char, prefix);
QFETCH(bool, isScoped);
+ QFETCH(bool, isTyped);
int idx = meta->indexOfEnumerator(typeName);
QVERIFY(idx != -1);
QCOMPARE(meta->indexOfEnumerator(enumName), idx);
- QCOMPARE(meta->enumerator(idx).enclosingMetaObject(), meta);
- QCOMPARE(meta->enumerator(idx).isValid(), true);
- QCOMPARE(meta->enumerator(idx).keyCount(), 4);
- QCOMPARE(meta->enumerator(idx).name(), typeName.constData());
- QCOMPARE(meta->enumerator(idx).enumName(), enumName.constData());
- bool isFlag = meta->enumerator(idx).isFlag();
+ const QMetaEnum metaEnum = meta->enumerator(idx);
+ QCOMPARE(metaEnum.enclosingMetaObject(), meta);
+ QCOMPARE(metaEnum.isValid(), true);
+ QCOMPARE(metaEnum.keyCount(), 4);
+ QCOMPARE(metaEnum.name(), typeName.constData());
+ QCOMPARE(metaEnum.enumName(), enumName.constData());
+
+ const QMetaType metaType = metaEnum.metaType();
+ const bool isUnsigned = metaType.flags() & QMetaType::IsUnsignedEnumeration;
+ if (isTyped) {
+ QCOMPARE(size_t(metaType.sizeOf()), sizeof(char));
+ QCOMPARE(isUnsigned, !std::is_signed_v<char>);
+ } else if (isScoped) {
+ QCOMPARE(size_t(metaType.sizeOf()), sizeof(int));
+ QCOMPARE(isUnsigned, !std::is_signed_v<int>);
+ } else {
+ // underlying type is implementation defined
+ }
+
+ bool isFlag = metaEnum.isFlag();
for (int i = 0; i < 4; i++) {
QByteArray v = prefix + QByteArray::number(i);
const int value = isFlag ? (1 << i) : i;
- QCOMPARE(meta->enumerator(idx).keyToValue(v), value);
- QCOMPARE(meta->enumerator(idx).valueToKey(value), v.constData());
+ QCOMPARE(metaEnum.keyToValue(v), value);
+ QCOMPARE(metaEnum.valueToKey(value), v.constData());
}
- QCOMPARE(meta->enumerator(idx).isScoped(), isScoped);
+ QCOMPARE(metaEnum.isScoped(), isScoped);
}
void tst_Moc::cxx11TrailingReturn()
@@ -2510,7 +2698,7 @@ void tst_Moc::memberProperties()
if (!signal.isEmpty())
{
- QCOMPARE(notifySpy.count(), 1);
+ QCOMPARE(notifySpy.size(), 1);
if (prop.notifySignal().parameterNames().size() > 0) {
QList<QVariant> arguments = notifySpy.takeFirst();
QCOMPARE(arguments.size(), 1);
@@ -2520,7 +2708,7 @@ void tst_Moc::memberProperties()
notifySpy.clear();
// a second write with the same value should not cause the signal to be emitted again
QCOMPARE(prop.write(pObj, writeValue), expectedWriteResult);
- QCOMPARE(notifySpy.count(), 0);
+ QCOMPARE(notifySpy.size(), 0);
}
}
@@ -3600,10 +3788,9 @@ void tst_Moc::preprocessorOnly()
QProcess proc;
proc.start(m_moc, QStringList() << "-E" << m_sourceDirectory + QStringLiteral("/pp-dollar-signs.h"));
QVERIFY(proc.waitForFinished());
- QCOMPARE(proc.exitCode(), 0);
+ VERIFY_NO_ERRORS(proc);
QByteArray mocOut = proc.readAllStandardOutput();
QVERIFY(!mocOut.isEmpty());
- QCOMPARE(proc.readAllStandardError(), QByteArray());
QVERIFY(mocOut.contains("$$ = parser->createFoo()"));
#else
@@ -3754,7 +3941,7 @@ void tst_Moc::relatedMetaObjectsNameConflict()
{
typedef QList<const QMetaObject *> QMetaObjects;
QFETCH(const QMetaObject*, dependingObject);
- QFETCH(QMetaObjects, relatedMetaObjects);
+ QFETCH(const QMetaObjects, relatedMetaObjects);
// load all specified metaobjects int a set
QSet<const QMetaObject*> dependency;
@@ -3765,7 +3952,7 @@ void tst_Moc::relatedMetaObjectsNameConflict()
}
// check if all required metaobjects are specified
- foreach (const QMetaObject *mo, relatedMetaObjects)
+ for (const QMetaObject *mo : relatedMetaObjects)
QVERIFY(dependency.contains(mo));
// check if no additional metaobjects ara specified
@@ -3832,6 +4019,7 @@ class VeryLongStringData : public QObject
#define repeat32768(V) repeat16384(V) repeat16384(V)
#define repeat65534(V) repeat32768(V) repeat16384(V) repeat8192(V) repeat4096(V) repeat2048(V) repeat1024(V) repeat512(V) repeat256(V) repeat128(V) repeat64(V) repeat32(V) repeat16(V) repeat8(V) repeat4(V) repeat2(V)
+ Q_CLASSINFO("\1" "23\xff", "String with CRLF.\r\n")
Q_CLASSINFO(repeat65534("n"), repeat65534("i"))
Q_CLASSINFO(repeat65534("e"), repeat65534("r"))
Q_CLASSINFO(repeat32768("o"), repeat32768("b"))
@@ -3880,25 +4068,26 @@ void tst_Moc::unnamedNamespaceObjectsAndGadgets()
void tst_Moc::veryLongStringData()
{
const QMetaObject *mobj = &VeryLongStringData::staticMetaObject;
- QCOMPARE(mobj->classInfoCount(), 4);
-
- QCOMPARE(mobj->classInfo(0).name()[0], 'n');
- QCOMPARE(mobj->classInfo(0).value()[0], 'i');
- QCOMPARE(mobj->classInfo(1).name()[0], 'e');
- QCOMPARE(mobj->classInfo(1).value()[0], 'r');
- QCOMPARE(mobj->classInfo(2).name()[0], 'o');
- QCOMPARE(mobj->classInfo(2).value()[0], 'b');
- QCOMPARE(mobj->classInfo(3).name()[0], ':');
- QCOMPARE(mobj->classInfo(3).value()[0], ')');
-
- QCOMPARE(strlen(mobj->classInfo(0).name()), static_cast<size_t>(65534));
- QCOMPARE(strlen(mobj->classInfo(0).value()), static_cast<size_t>(65534));
- QCOMPARE(strlen(mobj->classInfo(1).name()), static_cast<size_t>(65534));
- QCOMPARE(strlen(mobj->classInfo(1).value()), static_cast<size_t>(65534));
- QCOMPARE(strlen(mobj->classInfo(2).name()), static_cast<size_t>(32768));
- QCOMPARE(strlen(mobj->classInfo(2).value()), static_cast<size_t>(32768));
- QCOMPARE(strlen(mobj->classInfo(3).name()), static_cast<size_t>(1));
- QCOMPARE(strlen(mobj->classInfo(3).value()), static_cast<size_t>(1));
+ int startAt = 1; // some other classinfo added to the beginning
+ QCOMPARE(mobj->classInfoCount(), startAt + 4);
+
+ QCOMPARE(mobj->classInfo(startAt + 0).name()[0], 'n');
+ QCOMPARE(mobj->classInfo(startAt + 0).value()[0], 'i');
+ QCOMPARE(mobj->classInfo(startAt + 1).name()[0], 'e');
+ QCOMPARE(mobj->classInfo(startAt + 1).value()[0], 'r');
+ QCOMPARE(mobj->classInfo(startAt + 2).name()[0], 'o');
+ QCOMPARE(mobj->classInfo(startAt + 2).value()[0], 'b');
+ QCOMPARE(mobj->classInfo(startAt + 3).name()[0], ':');
+ QCOMPARE(mobj->classInfo(startAt + 3).value()[0], ')');
+
+ QCOMPARE(strlen(mobj->classInfo(startAt + 0).name()), static_cast<size_t>(65534));
+ QCOMPARE(strlen(mobj->classInfo(startAt + 0).value()), static_cast<size_t>(65534));
+ QCOMPARE(strlen(mobj->classInfo(startAt + 1).name()), static_cast<size_t>(65534));
+ QCOMPARE(strlen(mobj->classInfo(startAt + 1).value()), static_cast<size_t>(65534));
+ QCOMPARE(strlen(mobj->classInfo(startAt + 2).name()), static_cast<size_t>(32768));
+ QCOMPARE(strlen(mobj->classInfo(startAt + 2).value()), static_cast<size_t>(32768));
+ QCOMPARE(strlen(mobj->classInfo(startAt + 3).name()), static_cast<size_t>(1));
+ QCOMPARE(strlen(mobj->classInfo(startAt + 3).value()), static_cast<size_t>(1));
}
void tst_Moc::gadgetHierarchy()
@@ -3934,10 +4123,12 @@ void tst_Moc::optionsFileError()
}
static void checkEnum(const QMetaEnum &enumerator, const QByteArray &name,
- const QList<QPair<QByteArray, int>> &keys)
+ const QList<QPair<QByteArray, int>> &keys,
+ const QMetaType underlyingType = QMetaType::fromType<int>())
{
QCOMPARE(name, QByteArray{enumerator.name()});
QCOMPARE(keys.size(), enumerator.keyCount());
+ QCOMPARE(underlyingType, enumerator.metaType().underlyingType());
for (int i = 0; i < enumerator.keyCount(); ++i) {
QCOMPARE(keys[i].first, QByteArray{enumerator.key(i)});
QCOMPARE(keys[i].second, enumerator.value(i));
@@ -3952,29 +4143,57 @@ public:
FooNamespace::Enum1 prop() { return FooNamespace::Enum1::Key2; }
};
+void tst_Moc::testNestedQNamespace()
+{
+ QCOMPARE(TestSameEnumNamespace::staticMetaObject.enumeratorCount(), 1);
+ checkEnum(TestSameEnumNamespace::staticMetaObject.enumerator(0), "TestSameEnumNamespace",
+ {{"Key1", 1}, {"Key2", 2}});
+ QMetaEnum meta1 = QMetaEnum::fromType<TestSameEnumNamespace::TestSameEnumNamespace>();
+ QVERIFY(meta1.isValid());
+ QCOMPARE(meta1.name(), "TestSameEnumNamespace");
+ QCOMPARE(meta1.enclosingMetaObject(), &TestSameEnumNamespace::staticMetaObject);
+ QCOMPARE(meta1.keyCount(), 2);
+
+ // QTBUG-112996
+ QCOMPARE(TestNestedSameEnumNamespace::a::staticMetaObject.enumeratorCount(), 1);
+ checkEnum(TestNestedSameEnumNamespace::a::staticMetaObject.enumerator(0), "a",
+ {{"Key11", 11}, {"Key12", 12}});
+ QMetaEnum meta2 = QMetaEnum::fromType<TestNestedSameEnumNamespace::a::a>();
+ QVERIFY(meta2.isValid());
+ QCOMPARE(meta2.name(), "a");
+ QCOMPARE(meta2.enclosingMetaObject(), &TestNestedSameEnumNamespace::a::staticMetaObject);
+ QCOMPARE(meta2.keyCount(), 2);
+}
+
void tst_Moc::testQNamespace()
{
- QCOMPARE(TestQNamespace::staticMetaObject.enumeratorCount(), 4);
+ QCOMPARE(TestQNamespace::staticMetaObject.enumeratorCount(), 5);
checkEnum(TestQNamespace::staticMetaObject.enumerator(0), "TestEnum1",
{{"Key1", 11}, {"Key2", 12}});
checkEnum(TestQNamespace::staticMetaObject.enumerator(1), "TestEnum2",
{{"Key1", 17}, {"Key2", 18}});
- checkEnum(TestQNamespace::staticMetaObject.enumerator(2), "TestFlag1",
+ checkEnum(TestQNamespace::staticMetaObject.enumerator(2), "TestEnum3",
+ {{"Key1", 23}, {"Key2", 24}}, QMetaType::fromType<qint8>());
+ checkEnum(TestQNamespace::staticMetaObject.enumerator(3), "TestFlag1",
{{"None", 0}, {"Flag1", 1}, {"Flag2", 2}, {"Any", 1 | 2}});
- checkEnum(TestQNamespace::staticMetaObject.enumerator(3), "TestFlag2",
+ checkEnum(TestQNamespace::staticMetaObject.enumerator(4), "TestFlag2",
{{"None", 0}, {"Flag1", 4}, {"Flag2", 8}, {"Any", 4 | 8}});
- QCOMPARE(TestQNamespace::TestGadget::staticMetaObject.enumeratorCount(), 2);
+ QCOMPARE(TestQNamespace::TestGadget::staticMetaObject.enumeratorCount(), 3);
checkEnum(TestQNamespace::TestGadget::staticMetaObject.enumerator(0), "TestGEnum1",
{{"Key1", 13}, {"Key2", 14}});
checkEnum(TestQNamespace::TestGadget::staticMetaObject.enumerator(1), "TestGEnum2",
{{"Key1", 23}, {"Key2", 24}});
+ checkEnum(TestQNamespace::TestGadget::staticMetaObject.enumerator(2), "TestGEnum3",
+ {{"Key1", 33}, {"Key2", 34}}, QMetaType::fromType<qint16>());
- QCOMPARE(TestQNamespace::TestGadgetExport::staticMetaObject.enumeratorCount(), 2);
+ QCOMPARE(TestQNamespace::TestGadgetExport::staticMetaObject.enumeratorCount(), 3);
checkEnum(TestQNamespace::TestGadgetExport::staticMetaObject.enumerator(0), "TestGeEnum1",
{{"Key1", 20}, {"Key2", 21}});
checkEnum(TestQNamespace::TestGadgetExport::staticMetaObject.enumerator(1), "TestGeEnum2",
{{"Key1", 23}, {"Key2", 24}});
+ checkEnum(TestQNamespace::TestGadgetExport::staticMetaObject.enumerator(2), "TestGeEnum3",
+ {{"Key1", 26}, {"Key2", 27}}, QMetaType::fromType<quint16>());
QMetaEnum meta = QMetaEnum::fromType<TestQNamespace::TestEnum1>();
QVERIFY(meta.isValid());
@@ -4017,7 +4236,9 @@ void tst_Moc::cxx17Namespaces()
void tst_Moc::cxxAttributes()
{
+QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED
auto so = CppAttribute::staticMetaObject;
+QT_WARNING_POP
QCOMPARE(so.className(), "CppAttribute");
QCOMPARE(so.enumeratorCount(), 0);
QVERIFY(so.indexOfSignal("deprecatedSignal") != 1);
@@ -4052,9 +4273,12 @@ void tst_Moc::cxxAttributes()
void tst_Moc::mocJsonOutput()
{
- const auto readFile = [](const QString &fileName) {
+ const auto readFile = [](const QString &fileName) -> std::optional<QJsonDocument> {
QFile f(fileName);
- f.open(QIODevice::ReadOnly);
+ if (!f.open(QIODevice::ReadOnly)) {
+ qWarning() << "Could not open file" << fileName << f.errorString();
+ return std::nullopt;
+ }
return QJsonDocument::fromJson(f.readAll());
};
@@ -4070,8 +4294,10 @@ void tst_Moc::mocJsonOutput()
QVERIFY2(QFile::exists(actualFile), qPrintable(actualFile));
QVERIFY2(QFile::exists(expectedFile), qPrintable(expectedFile));
- QJsonDocument actualOutput = readFile(actualFile);
- QJsonDocument expectedOutput = readFile(expectedFile);
+ std::optional<QJsonDocument> actualOutput = readFile(actualFile);
+ QVERIFY(actualOutput);
+ std::optional<QJsonDocument> expectedOutput = readFile(expectedFile);
+ QVERIFY(expectedOutput);
const auto showPotentialDiff = [](const QJsonDocument &actual, const QJsonDocument &expected) -> QByteArray {
#if defined(Q_OS_UNIX)
@@ -4100,11 +4326,13 @@ void tst_Moc::mocJsonOutput()
return "Error waiting for diff process to finish.";
return diffProc.readAllStandardOutput();
#else
+ Q_UNUSED(actual);
+ Q_UNUSED(expected);
return "Cannot launch diff. Please check allmocs.json and allmocs_baseline.json on disk.";
#endif
};
- QVERIFY2(actualOutput == expectedOutput, showPotentialDiff(actualOutput, expectedOutput).constData());
+ QVERIFY2(*actualOutput == *expectedOutput, showPotentialDiff(*actualOutput, *expectedOutput).constData());
}
void TestFwdProperties::setProp1(const FwdClass1 &v)
@@ -4200,7 +4428,7 @@ void tst_Moc::qpropertyMembers()
instance.publicProperty.setValue(100);
QCOMPARE(prop.read(&instance).toInt(), 100);
- QCOMPARE(publicPropertySpy.count(), 1);
+ QCOMPARE(publicPropertySpy.size(), 1);
QCOMPARE(prop.metaType(), QMetaType(QMetaType::Int));
@@ -4341,6 +4569,140 @@ void tst_Moc::privateQPropertyShim()
QCOMPARE(testObject.priv.testProperty2.value(), 42);
}
+
+class BindableOnly : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int score BINDABLE scoreBindable READ default WRITE default)
+public:
+ BindableOnly(QObject *parent = nullptr)
+ : QObject(parent)
+ , m_score(4)
+ {}
+ QBindable<int> scoreBindable() { return QBindable<int>(&m_score); }
+private:
+ QProperty<int> m_score;
+};
+
+class BindableAndNotifyable : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int score BINDABLE scoreBindable NOTIFY scoreChanged READ default WRITE default)
+public:
+ BindableAndNotifyable(QObject *parent = nullptr)
+ : QObject(parent)
+ , m_score(4)
+ {}
+ QBindable<int> scoreBindable() { return QBindable<int>(&m_score); }
+signals:
+ void scoreChanged();
+private:
+ QProperty<int> m_score;
+};
+
+void tst_Moc::readWriteThroughBindable()
+{
+ {
+ BindableOnly o;
+ QCOMPARE(o.scoreBindable().value(), 4);
+ QCOMPARE(o.property("score").toInt(), 4);
+ o.scoreBindable().setValue(5);
+ QCOMPARE(o.scoreBindable().value(), 5);
+ QCOMPARE(o.property("score").toInt(), 5);
+ const QMetaObject *mo = o.metaObject();
+ const int i = mo->indexOfProperty("score");
+ QVERIFY(i > 0);
+ QMetaProperty p = mo->property(i);
+ QCOMPARE(p.name(), "score");
+ QVERIFY(p.isValid());
+ QVERIFY(p.isWritable());
+ QCOMPARE(p.read(&o), 5);
+ QVERIFY(o.setProperty("score", 6));
+ QCOMPARE(o.property("score").toInt(), 6);
+ QVERIFY(p.write(&o, 7));
+ QCOMPARE(p.read(&o), 7);
+ }
+ {
+ BindableAndNotifyable o;
+ QCOMPARE(o.scoreBindable().value(), 4);
+ QCOMPARE(o.property("score").toInt(), 4);
+ o.scoreBindable().setValue(5);
+ QCOMPARE(o.scoreBindable().value(), 5);
+ QCOMPARE(o.property("score").toInt(), 5);
+ const QMetaObject *mo = o.metaObject();
+ const int i = mo->indexOfProperty("score");
+ QVERIFY(i > 0);
+ QMetaProperty p = mo->property(i);
+ QCOMPARE(p.name(), "score");
+ QVERIFY(p.isValid());
+ QVERIFY(p.isWritable());
+ QCOMPARE(p.read(&o), 5);
+ QVERIFY(o.setProperty("score", 6));
+ QCOMPARE(o.property("score").toInt(), 6);
+ QVERIFY(p.write(&o, 7));
+ QCOMPARE(p.read(&o), 7);
+ }
+}
+
+struct WithInvokableCtor
+{
+ Q_GADGET
+ Q_PROPERTY(int thing MEMBER m_thing CONSTANT FINAL)
+public:
+ WithInvokableCtor() = default;
+ Q_INVOKABLE WithInvokableCtor(int theThing) : m_thing(theThing) {}
+
+ int m_thing = 10;
+};
+
+void tst_Moc::invokableCtors()
+{
+ const QMetaType metaType = QMetaType::fromType<WithInvokableCtor>();
+ Q_ASSERT(metaType.sizeOf() > 0);
+ const QMetaObject *metaObject = metaType.metaObject();
+ QVERIFY(metaObject);
+
+ QCOMPARE(metaObject->constructorCount(), 1);
+ WithInvokableCtor *result = nullptr;
+ const auto guard = qScopeGuard([&]() { delete result; });
+ int argument = 17;
+ void *a[] = { &result, &argument };
+ metaObject->static_metacall(QMetaObject::CreateInstance, 0, a);
+ QVERIFY(result);
+ QCOMPARE(result->m_thing, 17);
+
+ // Call dtor so that we're left with "uninitialized" memory.
+ WithInvokableCtor result2;
+ result2.~WithInvokableCtor();
+
+ void *b[] = { &result2, &argument };
+ metaObject->static_metacall(QMetaObject::ConstructInPlace, 0, b);
+ QCOMPARE(result2.m_thing, 17);
+}
+
+void tst_Moc::virtualInlineTaggedSlot()
+{
+ auto mo = TagTest::staticMetaObject;
+ auto idx = mo.indexOfMethod("pamOpen(int)");
+ auto method = mo.method(idx);
+ QVERIFY(method.isValid()); // fails!
+ QCOMPARE(method.tag(), "Q_NOREPLY");
+ idx = mo.indexOfMethod("test()");
+ method = mo.method(idx);
+ QVERIFY(method.isValid());
+ QCOMPARE(method.tag(), "Q_NOREPLY");
+ QCOMPARE(method.returnMetaType(), QMetaType::fromType<int>());
+}
+
+void tst_Moc::tokenStartingWithNumber()
+{
+ auto *mo = &TokenStartingWithNumber::staticMetaObject;
+ int index = mo->indexOfEnumerator("FooItems");
+ QMetaEnum metaEnum = mo->enumerator(index);
+ QVERIFY(metaEnum.isValid());
+ QCOMPARE(metaEnum.keyCount(), 3);
+}
+
QTEST_MAIN(tst_Moc)
// the generated code must compile with QT_NO_KEYWORDS
diff --git a/tests/auto/tools/moc/unterminated-function-macro.h b/tests/auto/tools/moc/unterminated-function-macro.h
index da8e4c9e93..2cb0579449 100644
--- a/tests/auto/tools/moc/unterminated-function-macro.h
+++ b/tests/auto/tools/moc/unterminated-function-macro.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef UNTERMINATED_FUNCTION_MACRO_H
#define UNTERMINATED_FUNCTION_MACRO_H
diff --git a/tests/auto/tools/moc/using-namespaces.h b/tests/auto/tools/moc/using-namespaces.h
index 5bd42012ce..eaba403dff 100644
--- a/tests/auto/tools/moc/using-namespaces.h
+++ b/tests/auto/tools/moc/using-namespaces.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef USING_NAMESPACES_H
#define USING_NAMESPACES_H
diff --git a/tests/auto/tools/moc/warn-on-multiple-qobject-subclasses.h b/tests/auto/tools/moc/warn-on-multiple-qobject-subclasses.h
index 5f9bab5e2f..0e45036768 100644
--- a/tests/auto/tools/moc/warn-on-multiple-qobject-subclasses.h
+++ b/tests/auto/tools/moc/warn-on-multiple-qobject-subclasses.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef WARN_ON_MULTIPLE_QOBJECT_SUBCLASSES_H
#define WARN_ON_MULTIPLE_QOBJECT_SUBCLASSES_H
diff --git a/tests/auto/tools/moc/warn-on-property-without-read.h b/tests/auto/tools/moc/warn-on-property-without-read.h
index 0fd12e624b..19a3a305bd 100644
--- a/tests/auto/tools/moc/warn-on-property-without-read.h
+++ b/tests/auto/tools/moc/warn-on-property-without-read.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef WARN_ON_PROPERTY_WITHOUT_READ_H
#define WARN_ON_PROPERTY_WITHOUT_READ_H
diff --git a/tests/auto/tools/moc/win-newlines.h b/tests/auto/tools/moc/win-newlines.h
index 2e41f2f83e..353c21dbbb 100644
--- a/tests/auto/tools/moc/win-newlines.h
+++ b/tests/auto/tools/moc/win-newlines.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QObject>