diff options
Diffstat (limited to 'tests/auto/tools/moc')
76 files changed, 4955 insertions, 1984 deletions
diff --git a/tests/auto/tools/moc/.gitignore b/tests/auto/tools/moc/.gitignore index 86a604a776..59a275bc62 100644 --- a/tests/auto/tools/moc/.gitignore +++ b/tests/auto/tools/moc/.gitignore @@ -1 +1,2 @@ tst_moc +allmocs.json diff --git a/tests/auto/tools/moc/CMakeLists.txt b/tests/auto/tools/moc/CMakeLists.txt new file mode 100644 index 0000000000..1377c48306 --- /dev/null +++ b/tests/auto/tools/moc/CMakeLists.txt @@ -0,0 +1,159 @@ +# 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 + c-comments.h + cstyle-enums.h + cxx11-enums.h + cxx11-explicit-override-control.h + cxx11-final-classes.h + cxx11-trailing-return.h + cxx17-namespaces.h + dir-in-include-path.h + escapes-in-string-literals.h + enum_with_include.h + forward-declared-param.h + function-with-attributes.h + gadgetwithnoenums.h + grand-parent-gadget-class.h + moc_include.h + namespace.h + namespaced-flags.h + namespaced-base-class.h + no-keywords.h + non-gadget-parent-class.h + oldstyle-casts.h + parse-defines.h + plugin_metadata.h + pointery_to_incomplete.h + pure-virtual-signals.h + qinvokable.h + qprivateslots.h + qtbug-35657-gadget.h + 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 + task192552.h + task234909.h + task240368.h + task87883.h + trigraphs.h + using-namespaces.h +) + +qt_wrap_cpp(comparison_relevant_moc_list ${JSON_HEADERS} + TARGET tst_moc + OPTIONS + "-Muri=com.company.app" + "-Muri=com.company.app.private" + "-DDEFINE_CMDLINE_EMPTY=" + "-DDEFINE_CMDLINE_SIGNAL=void cmdlineSignal(const QMap<int, int> &i)" + "--output-json" +) + +list(TRANSFORM comparison_relevant_moc_list APPEND ".json" OUTPUT_VARIABLE moc_json_files) + +qt_internal_add_test(tst_moc + SOURCES + cxx-attributes.h + tst_moc.cpp + ${comparison_relevant_moc_list} + INCLUDE_DIRECTORIES + testproject + testproject/include + MOC_OPTIONS + "-Muri=com.company.app" + "-Muri=com.company.app.private" + "-DDEFINE_CMDLINE_EMPTY=" + "-DDEFINE_CMDLINE_SIGNAL=void cmdlineSignal(const QMap<int, int> &i)" + "--output-json" + EXCEPTIONS +) + +qt_internal_extend_target(tst_moc LIBRARIES Qt::CorePrivate) + +qt_internal_extend_target(tst_moc CONDITION CMAKE_CROSSCOMPILING + DEFINES + MOC_CROSS_COMPILED +) + +if (UNIX AND (CLANG OR GCC OR QCC)) + qt_wrap_cpp(os9_moc os9-newlines.h) +endif() + +qt_internal_extend_target(tst_moc CONDITION UNIX AND (CLANG OR GCC OR QCC) + SOURCES + os9-newlines.h + win-newlines.h + ${os9_moc} +) + +qt_internal_extend_target(tst_moc CONDITION CLANG OR GCC + SOURCES + dollars.h +) + +qt_internal_extend_target(tst_moc CONDITION TARGET Qt::DBus + LIBRARIES + Qt::DBus +) + +qt_internal_extend_target(tst_moc CONDITION TARGET Qt::Concurrent + LIBRARIES + Qt::Concurrent +) + +qt_internal_extend_target(tst_moc CONDITION TARGET Qt::Network + LIBRARIES + Qt::Network +) + +qt_internal_extend_target(tst_moc CONDITION TARGET Qt::Sql + LIBRARIES + Qt::Sql +) + +get_target_property(target_binary_dir tst_moc BINARY_DIR) +set(cmake_autogen_cache_file + "${target_binary_dir}/CMakeFiles/tst_moc_autogen.dir/ParseCache.txt") +set(cmake_autogen_info_file + "${target_binary_dir}/CMakeFiles/tst_moc_autogen.dir/AutogenInfo.json") +set(moc_json_out ${target_binary_dir}/moc_json_out) + +file(REMOVE ${moc_json_out}) +foreach(filename ${moc_json_files}) + file(APPEND ${moc_json_out} "${filename}\n") +endforeach() + +set(metatype_file "allmocs.json") +configure_file("allmocs_baseline_in.json" "${target_binary_dir}/allmocs_baseline.json") + +add_custom_command(TARGET tst_moc + POST_BUILD + COMMAND ${QT_CMAKE_EXPORT_NAMESPACE}::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 new file mode 100644 index 0000000000..5cbcb99e68 --- /dev/null +++ b/tests/auto/tools/moc/allmocs_baseline_in.json @@ -0,0 +1,3038 @@ +[ + { + "classes": [ + { + "className": "BackslashNewlines", + "object": true, + "qualifiedClassName": "BackslashNewlines", + "slots": [ + { + "access": "public", + "name": "works", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "backslash-newlines.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "IfdefedClass", + "object": true, + "qualifiedClassName": "IfdefedClass", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "c-comments.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "CStyleEnums", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "Baz", + "values": [ + "Foo", + "Bar" + ] + }, + { + "isClass": false, + "isFlag": false, + "name": "Baz2", + "values": [ + "Foo2", + "Bar2" + ] + } + ], + "gadget": true, + "qualifiedClassName": "CStyleEnums" + } + ], + "inputFile": "cstyle-enums.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "CXX11Enums", + "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" + ] + }, + { + "alias": "ClassFlag", + "isClass": true, + "isFlag": true, + "name": "ClassFlags", + "values": [ + "F0", + "F1", + "F2", + "F3" + ] + }, + { + "isClass": true, + "isFlag": false, + "name": "EnumStruct", + "values": [ + "G0", + "G1", + "G2", + "G3" + ] + }, + { + "isClass": true, + "isFlag": false, + "name": "TypedEnumStruct", + "type": "char", + "values": [ + "H0", + "H1", + "H2", + "H3" + ] + }, + { + "alias": "StructFlag", + "isClass": true, + "isFlag": true, + "name": "StructFlags", + "values": [ + "I0", + "I1", + "I2", + "I3" + ] + } + ], + "gadget": true, + "qualifiedClassName": "CXX11Enums" + }, + { + "className": "CXX11Enums2", + "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" + ] + }, + { + "alias": "ClassFlag", + "isClass": true, + "isFlag": true, + "name": "ClassFlags", + "values": [ + "F0", + "F1", + "F2", + "F3" + ] + } + ], + "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", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "ExplicitOverrideControlBase", + "object": true, + "qualifiedClassName": "ExplicitOverrideControlBase", + "slots": [ + { + "access": "private", + "name": "pureSlot0", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot1", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot2", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot3", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "ExplicitOverrideControlFinalQt", + "object": true, + "qualifiedClassName": "ExplicitOverrideControlFinalQt", + "slots": [ + { + "access": "private", + "name": "pureSlot0", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot1", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot2", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot3", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "ExplicitOverrideControlBase" + } + ] + }, + { + "className": "ExplicitOverrideControlFinalCxx11", + "object": true, + "qualifiedClassName": "ExplicitOverrideControlFinalCxx11", + "slots": [ + { + "access": "private", + "name": "pureSlot0", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot1", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot2", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot3", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "ExplicitOverrideControlBase" + } + ] + }, + { + "className": "ExplicitOverrideControlSealed", + "object": true, + "qualifiedClassName": "ExplicitOverrideControlSealed", + "slots": [ + { + "access": "private", + "name": "pureSlot0", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot1", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot2", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot3", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "ExplicitOverrideControlBase" + } + ] + }, + { + "className": "ExplicitOverrideControlOverrideQt", + "object": true, + "qualifiedClassName": "ExplicitOverrideControlOverrideQt", + "slots": [ + { + "access": "private", + "name": "pureSlot0", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot1", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot2", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot3", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "ExplicitOverrideControlBase" + } + ] + }, + { + "className": "ExplicitOverrideControlOverrideCxx11", + "object": true, + "qualifiedClassName": "ExplicitOverrideControlOverrideCxx11", + "slots": [ + { + "access": "private", + "name": "pureSlot0", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot1", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot2", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot3", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "ExplicitOverrideControlBase" + } + ] + }, + { + "className": "ExplicitOverrideControlFinalQtOverrideQt", + "object": true, + "qualifiedClassName": "ExplicitOverrideControlFinalQtOverrideQt", + "slots": [ + { + "access": "private", + "name": "pureSlot0", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot1", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot2", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot3", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "ExplicitOverrideControlBase" + } + ] + }, + { + "className": "ExplicitOverrideControlFinalCxx11OverrideCxx11", + "object": true, + "qualifiedClassName": "ExplicitOverrideControlFinalCxx11OverrideCxx11", + "slots": [ + { + "access": "private", + "name": "pureSlot0", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot1", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot2", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot3", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "ExplicitOverrideControlBase" + } + ] + }, + { + "className": "ExplicitOverrideControlSealedOverride", + "object": true, + "qualifiedClassName": "ExplicitOverrideControlSealedOverride", + "slots": [ + { + "access": "private", + "name": "pureSlot0", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot1", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot2", + "returnType": "void" + }, + { + "access": "private", + "name": "pureSlot3", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "ExplicitOverrideControlBase" + } + ] + } + ], + "inputFile": "cxx11-explicit-override-control.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "FinalTestClassQt", + "object": true, + "qualifiedClassName": "FinalTestClassQt", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "ExportedFinalTestClassQt", + "object": true, + "qualifiedClassName": "ExportedFinalTestClassQt", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "ExportedFinalTestClassQtX", + "object": true, + "qualifiedClassName": "ExportedFinalTestClassQtX", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "FinalTestClassCpp11", + "object": true, + "qualifiedClassName": "FinalTestClassCpp11", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "ExportedFinalTestClassCpp11", + "object": true, + "qualifiedClassName": "ExportedFinalTestClassCpp11", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "ExportedFinalTestClassCpp11X", + "object": true, + "qualifiedClassName": "ExportedFinalTestClassCpp11X", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "SealedTestClass", + "object": true, + "qualifiedClassName": "SealedTestClass", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "ExportedSealedTestClass", + "object": true, + "qualifiedClassName": "ExportedSealedTestClass", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "ExportedSealedTestClassX", + "object": true, + "qualifiedClassName": "ExportedSealedTestClassX", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "cxx11-final-classes.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "CXX11TrailingReturn", + "object": true, + "qualifiedClassName": "CXX11TrailingReturn", + "signals": [ + { + "access": "public", + "arguments": [ + { + "name": "i", + "type": "int" + } + ], + "name": "trailingSignalReturn", + "returnType": "void" + } + ], + "slots": [ + { + "access": "public", + "name": "fun", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "name": "i", + "type": "int" + }, + { + "name": "b", + "type": "char" + } + ], + "name": "arguments", + "returnType": "int" + }, + { + "access": "public", + "arguments": [ + { + "name": "i", + "type": "int" + } + ], + "name": "inlineFunc", + "returnType": "int" + }, + { + "access": "public", + "name": "constRefReturn", + "returnType": "void" + }, + { + "access": "public", + "name": "constConstRefReturn", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "cxx11-trailing-return.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "ClassInNamespace", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "GadEn", + "values": [ + "Value" + ] + } + ], + "gadget": true, + "qualifiedClassName": "CXX17Namespace::A::B::C::D::ClassInNamespace" + }, + { + "className": "D", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "NamEn", + "values": [ + "Value" + ] + } + ], + "namespace": true, + "qualifiedClassName": "CXX17Namespace::A::B::C::D" + } + ], + "inputFile": "cxx17-namespaces.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "DirInIncludePath", + "interfaces": [ + [ + { + "className": "MyInterface", + "id": "\"MyInterface\"" + } + ] + ], + "object": true, + "qualifiedClassName": "DirInIncludePath", + "superClasses": [ + { + "access": "public", + "name": "QObject" + }, + { + "access": "public", + "name": "MyInterface" + } + ] + } + ], + "inputFile": "dir-in-include-path.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "Foo", + "object": true, + "qualifiedClassName": "Foo", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "enum_with_include.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "classInfos": [ + { + "name": "Test", + "value": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\x53" + }, + { + "name": "Test2", + "value": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\123" + }, + { + "name": "Test3", + "value": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\nb" + } + ], + "className": "StringLiterals", + "object": true, + "qualifiedClassName": "StringLiterals", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "escapes-in-string-literals.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "ForwardDeclaredParamClass", + "object": true, + "qualifiedClassName": "ForwardDeclaredParamClass", + "signals": [ + { + "access": "public", + "arguments": [ + { + "type": "ForwardDeclaredParam" + } + ], + "name": "signalNaked", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "ForwardDeclaredContainer<ForwardDeclaredParam>" + } + ], + "name": "signalFDC", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "ForwardDeclaredContainer<int>" + } + ], + "name": "signalFDC", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "ForwardDeclaredContainer<QString>" + } + ], + "name": "signalFDC", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "ForwardDeclaredContainer<FullyDefined>" + } + ], + "name": "signalFDC", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "QSet<ForwardDeclaredParam>" + } + ], + "name": "signalQSet", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "QSet<int>" + } + ], + "name": "signalQSet", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "QSet<QString>" + } + ], + "name": "signalQSet", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "QSet<FullyDefined>" + } + ], + "name": "signalQSet", + "returnType": "void" + } + ], + "slots": [ + { + "access": "public", + "arguments": [ + { + "type": "ForwardDeclaredParam" + } + ], + "name": "slotNaked", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "ForwardDeclaredContainer<ForwardDeclaredParam>" + } + ], + "name": "slotFDC", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "ForwardDeclaredContainer<int>" + } + ], + "name": "slotFDC", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "ForwardDeclaredContainer<QString>" + } + ], + "name": "slotFDC", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "ForwardDeclaredContainer<FullyDefined>" + } + ], + "name": "slotFDC", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "QSet<ForwardDeclaredParam>" + } + ], + "name": "slotQSet", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "QSet<int>" + } + ], + "name": "slotQSet", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "QSet<QString>" + } + ], + "name": "slotQSet", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "QSet<FullyDefined>" + } + ], + "name": "slotQSet", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "forward-declared-param.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "FunctionWithAttributes", + "object": true, + "qualifiedClassName": "FunctionWithAttributes", + "slots": [ + { + "access": "public", + "name": "test1", + "returnType": "void" + }, + { + "access": "public", + "name": "test2", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "function-with-attributes.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "GadgetWithNoEnums", + "gadget": true, + "qualifiedClassName": "GadgetWithNoEnums" + }, + { + "className": "DerivedGadgetWithEnums", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "FooEnum", + "values": [ + "FooValue" + ] + } + ], + "gadget": true, + "qualifiedClassName": "DerivedGadgetWithEnums", + "superClasses": [ + { + "access": "public", + "name": "GadgetWithNoEnums" + } + ] + } + ], + "inputFile": "gadgetwithnoenums.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "BaseGadget", + "gadget": true, + "qualifiedClassName": "GrandParentGadget::BaseGadget" + }, + { + "className": "DerivedGadget", + "gadget": true, + "qualifiedClassName": "GrandParentGadget::DerivedGadget", + "superClasses": [ + { + "access": "public", + "name": "Derived" + } + ] + }, + { + "className": "CRTPDerivedGadget", + "gadget": true, + "qualifiedClassName": "GrandParentGadget::CRTPDerivedGadget", + "superClasses": [ + { + "access": "public", + "name": "CRTP<CRTPDerivedGadget>" + } + ] + } + ], + "inputFile": "grand-parent-gadget-class.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "TestFwdProperties", + "object": true, + "properties": [ + { + "constant": false, + "designable": true, + "final": false, + "index": 0, + "name": "prop1", + "read": "getProp1", + "required": false, + "scriptable": true, + "stored": true, + "type": "FwdClass1", + "user": false, + "write": "setProp1" + }, + { + "constant": false, + "designable": true, + "final": false, + "index": 1, + "name": "prop2", + "read": "getProp2", + "required": false, + "scriptable": true, + "stored": true, + "type": "FwdClass2", + "user": false, + "write": "setProp2" + }, + { + "constant": false, + "designable": true, + "final": false, + "index": 2, + "name": "prop3", + "read": "getProp3", + "required": false, + "scriptable": true, + "stored": true, + "type": "FwdClass3", + "user": false, + "write": "setProp3" + } + ], + "qualifiedClassName": "TestFwdProperties", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "SomeRandomNamespace", + "namespace": true, + "qualifiedClassName": "SomeRandomNamespace" + } + ], + "inputFile": "moc_include.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "FooNamespace", + "enums": [ + { + "isClass": true, + "isFlag": false, + "name": "Enum1", + "values": [ + "Key1", + "Key2" + ] + } + ], + "namespace": true, + "qualifiedClassName": "FooNamespace" + }, + { + "className": "FooNestedNamespace", + "enums": [ + { + "isClass": true, + "isFlag": false, + "name": "Enum2", + "values": [ + "Key3", + "Key4" + ] + }, + { + "isClass": true, + "isFlag": false, + "name": "Enum3", + "values": [ + "Key5", + "Key6" + ] + } + ], + "namespace": true, + "qualifiedClassName": "FooNamespace::FooNestedNamespace" + }, + { + "className": "FooMoreNestedNamespace", + "enums": [ + { + "isClass": true, + "isFlag": false, + "name": "Enum4", + "values": [ + "Key7", + "Key8" + ] + } + ], + "namespace": true, + "qualifiedClassName": "FooNamespace::FooNestedNamespace::FooMoreNestedNamespace" + } + ], + "inputFile": "namespace.h", + "outputRevision": 68 + }, + { + "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": [ + { + "alias": "Flag", + "isClass": false, + "isFlag": true, + "name": "Flags", + "values": [ + "Read", + "Write" + ] + } + ], + "object": true, + "properties": [ + { + "constant": false, + "designable": true, + "final": false, + "index": 0, + "name": "flags", + "read": "flags", + "required": false, + "scriptable": true, + "stored": true, + "type": "Flags", + "user": false, + "write": "setFlags" + } + ], + "qualifiedClassName": "Foo::Bar", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "Baz", + "object": true, + "properties": [ + { + "constant": false, + "designable": true, + "final": false, + "index": 0, + "name": "flags", + "read": "flags", + "required": false, + "scriptable": true, + "stored": true, + "type": "Foo::Bar::Flags", + "user": false, + "write": "setFlags" + }, + { + "constant": false, + "designable": true, + "final": false, + "index": 1, + "name": "flagsList", + "read": "flagsList", + "required": false, + "scriptable": true, + "stored": true, + "type": "QList<Foo::Bar::Flags>", + "user": false, + "write": "setFlagsList" + } + ], + "qualifiedClassName": "Foo::Baz", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "namespaced-flags.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "MyBooooooostishClass", + "object": true, + "qualifiedClassName": "MyBooooooostishClass", + "signals": [ + { + "access": "public", + "name": "mySignal", + "returnType": "void" + } + ], + "slots": [ + { + "access": "public", + "name": "mySlot", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "no-keywords.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "Derived", + "gadget": true, + "qualifiedClassName": "NonGadgetParent::Derived", + "superClasses": [ + { + "access": "public", + "name": "Base" + } + ] + } + ], + "inputFile": "non-gadget-parent-class.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "OldStyleCast", + "object": true, + "qualifiedClassName": "OldStyleCast", + "slots": [ + { + "access": "public", + "name": "foo", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "int" + }, + { + "type": "int*" + }, + { + "type": "const int*" + }, + { + "type": "volatile int*" + }, + { + "type": "const int*volatile*" + } + ], + "name": "bar", + "returnType": "int" + }, + { + "access": "public", + "arguments": [ + { + "type": "int" + }, + { + "type": "QObject*" + } + ], + "name": "slot", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "oldstyle-casts.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "classInfos": [ + { + "name": "TestString", + "value": "PD_CLASSNAME" + }, + { + "name": "TestString2", + "value": "ParseDefine" + }, + { + "name": "TestString3", + "value": "TestValue" + } + ], + "className": "ParseDefine", + "object": true, + "qualifiedClassName": "PD::ParseDefine", + "signals": [ + { + "access": "public", + "arguments": [ + { + "name": "i", + "type": "QMap<int,int>" + } + ], + "name": "cmdlineSignal", + "returnType": "void" + }, + { + "access": "public", + "name": "signalQTBUG55853", + "returnType": "void" + } + ], + "slots": [ + { + "access": "public", + "name": "voidFunction", + "returnType": "void" + }, + { + "access": "public", + "name": "stringMethod", + "returnType": "QString" + }, + { + "access": "public", + "name": "combined1", + "returnType": "void" + }, + { + "access": "public", + "name": "combined2", + "returnType": "void" + }, + { + "access": "public", + "name": "combined3", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "int" + }, + { + "type": "int" + } + ], + "name": "combined4", + "returnType": "void" + }, + { + "access": "public", + "name": "combined5", + "returnType": "void" + }, + { + "access": "public", + "name": "combined6", + "returnType": "void" + }, + { + "access": "public", + "name": "vararg1", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "int" + } + ], + "name": "vararg2", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "int" + }, + { + "type": "int" + } + ], + "name": "vararg3", + "returnType": "void" + }, + { + "access": "public", + "name": "vararg4", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "int" + } + ], + "name": "vararg5", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "int" + }, + { + "type": "int" + } + ], + "name": "vararg6", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "int" + } + ], + "name": "INNERFUNCTION", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "int" + } + ], + "name": "inner_expanded", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "int" + } + ], + "name": "expanded_method", + "returnType": "void" + }, + { + "access": "public", + "name": "conditionSlot", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "int" + } + ], + "name": "PD_DEFINE_ITSELF_SUFFIX", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "parse-defines.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "TestPluginMetaData", + "object": true, + "qualifiedClassName": "TestPluginMetaData", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "plugin_metadata.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "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", + "name": "QObject" + } + ] + } + ], + "inputFile": "pointery_to_incomplete.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "PureVirtualSignalsTest", + "object": true, + "qualifiedClassName": "PureVirtualSignalsTest", + "signals": [ + { + "access": "public", + "name": "mySignal", + "returnType": "void" + }, + { + "access": "public", + "name": "myOtherSignal", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "name": "foo", + "type": "int" + } + ], + "name": "mySignal2", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "PureVirtualSignalsImpl", + "object": true, + "qualifiedClassName": "PureVirtualSignalsImpl", + "signals": [ + { + "access": "public", + "name": "mySignal", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "name": "foo", + "type": "int" + } + ], + "name": "mySignal2", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "PureVirtualSignalsTest" + } + ] + } + ], + "inputFile": "pure-virtual-signals.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "InvokableBeforeReturnType", + "methods": [ + { + "access": "public", + "name": "foo", + "returnType": "const char*" + } + ], + "object": true, + "qualifiedClassName": "InvokableBeforeReturnType", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "InvokableBeforeInline", + "methods": [ + { + "access": "public", + "name": "foo", + "returnType": "void" + }, + { + "access": "public", + "name": "bar", + "returnType": "void" + } + ], + "object": true, + "qualifiedClassName": "InvokableBeforeInline", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "qinvokable.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "TestQPrivateSlots", + "methods": [ + { + "access": "private", + "name": "method1", + "returnType": "void" + } + ], + "object": true, + "qualifiedClassName": "TestQPrivateSlots", + "slots": [ + { + "access": "private", + "name": "_q_privateslot", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "qprivateslots.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "A", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "SomeEnum", + "values": [ + "SomeEnumValue" + ] + } + ], + "gadget": true, + "qualifiedClassName": "QTBUG_35657::A" + } + ], + "inputFile": "qtbug-35657-gadget.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "B", + "object": true, + "properties": [ + { + "constant": false, + "designable": true, + "final": false, + "index": 0, + "name": "blah", + "read": "blah", + "required": false, + "scriptable": true, + "stored": true, + "type": "A::SomeEnum", + "user": false + } + ], + "qualifiedClassName": "QTBUG_35657::B", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "related-metaobjects-in-gadget.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "A", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "SomeEnum", + "values": [ + "SomeEnumValue" + ] + } + ], + "object": true, + "qualifiedClassName": "QTBUG_2151::A", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "B", + "object": true, + "properties": [ + { + "constant": false, + "designable": true, + "final": false, + "index": 0, + "name": "blah", + "read": "blah", + "required": false, + "scriptable": true, + "stored": true, + "type": "A::SomeEnum", + "user": false + } + ], + "qualifiedClassName": "QTBUG_2151::B", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "related-metaobjects-in-namespaces.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "Gadget", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "SomeEnum", + "values": [ + "SomeEnumValue" + ] + } + ], + "gadget": true, + "qualifiedClassName": "Unsused::Gadget" + }, + { + "className": "Object", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "SomeEnum", + "values": [ + "SomeEnumValue" + ] + } + ], + "object": true, + "qualifiedClassName": "Unsused::Object", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "Gadget", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "SomeEnum", + "values": [ + "SomeEnumValue" + ] + } + ], + "gadget": true, + "qualifiedClassName": "NS1::Nested::Gadget" + }, + { + "className": "Object", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "SomeEnum", + "values": [ + "SomeEnumValue" + ] + } + ], + "object": true, + "qualifiedClassName": "NS1::Nested::Object", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "Gadget", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "SomeEnum", + "values": [ + "SomeEnumValue" + ] + } + ], + "gadget": true, + "qualifiedClassName": "NS1::NestedUnsused::Gadget" + }, + { + "className": "Object", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "SomeEnum", + "values": [ + "SomeEnumValue" + ] + } + ], + "object": true, + "qualifiedClassName": "NS1::NestedUnsused::Object", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "Gadget", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "SomeEnum", + "values": [ + "SomeEnumValue" + ] + } + ], + "gadget": true, + "qualifiedClassName": "NS1::Gadget" + }, + { + "className": "Object", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "SomeEnum", + "values": [ + "SomeEnumValue" + ] + } + ], + "object": true, + "qualifiedClassName": "NS1::Object", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "DependingObject", + "object": true, + "properties": [ + { + "constant": false, + "designable": true, + "final": false, + "index": 0, + "name": "gadgetPoperty", + "read": "gadgetPoperty", + "required": false, + "scriptable": true, + "stored": true, + "type": "Gadget::SomeEnum", + "user": false + }, + { + "constant": false, + "designable": true, + "final": false, + "index": 1, + "name": "objectPoperty", + "read": "objectPoperty", + "required": false, + "scriptable": true, + "stored": true, + "type": "Object::SomeEnum", + "user": false + } + ], + "qualifiedClassName": "NS1::DependingObject", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "DependingNestedGadget", + "object": true, + "properties": [ + { + "constant": false, + "designable": true, + "final": false, + "index": 0, + "name": "nestedGadgetPoperty", + "read": "nestedGadgetPoperty", + "required": false, + "scriptable": true, + "stored": true, + "type": "Nested::Gadget::SomeEnum", + "user": false + } + ], + "qualifiedClassName": "NS1::DependingNestedGadget", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "DependingNestedObject", + "object": true, + "properties": [ + { + "constant": false, + "designable": true, + "final": false, + "index": 0, + "name": "nestedObjectPoperty", + "read": "nestedObjectPoperty", + "required": false, + "scriptable": true, + "stored": true, + "type": "Nested::Object::SomeEnum", + "user": false + } + ], + "qualifiedClassName": "NS1::DependingNestedObject", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "Gadget", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "SomeEnum", + "values": [ + "SomeEnumValue" + ] + } + ], + "gadget": true, + "qualifiedClassName": "NS2::Nested::Gadget" + }, + { + "className": "Object", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "SomeEnum", + "values": [ + "SomeEnumValue" + ] + } + ], + "object": true, + "qualifiedClassName": "NS2::Nested::Object", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "Gadget", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "SomeEnum", + "values": [ + "SomeEnumValue" + ] + } + ], + "gadget": true, + "qualifiedClassName": "NS2::NestedUnsused::Gadget" + }, + { + "className": "Object", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "SomeEnum", + "values": [ + "SomeEnumValue" + ] + } + ], + "object": true, + "qualifiedClassName": "NS2::NestedUnsused::Object", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "Gadget", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "SomeEnum", + "values": [ + "SomeEnumValue" + ] + } + ], + "gadget": true, + "qualifiedClassName": "NS2::Gadget" + }, + { + "className": "Object", + "enums": [ + { + "isClass": false, + "isFlag": false, + "name": "SomeEnum", + "values": [ + "SomeEnumValue" + ] + } + ], + "object": true, + "qualifiedClassName": "NS2::Object", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "DependingObject", + "object": true, + "properties": [ + { + "constant": false, + "designable": true, + "final": false, + "index": 0, + "name": "gadgetPoperty", + "read": "gadgetPoperty", + "required": false, + "scriptable": true, + "stored": true, + "type": "Gadget::SomeEnum", + "user": false + }, + { + "constant": false, + "designable": true, + "final": false, + "index": 1, + "name": "objectPoperty", + "read": "objectPoperty", + "required": false, + "scriptable": true, + "stored": true, + "type": "Object::SomeEnum", + "user": false + } + ], + "qualifiedClassName": "NS2::DependingObject", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "DependingNestedGadget", + "object": true, + "properties": [ + { + "constant": false, + "designable": true, + "final": false, + "index": 0, + "name": "nestedGadgetPoperty", + "read": "nestedGadgetPoperty", + "required": false, + "scriptable": true, + "stored": true, + "type": "Nested::Gadget::SomeEnum", + "user": false + } + ], + "qualifiedClassName": "NS2::DependingNestedGadget", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "DependingNestedObject", + "object": true, + "properties": [ + { + "constant": false, + "designable": true, + "final": false, + "index": 0, + "name": "nestedObjectPoperty", + "read": "nestedObjectPoperty", + "required": false, + "scriptable": true, + "stored": true, + "type": "Nested::Object::SomeEnum", + "user": false + } + ], + "qualifiedClassName": "NS2::DependingNestedObject", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "related-metaobjects-name-conflict.h", + "outputRevision": 68 + }, + { + "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": [ + { + "isClass": false, + "isFlag": false, + "name": "Salaries", + "values": [ + "Steve" + ] + } + ], + "object": true, + "qualifiedClassName": "KDAB", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "single-quote-digit-separator-n3781.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "SingleFunctionKeywordBeforeReturnType", + "object": true, + "qualifiedClassName": "SingleFunctionKeywordBeforeReturnType", + "signals": [ + { + "access": "public", + "name": "mySignal", + "returnType": "void" + } + ], + "slots": [ + { + "access": "public", + "name": "mySlot", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "SingleFunctionKeywordBeforeInline", + "object": true, + "qualifiedClassName": "SingleFunctionKeywordBeforeInline", + "signals": [ + { + "access": "public", + "name": "mySignal", + "returnType": "void" + } + ], + "slots": [ + { + "access": "public", + "name": "mySlot", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "SingleFunctionKeywordAfterInline", + "object": true, + "qualifiedClassName": "SingleFunctionKeywordAfterInline", + "signals": [ + { + "access": "public", + "name": "mySignal", + "returnType": "void" + } + ], + "slots": [ + { + "access": "public", + "name": "mySlot", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "single_function_keyword.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "SlotsWithVoidTemplateTest", + "object": true, + "qualifiedClassName": "SlotsWithVoidTemplateTest", + "signals": [ + { + "access": "public", + "arguments": [ + { + "type": "TestTemplate<void>" + } + ], + "name": "mySignal", + "returnType": "void" + }, + { + "access": "public", + "name": "myVoidSignal", + "returnType": "void" + }, + { + "access": "public", + "name": "myVoidSignal2", + "returnType": "void" + } + ], + "slots": [ + { + "access": "public", + "name": "dummySlot", + "returnType": "void" + }, + { + "access": "public", + "name": "dummySlot2", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "TestTemplate<void>" + } + ], + "name": "anotherSlot", + "returnType": "void" + }, + { + "access": "public", + "name": "mySlot", + "returnType": "TestTemplate<void>" + } + ], + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "slots-with-void-template.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "Task192552", + "object": true, + "qualifiedClassName": "Task192552", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "task192552.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "TestObject", + "object": true, + "qualifiedClassName": "NS_A::NS_B::TestObject", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + }, + { + "className": "TestMain", + "object": true, + "qualifiedClassName": "NS_A::NS_Main::TestMain", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "task234909.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "TypenameWithUnsigned", + "object": true, + "qualifiedClassName": "TypenameWithUnsigned", + "slots": [ + { + "access": "public", + "arguments": [ + { + "type": "uint" + } + ], + "name": "a", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "name": "u", + "type": "uint" + } + ], + "name": "b", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "uint*" + } + ], + "name": "c", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "name": "p", + "type": "uint*" + } + ], + "name": "d", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "uint&" + } + ], + "name": "e", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "name": "r", + "type": "uint&" + } + ], + "name": "f", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "unsigned1" + } + ], + "name": "g", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "name": "u1", + "type": "unsigned1" + } + ], + "name": "h", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "uint" + }, + { + "type": "unsigned1" + } + ], + "name": "i", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "unsigned1" + }, + { + "type": "uint" + } + ], + "name": "j", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "unsignedQImage" + } + ], + "name": "k", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "name": "uqi", + "type": "unsignedQImage" + } + ], + "name": "l", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "task240368.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "Task87883", + "object": true, + "qualifiedClassName": "Task87883", + "superClasses": [ + { + "access": "public", + "name": "QObject" + } + ] + } + ], + "inputFile": "task87883.h", + "outputRevision": 68 + }, + { + "classes": [ + { + "className": "Foo", + "object": true, + "qualifiedClassName": "BBB::Foo", + "signals": [ + { + "access": "public", + "arguments": [ + { + "type": "QList<QList<int>>" + } + ], + "name": "foo", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "QList<QList<int>>" + } + ], + "name": "foo2", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "QList<::AAA::BaseA*>" + } + ], + "name": "bar", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "QList<::AAA::BaseA*>" + } + ], + "name": "bar2", + "returnType": "void" + }, + { + "access": "public", + "arguments": [ + { + "type": "QList<const ::AAA::BaseA*>" + } + ], + "name": "bar3", + "returnType": "void" + } + ], + "superClasses": [ + { + "access": "public", + "name": "QObject" + }, + { + "access": "public", + "name": "::AAA::BaseA" + } + ] + } + ], + "inputFile": "trigraphs.h", + "outputRevision": 68 + } +] 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 081d80dc7a..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 @@ -53,4 +28,10 @@ public slots: #endif // BACKSLASH_NEWLINES_H -// ends with \\\r should not make moc crash (QTBUG-53441) (no new lines on purpose!!) \
\ No newline at end of file +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!!) \ + +QT_WARNING_POP 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 new file mode 100644 index 0000000000..54649b93fa --- /dev/null +++ b/tests/auto/tools/moc/cxx-attributes.h @@ -0,0 +1,89 @@ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#ifndef CXXATTRIBUTE_H +#define CXXATTRIBUTE_H + +#include <QtCore/QObject> + +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wunknown-attributes") +QT_WARNING_DISABLE_GCC("-Wattributes") + +class [[deprecated]] CppAttribute : public QObject +{ + Q_OBJECT +signals: + [[deprecated]] void deprecatedSignal(); + +public slots: + [[deprecated]] void deprecatedSlot() {} + [[deprecated]] [[tst_moc::maybe_unused]] int deprecatedSlot2() { return 42; } + [[deprecated("reason")]] void deprecatedReason() {} + [[deprecated("reason[")]] void deprecatedReasonWithLBRACK() {} + [[deprecated("reason[[")]] void deprecatedReasonWith2LBRACK() {} + [[deprecated("reason]")]] void deprecatedReasonWithRBRACK() {} + [[deprecated("reason]]")]] void deprecatedReasonWith2RBRACK() {} + void slotWithArguments([[tst_moc::maybe_unused]] int) {} +#if !defined(_MSC_VER) || _MSC_VER >= 1912 + // On MSVC it causes: + // moc_cxx-attributes.cpp(133): fatal error C1001: An internal error has occurred in the compiler. + Q_INVOKABLE [[tst_moc::noreturn]] void noreturnSlot() { throw "unused"; } + [[tst_moc::noreturn]] Q_SCRIPTABLE void noreturnSlot2() { throw "unused"; } + [[deprecated]] int returnInt() { return 0; } + Q_SLOT [[tst_moc::noreturn]] [[deprecated]] void noreturnDeprecatedSlot() { throw "unused"; } + Q_INVOKABLE void noreturnSlot3() [[tst_moc::noreturn]] { throw "unused"; } +#endif +}; + +QT_WARNING_POP + +#ifdef Q_MOC_RUN +# define TEST_COMPILER_DEPRECATION [[deprecated]] +# define TEST_COMPILER_DEPRECATION_X(x) [[deprecated(x)]] +#else +# define TEST_COMPILER_DEPRECATION Q_DECL_ENUMERATOR_DEPRECATED +# define TEST_COMPILER_DEPRECATION_X(x) Q_DECL_ENUMERATOR_DEPRECATED_X(x) +#endif + +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED + +namespace TestQNamespaceDeprecated { + Q_NAMESPACE + enum class TestEnum1 { + Key1 = 11, + Key2 TEST_COMPILER_DEPRECATION, + Key3 TEST_COMPILER_DEPRECATION_X("reason"), + Key4 TEST_COMPILER_DEPRECATION_X("reason["), + Key5 TEST_COMPILER_DEPRECATION_X("reason[["), + Key6 TEST_COMPILER_DEPRECATION_X("reason]"), + Key7 TEST_COMPILER_DEPRECATION_X("reason]]"), + }; + Q_ENUM_NS(TestEnum1) + + // try to dizzy moc by adding a struct in between + struct TestGadget { + Q_GADGET + public: + enum class TestGEnum1 { + Key1 = 13, + Key2 TEST_COMPILER_DEPRECATION, + Key3 TEST_COMPILER_DEPRECATION_X("reason") + }; + Q_ENUM(TestGEnum1) + }; + + enum class TestFlag1 { + None = 0, + Flag1 = 1, + Flag2 TEST_COMPILER_DEPRECATION = 2, + Flag3 TEST_COMPILER_DEPRECATION_X("reason") = 3, + Any = Flag1 | Flag2 | Flag3 + }; + Q_FLAG_NS(TestFlag1) +} + +QT_WARNING_POP + +#endif // CXXATTRIBUTE_H diff --git a/tests/auto/tools/moc/cxx11-enums.h b/tests/auto/tools/moc/cxx11-enums.h index cc14c0acda..7547ed81c1 100644 --- a/tests/auto/tools/moc/cxx11-enums.h +++ b/tests/auto/tools/moc/cxx11-enums.h @@ -1,36 +1,10 @@ -/**************************************************************************** -** -** 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 #include <QtCore/QObject> -#if defined(Q_COMPILER_CLASS_ENUM) || defined(Q_MOC_RUN) class CXX11Enums { Q_GADGET @@ -73,21 +47,20 @@ public: Q_FLAGS(ClassFlags) }; -#else -//workaround to get the moc compiled code to compile -class CXX11Enums +class CXX11Enums3 : public QObject { - Q_GADGET + Q_OBJECT public: - struct EnumClass { enum { A0, A1, A2, A3 }; }; - struct TypedEnumClass { enum { C0, C1, C2, C3 }; }; + 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 TypedEnum { B0, B1 , B2, B3 }; -}; + enum class ClassFlag { F0 = 1, F1 = 2, F2 = 4, F3 = 8 }; -class CXX11Enums2 : public CXX11Enums -{ - Q_GADGET + Q_ENUM(EnumClass) + Q_ENUM(TypedEnum) + Q_ENUM(TypedEnumClass) + Q_ENUM(NormalEnum) }; -#endif + #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 2211112717..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 @@ -36,11 +11,14 @@ # define sealed #endif +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wsuggest-override") + class ExplicitOverrideControlBase : public QObject { Q_OBJECT public: - explicit ExplicitOverrideControlBase(QObject *parent = 0) + explicit ExplicitOverrideControlBase(QObject *parent = nullptr) : QObject(parent) {} private Q_SLOTS: @@ -62,7 +40,7 @@ class ExplicitOverrideControlFinalQt : public ExplicitOverrideControlBase { Q_OBJECT public: - explicit ExplicitOverrideControlFinalQt(QObject *parent = 0) + explicit ExplicitOverrideControlFinalQt(QObject *parent = nullptr) : ExplicitOverrideControlBase(parent) {} private Q_SLOTS: @@ -84,7 +62,7 @@ class ExplicitOverrideControlFinalCxx11 : public ExplicitOverrideControlBase { Q_OBJECT public: - explicit ExplicitOverrideControlFinalCxx11(QObject *parent = 0) + explicit ExplicitOverrideControlFinalCxx11(QObject *parent = nullptr) : ExplicitOverrideControlBase(parent) {} private Q_SLOTS: @@ -106,7 +84,7 @@ class ExplicitOverrideControlSealed : public ExplicitOverrideControlBase { Q_OBJECT public: - explicit ExplicitOverrideControlSealed(QObject *parent = 0) + explicit ExplicitOverrideControlSealed(QObject *parent = nullptr) : ExplicitOverrideControlBase(parent) {} private Q_SLOTS: @@ -128,7 +106,7 @@ class ExplicitOverrideControlOverrideQt : public ExplicitOverrideControlBase { Q_OBJECT public: - explicit ExplicitOverrideControlOverrideQt(QObject *parent = 0) + explicit ExplicitOverrideControlOverrideQt(QObject *parent = nullptr) : ExplicitOverrideControlBase(parent) {} private Q_SLOTS: @@ -150,7 +128,7 @@ class ExplicitOverrideControlOverrideCxx11 : public ExplicitOverrideControlBase { Q_OBJECT public: - explicit ExplicitOverrideControlOverrideCxx11(QObject *parent = 0) + explicit ExplicitOverrideControlOverrideCxx11(QObject *parent = nullptr) : ExplicitOverrideControlBase(parent) {} private Q_SLOTS: @@ -172,7 +150,7 @@ class ExplicitOverrideControlFinalQtOverrideQt : public ExplicitOverrideControlB { Q_OBJECT public: - explicit ExplicitOverrideControlFinalQtOverrideQt(QObject *parent = 0) + explicit ExplicitOverrideControlFinalQtOverrideQt(QObject *parent = nullptr) : ExplicitOverrideControlBase(parent) {} private Q_SLOTS: @@ -194,7 +172,7 @@ class ExplicitOverrideControlFinalCxx11OverrideCxx11 : public ExplicitOverrideCo { Q_OBJECT public: - explicit ExplicitOverrideControlFinalCxx11OverrideCxx11(QObject *parent = 0) + explicit ExplicitOverrideControlFinalCxx11OverrideCxx11(QObject *parent = nullptr) : ExplicitOverrideControlBase(parent) {} private Q_SLOTS: @@ -216,7 +194,7 @@ class ExplicitOverrideControlSealedOverride : public ExplicitOverrideControlBase { Q_OBJECT public: - explicit ExplicitOverrideControlSealedOverride(QObject *parent = 0) + explicit ExplicitOverrideControlSealedOverride(QObject *parent = nullptr) : ExplicitOverrideControlBase(parent) {} private Q_SLOTS: @@ -234,6 +212,8 @@ private Q_SLOTS: #endif }; +QT_WARNING_POP + #ifndef Q_MOC_RUN # undef final # undef sealed diff --git a/tests/auto/tools/moc/cxx11-final-classes.h b/tests/auto/tools/moc/cxx11-final-classes.h index 0e1d8a7787..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 @@ -41,7 +16,7 @@ class FinalTestClassQt Q_DECL_FINAL : public QObject { Q_OBJECT public: - explicit FinalTestClassQt(QObject *parent = 0) + explicit FinalTestClassQt(QObject *parent = nullptr) : QObject(parent) {} }; @@ -50,7 +25,7 @@ class EXPORT_MACRO ExportedFinalTestClassQt Q_DECL_FINAL : public QObject { Q_OBJECT public: - explicit ExportedFinalTestClassQt(QObject *parent = 0) + explicit ExportedFinalTestClassQt(QObject *parent = nullptr) : QObject(parent) {} }; @@ -58,7 +33,7 @@ class EXPORT_MACRO2(X,Y,Z) ExportedFinalTestClassQtX Q_DECL_FINAL : public QObje { Q_OBJECT public: - explicit ExportedFinalTestClassQtX(QObject *parent = 0) + explicit ExportedFinalTestClassQtX(QObject *parent = nullptr) : QObject(parent) {} }; @@ -66,7 +41,7 @@ class FinalTestClassCpp11 final : public QObject { Q_OBJECT public: - explicit FinalTestClassCpp11(QObject *parent = 0) + explicit FinalTestClassCpp11(QObject *parent = nullptr) : QObject(parent) {} }; @@ -74,7 +49,7 @@ class EXPORT_MACRO ExportedFinalTestClassCpp11 final : public QObject { Q_OBJECT public: - explicit ExportedFinalTestClassCpp11(QObject *parent = 0) + explicit ExportedFinalTestClassCpp11(QObject *parent = nullptr) : QObject(parent) {} }; @@ -82,7 +57,7 @@ class EXPORT_MACRO2(X,Y,Z) ExportedFinalTestClassCpp11X final : public QObject { Q_OBJECT public: - explicit ExportedFinalTestClassCpp11X(QObject *parent = 0) + explicit ExportedFinalTestClassCpp11X(QObject *parent = nullptr) : QObject(parent) {} }; @@ -90,7 +65,7 @@ class SealedTestClass sealed : public QObject { Q_OBJECT public: - explicit SealedTestClass(QObject *parent = 0) + explicit SealedTestClass(QObject *parent = nullptr) : QObject(parent) {} }; @@ -98,7 +73,7 @@ class EXPORT_MACRO ExportedSealedTestClass sealed : public QObject { Q_OBJECT public: - explicit ExportedSealedTestClass(QObject *parent = 0) + explicit ExportedSealedTestClass(QObject *parent = nullptr) : QObject(parent) {} }; @@ -106,7 +81,7 @@ class EXPORT_MACRO2(X,Y,Z) ExportedSealedTestClassX sealed : public QObject { Q_OBJECT public: - explicit ExportedSealedTestClassX(QObject *parent = 0) + explicit ExportedSealedTestClassX(QObject *parent = nullptr) : QObject(parent) {} }; diff --git a/tests/auto/tools/moc/cxx11-trailing-return.h b/tests/auto/tools/moc/cxx11-trailing-return.h new file mode 100644 index 0000000000..f8ee031dae --- /dev/null +++ b/tests/auto/tools/moc/cxx11-trailing-return.h @@ -0,0 +1,43 @@ +// 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 +#include <QtCore/QObject> + +class CXX11TrailingReturn : public QObject +{ + Q_OBJECT +public slots: + inline auto fun() -> void; + inline auto arguments(int i, char b) -> int; + inline auto inlineFunc(int i) -> int + { + return i + 1; + } + + inline auto constRefReturn() -> const CXX11TrailingReturn & + { + return *this; + } + + inline auto constConstRefReturn() const -> const CXX11TrailingReturn & + { + return *this; + } + +signals: + auto trailingSignalReturn(int i) -> void; +}; + +auto CXX11TrailingReturn::fun() -> void +{ + return; +} + +auto CXX11TrailingReturn::arguments(int i, char b) -> int +{ + return i + int(b); +} + +#endif // 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_inc.h b/tests/auto/tools/moc/enum_inc.h new file mode 100644 index 0000000000..2b355b7a19 --- /dev/null +++ b/tests/auto/tools/moc/enum_inc.h @@ -0,0 +1,4 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +parcel = 42, +part = 12, diff --git a/tests/auto/tools/moc/enum_with_include.h b/tests/auto/tools/moc/enum_with_include.h new file mode 100644 index 0000000000..7cf6bf512c --- /dev/null +++ b/tests/auto/tools/moc/enum_with_include.h @@ -0,0 +1,19 @@ +// 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 +#include <QtCore/QObject> + +class Foo : public QObject { + enum en { + #include <enum_inc.h> + }; + + enum class en2 { + #include <enum_inc.h> + reference = 42 + }; + Q_OBJECT +}; +#endif 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 3c10b7be1f..e494b18ba5 100644 --- a/tests/auto/tools/moc/forward-declared-param.h +++ b/tests/auto/tools/moc/forward-declared-param.h @@ -1,35 +1,11 @@ -/**************************************************************************** -** -** 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 #include <qobject.h> #include <qmetatype.h> +Q_MOC_INCLUDE("forwarddeclaredparam.h") // test support for const refs to forward-declared structs in parameters @@ -37,6 +13,8 @@ struct ForwardDeclaredParam; template <typename T> class ForwardDeclaredContainer; struct FullyDefined {}; +inline size_t qHash(const FullyDefined &, size_t seed = 0) { return seed; } +inline bool operator==(const FullyDefined &, const FullyDefined &) { return true; } Q_DECLARE_METATYPE(FullyDefined) class ForwardDeclaredParamClass : public QObject diff --git a/tests/auto/tools/moc/forwarddeclaredparam.h b/tests/auto/tools/moc/forwarddeclaredparam.h new file mode 100644 index 0000000000..94caae8a5b --- /dev/null +++ b/tests/auto/tools/moc/forwarddeclaredparam.h @@ -0,0 +1,7 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#ifndef FORWARDDECLAREDPARAM_H +#define FORWARDDECLAREDPARAM_H +struct ForwardDeclaredParam {}; +template <typename T> class ForwardDeclaredContainer {}; +#endif 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 new file mode 100644 index 0000000000..eaaa7c380f --- /dev/null +++ b/tests/auto/tools/moc/fwdclass1.h @@ -0,0 +1,13 @@ +// 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" +#endif +#define FWDCLASS1_H + +class FwdClass1 +{ +public: + int x; +}; diff --git a/tests/auto/tools/moc/fwdclass2.h b/tests/auto/tools/moc/fwdclass2.h new file mode 100644 index 0000000000..588f5b4de3 --- /dev/null +++ b/tests/auto/tools/moc/fwdclass2.h @@ -0,0 +1,13 @@ +// 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" +#endif +#define FWDCLASS2_H + +class FwdClass2 +{ +public: + int x; +}; diff --git a/tests/auto/tools/moc/fwdclass3.h b/tests/auto/tools/moc/fwdclass3.h new file mode 100644 index 0000000000..5ecdb2ce6e --- /dev/null +++ b/tests/auto/tools/moc/fwdclass3.h @@ -0,0 +1,13 @@ +// 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" +#endif +#define FWDCLASS3_H + +class FwdClass3 +{ +public: + int x; +}; 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 7ffd636ca1..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 @@ -36,7 +11,8 @@ namespace GrandParentGadget { struct BaseGadget { Q_GADGET }; struct Derived : BaseGadget {}; struct DerivedGadget : Derived { Q_GADGET }; - +template<typename T> struct CRTP : BaseGadget {}; +struct CRTPDerivedGadget : CRTP<CRTPDerivedGadget> { Q_GADGET }; } #endif // 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.pro b/tests/auto/tools/moc/moc.pro deleted file mode 100644 index 3cbc9ebb5e..0000000000 --- a/tests/auto/tools/moc/moc.pro +++ /dev/null @@ -1,51 +0,0 @@ -CONFIG += testcase -TARGET = tst_moc - -#exists(/usr/include/boost/spirit.hpp) { -# message("including boost headers in test") -# DEFINES += PARSE_BOOST -# # need to add explicitly so that it ends up in moc's search path -# INCLUDEPATH += /usr/include -#} - -INCLUDEPATH += testproject/include testproject - -cross_compile: DEFINES += MOC_CROSS_COMPILED - -HEADERS += using-namespaces.h no-keywords.h task87883.h c-comments.h backslash-newlines.h oldstyle-casts.h \ - slots-with-void-template.h qinvokable.h namespaced-flags.h trigraphs.h \ - escapes-in-string-literals.h cstyle-enums.h qprivateslots.h gadgetwithnoenums.h \ - dir-in-include-path.h single_function_keyword.h task192552.h task189996.h \ - task234909.h task240368.h pure-virtual-signals.h cxx11-enums.h \ - cxx11-final-classes.h \ - cxx11-explicit-override-control.h \ - forward-declared-param.h \ - parse-defines.h \ - function-with-attributes.h \ - plugin_metadata.h \ - single-quote-digit-separator-n3781.h \ - related-metaobjects-in-namespaces.h \ - qtbug-35657-gadget.h \ - non-gadget-parent-class.h grand-parent-gadget-class.h \ - related-metaobjects-in-gadget.h \ - related-metaobjects-name-conflict.h \ - namespace.h cxx17-namespaces.h - - -if(*-g++*|*-icc*|*-clang*|*-llvm):!win32-*: HEADERS += os9-newlines.h win-newlines.h -if(*-g++*|*-clang*): HEADERS += dollars.h -SOURCES += tst_moc.cpp - -QT = core testlib -qtHaveModule(dbus): QT += dbus -qtHaveModule(concurrent): QT += concurrent -qtHaveModule(network): QT += network -qtHaveModule(sql): QT += sql - -# tst_Moc::specifyMetaTagsFromCmdline() -# Ensure that plugin_metadata.h are moc-ed with some extra -M arguments: -QMAKE_MOC_OPTIONS += -Muri=com.company.app -Muri=com.company.app.private - -# Define macro on the command lines used in parse-defines.h -QMAKE_MOC_OPTIONS += "-DDEFINE_CMDLINE_EMPTY=" "\"-DDEFINE_CMDLINE_SIGNAL=void cmdlineSignal(const QMap<int, int> &i)\"" - diff --git a/tests/auto/tools/moc/moc_include.h b/tests/auto/tools/moc/moc_include.h new file mode 100644 index 0000000000..398459766e --- /dev/null +++ b/tests/auto/tools/moc/moc_include.h @@ -0,0 +1,49 @@ +// 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 + +#include <QObject> + +class FwdClass1; +class FwdClass2; +class FwdClass3; + +Q_MOC_INCLUDE(fwdclass3.h) + +namespace SomeRandomNamespace { +Q_MOC_INCLUDE("fwdclass1.h") +Q_NAMESPACE +} + +class TestFwdProperties : public QObject +{ + Q_OBJECT + Q_PROPERTY(FwdClass1 prop1 WRITE setProp1 READ getProp1) + Q_PROPERTY(FwdClass2 prop2 WRITE setProp2 READ getProp2) + Q_PROPERTY(FwdClass3 prop3 WRITE setProp3 READ getProp3) +public: + ~TestFwdProperties(); + + void setProp1(const FwdClass1 &val); + void setProp2(const FwdClass2 &val); + void setProp3(const FwdClass3 &val); + const FwdClass1 &getProp1() { return *prop1; } + const FwdClass2 &getProp2() { return *prop2; } + const FwdClass3 &getProp3() { return *prop3; } + + QScopedPointer<FwdClass1> prop1; + QScopedPointer<FwdClass2> prop2; + QScopedPointer<FwdClass3> prop3; + + Q_MOC_INCLUDE( + \ + "fwdclass2.h" + ) + +}; + +Q_MOC_INCLUDE(<QString>) + +#endif // 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 ca77056503..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 @@ -69,8 +44,8 @@ public Q_SLOTS: inline void mySlot() { mySignal(); } private: - int signals; - double slots; + Q_DECL_UNUSED_MEMBER int signals; + Q_DECL_UNUSED_MEMBER double slots; }; #define signals Q_SIGNALS 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..2da70f6a89 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 +// REUSE-IgnoreStart
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
// REUSE-IgnoreEnd
#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 7b0fa29d7c..238d33246f 100644 --- a/tests/auto/tools/moc/parse-defines.h +++ b/tests/auto/tools/moc/parse-defines.h @@ -1,35 +1,11 @@ -/**************************************************************************** -** -** 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 #include <qobject.h> +Q_MOC_INCLUDE(<QMap>) // this is intentionally ugly to test moc's preprocessing capabilities #define PD_NAMESPACE PD @@ -51,7 +27,6 @@ #define PD_CLASSINFO Q_CLASSINFO -#if defined(Q_COMPILER_VARIADIC_MACROS) || defined (Q_MOC_RUN) #define PD_VARARG(x, ...) x(__VA_ARGS__) #if defined(Q_CC_GNU) || defined(Q_MOC_RUN) @@ -61,7 +36,6 @@ #define PD_VARARGEXT(x, ...) x(__VA_ARGS__) #endif -#endif #define PD_ADD_SUFFIX(x) PD_DEFINE1(x,_SUFFIX) #define PD_DEFINE_ITSELF PD_ADD_SUFFIX(PD_DEFINE_ITSELF) @@ -100,7 +74,6 @@ public slots: PD_TEST_IDENTIFIER_ARG(void, combined6()) {} -#if defined(Q_COMPILER_VARIADIC_MACROS) || defined (Q_MOC_RUN) PD_VARARG(void vararg1) {} PD_VARARG(void vararg2, int) {} PD_VARARG(void vararg3, int, int) {} @@ -108,14 +81,6 @@ public slots: PD_VARARGEXT(void vararg4) {} PD_VARARGEXT(void vararg5, int) {} PD_VARARGEXT(void vararg6, int, int) {} -#else - void vararg1() {} - void vararg2(int) {} - void vararg3(int,int) {} - void vararg4() {} - void vararg5(int) {} - void vararg6(int,int) {} -#endif #define OUTERFUNCTION(x) x #define INNERFUNCTION(x) OUTERFUNCTION(x) 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 new file mode 100644 index 0000000000..5d0ac859d6 --- /dev/null +++ b/tests/auto/tools/moc/pointery_to_incomplete.h @@ -0,0 +1,27 @@ +// 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 + +#include <QObject> +#include <QSharedPointer> +#include <QWeakPointer> +#include <QPointer> + +class FwdClass; + +class TestPointeeCanBeIncomplete : public QObject +{ + Q_OBJECT +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 d514ee8a04..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 @@ -45,7 +20,7 @@ class PureVirtualSignalsImpl : public PureVirtualSignalsTest Q_OBJECT public: signals: - void mySignal(); - void mySignal2(int foo); + void mySignal() override; + void mySignal2(int foo) override; }; #endif // 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 fd1c726b44..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 @@ -33,7 +8,7 @@ struct TestQPrivateSlots_Private { - void _q_privateslot() {}; + void _q_privateslot() {} }; class TestQPrivateSlots: public QObject 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 ec1a0ac628..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 @@ -47,7 +22,10 @@ class SingleFunctionKeywordBeforeInline : public QObject public: inline SingleFunctionKeywordBeforeInline() {} +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wundefined-inline") Q_SIGNAL inline void mySignal(); +QT_WARNING_POP Q_SLOT inline void mySlot() { emit mySignal(); } }; @@ -58,7 +36,10 @@ class SingleFunctionKeywordAfterInline : public QObject public: inline SingleFunctionKeywordAfterInline() {} +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wundefined-inline") inline Q_SIGNAL void mySignal(); +QT_WARNING_POP inline Q_SLOT void mySlot() { emit mySignal(); } }; 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/subdir/extradefines.h b/tests/auto/tools/moc/subdir/extradefines.h index e7888ce80d..efad23be6f 100644 --- a/tests/auto/tools/moc/subdir/extradefines.h +++ b/tests/auto/tools/moc/subdir/extradefines.h @@ -1 +1,3 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #define FOO 1 diff --git a/tests/auto/tools/moc/task189996.h b/tests/auto/tools/moc/task189996.h deleted file mode 100644 index f94a051b3a..0000000000 --- a/tests/auto/tools/moc/task189996.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ -// inline functions can have throw declarations - -#ifndef TASK189996_H -#define TASK189996_H - -#include <QObject> - -class InlineSlotsWithThrowDeclaration : public QObject -{ - Q_OBJECT - -public slots: - void a() throw() { } - void b() const throw() { } - void c() throw(); - void d() throw(int) { } - void e() const throw(int,double) { } -}; - -#endif 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 411b8c4266..ed2da17405 100644 --- a/tests/auto/tools/moc/template-gtgt.h +++ b/tests/auto/tools/moc/template-gtgt.h @@ -1,43 +1,18 @@ -/**************************************************************************** -** -** 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 template<class TYPE, size_t COUNT> class myTemplate : QString, - QVector<TYPE, QList<COUNT>> + QList<TYPE, QList<COUNT>> {}; template<class TYPE, size_t COUNT> class myTemplate2 : QString, - QVector<TYPE, QList< (4 >> 2) >> + QList<TYPE, QList< (4 >> 2) >> {}; class Widget : public QWidget 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 41bc4bc73b..d24dfa11f7 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -1,38 +1,18 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** 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$ -** -****************************************************************************/ - - - -#include <QtTest/QtTest> +// 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 <qregularexpression.h> +#include <qtyperevision.h> + +#include <private/qobject_p.h> #include "using-namespaces.h" #include "assign-namespace.h" @@ -40,7 +20,6 @@ #include "single_function_keyword.h" #include "backslash-newlines.h" #include "slots-with-void-template.h" -#include "pure-virtual-signals.h" #include "qinvokable.h" // msvc and friends crap out on it #if !defined(Q_CC_GNU) || defined(Q_OS_WIN) @@ -61,6 +40,7 @@ #include "cxx11-enums.h" #include "cxx11-final-classes.h" #include "cxx11-explicit-override-control.h" +#include "cxx11-trailing-return.h" #include "parse-defines.h" #include "related-metaobjects-in-namespaces.h" @@ -71,6 +51,21 @@ #include "grand-parent-gadget-class.h" #include "namespace.h" #include "cxx17-namespaces.h" +#include "cxx-attributes.h" + +#include "moc_include.h" +#include "pointery_to_incomplete.h" +#include "fwdclass1.h" +#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 @@ -78,8 +73,55 @@ 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 { @@ -97,6 +139,12 @@ public: Key2 }; Q_ENUM(TestGEnum2) + + enum TestGEnum3: quint8 { + Key1 = 23, + Key2 + }; + Q_ENUM(TestGEnum3) }; } @@ -115,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 @@ -127,8 +181,35 @@ namespace TestQNamespace { Key1 = 23, Key2 }; + enum TestGEnum3: qint16 { + Key1 = 33, + Key2 + }; Q_ENUM(TestGEnum1) Q_ENUM(TestGEnum2) + Q_ENUM(TestGEnum3) + }; + + struct TestGadgetExport { + Q_GADGET_EXPORT(TESTEXPORTMACRO) + Q_CLASSINFO("key", "exported") + public: + enum class TestGeEnum1 { + Key1 = 20, + Key2 + }; + Q_ENUM(TestGeEnum1) + enum class TestGeEnum2 { + Key1 = 23, + Key2 + }; + Q_ENUM(TestGeEnum2) + enum TestGeEnum3: quint16 { + Key1 = 26, + Key2 + }; + Q_ENUM(TestGeEnum3) + }; enum class TestFlag1 { @@ -148,6 +229,36 @@ 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) + enum class MyEnum { + Key1, Key2 + }; + Q_ENUM_NS(MyEnum) +} + QT_USE_NAMESPACE template <bool b> struct QTBUG_31218 {}; @@ -169,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 {}; @@ -288,11 +417,20 @@ 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) { } }; +#define CLASSINFO_VAARGS(...) Q_CLASSINFO("classinfo_va_args", #__VA_ARGS__) +class TestClassinfoFromVaArgs : public QObject +{ + Q_OBJECT + CLASSINFO_VAARGS(a, b, c, d) +}; +#undef CLASSINFO_VAARGS + struct ForwardDeclaredStruct; struct StructQObject : public QObject @@ -302,14 +440,23 @@ public: void foo(struct ForwardDeclaredStruct *); }; +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wunused-variable") void StructQObject::foo(struct ForwardDeclaredStruct *) { struct Inner { bool field; }; - struct Inner unusedVariable; + Q_DECL_UNUSED_MEMBER struct Inner unusedVariable; } +QT_WARNING_POP + +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) @@ -506,6 +653,7 @@ signals: // public slots: void const slotWithSillyConst() {} + void slotTakingCRefViaTypedef(ObjectCRef o) { this->setObjectName(o.objectName()); } public: Q_INVOKABLE void const slotWithSillyConst2() {} @@ -532,6 +680,12 @@ private slots: virtual inline void blub2() {} }; +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 @@ -541,6 +695,7 @@ public: Q_ENUM(TestEnum) }; +#endif class PropertyUseClass : public QObject { @@ -573,7 +728,7 @@ class CtorTestClass : public QObject { Q_OBJECT public: - Q_INVOKABLE CtorTestClass(QObject *parent = 0); + Q_INVOKABLE CtorTestClass(QObject *parent = nullptr); CtorTestClass(int foo); @@ -601,7 +756,6 @@ class tst_Moc : public QObject Q_PROPERTY(bool user1 READ user1 USER true ) Q_PROPERTY(bool user2 READ user2 USER false) - Q_PROPERTY(bool user3 READ user3 USER userFunction()) Q_PROPERTY(QString member1 MEMBER sMember) Q_PROPERTY(QString member2 MEMBER sMember READ member2) Q_PROPERTY(QString member3 MEMBER sMember WRITE setMember3) @@ -617,7 +771,6 @@ public: private slots: void initTestCase(); - void slotWithException() throw(MyStruct); void dontStripNamespaces(); void oldStyleCasts(); void warnOnExtraSignalSlotQualifiaction(); @@ -628,12 +781,14 @@ private slots: void task87883(); void multilineComments(); void classinfoWithEscapes(); + void classinfoFromVaArgs(); void trNoopInClassInfo(); void ppExpressionEvaluation(); void arrayArguments(); void preprocessorConditionals(); void blackslashNewlines(); void slotWithSillyConst(); + void slotTakingCRefViaTypedef(); void testExtraData(); void testExtraDataForEnum(); void namespaceTypeProperty(); @@ -659,7 +814,7 @@ private slots: void templateGtGt(); void qprivateslots(); void qprivateproperties(); - void inlineSlotsWithThrowDeclaration(); + void anonymousProperties(); void warnOnPropertyWithoutREAD(); void constructors(); void typenameWithUnsigned(); @@ -674,6 +829,7 @@ private slots: void privateClass(); void cxx11Enums_data(); void cxx11Enums(); + void cxx11TrailingReturn(); void returnRefs(); void memberProperties_data(); void memberProperties(); @@ -683,6 +839,7 @@ private slots: void finalClasses(); void explicitOverrideControl_data(); void explicitOverrideControl(); + void overloadedAddressOperator(); void autoPropertyMetaTypeRegistration(); void autoMethodArgumentMetaTypeRegistration(); void autoSignalSpyMetaTypeRegistration(); @@ -702,7 +859,20 @@ private slots: void optionsFileError_data(); void optionsFileError(); void testQNamespace(); + void testNestedQNamespace(); void cxx17Namespaces(); + void cxxAttributes(); + void mocJsonOutput(); + void mocInclude(); + void requiredProperties(); + void qpropertyMembers(); + void observerMetaCall(); + void setQPRopertyBinding(); + void privateQPropertyShim(); + void readWriteThroughBindable(); + void invokableCtors(); + void virtualInlineTaggedSlot(); + void tokenStartingWithNumber(); signals: void sigWithUnsignedArg(unsigned foo); @@ -714,12 +884,11 @@ signals: void constSignal2(int arg) const; void member4Changed(); void member5Changed(const QString &newVal); + void sigWithDefaultArg(int i = 12); private: bool user1() { return true; }; bool user2() { return false; }; - bool user3() { return false; }; - bool userFunction(){ return false; }; template <class T> void revisions_T(); QString member2() const { return sMember; } void setMember3( const QString &sVal ) { sMember = sVal; } @@ -741,23 +910,31 @@ 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::location(QLibraryInfo::BinariesPath); - QString qmake = QString("%1/qmake").arg(binpath); - m_moc = QString("%1/moc").arg(binpath); + QString binpath = QLibraryInfo::path(QLibraryInfo::BinariesPath); + QString qtpaths = QString("%1/qtpaths").arg(binpath); + QString libexecPath = QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath); + m_moc = QString("%1/moc").arg(libexecPath); const QString testHeader = QFINDTESTDATA("backslash-newlines.h"); QVERIFY(!testHeader.isEmpty()); m_sourceDirectory = QFileInfo(testHeader).absolutePath(); #if defined(Q_OS_UNIX) && QT_CONFIG(process) QProcess proc; - proc.start(qmake, QStringList() << "-query" << "QT_INSTALL_HEADERS"); + 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()); @@ -765,12 +942,6 @@ void tst_Moc::initTestCase() #endif } -void tst_Moc::slotWithException() throw(MyStruct) -{ - // be happy - QVERIFY(true); -} - void tst_Moc::dontStripNamespaces() { Sender sender; @@ -798,22 +969,20 @@ 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" << "." - << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-std=c++11" << "-"; + << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-std=c++1z" << "-"; proc.start("gcc", args); QVERIFY(proc.waitForStarted()); proc.write(mocOut); 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 @@ -824,7 +993,7 @@ void tst_Moc::warnOnExtraSignalSlotQualifiaction() #ifdef MOC_CROSS_COMPILED QSKIP("Not tested when cross-compiled"); #endif -#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process) +#if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process) QProcess proc; const QString header = m_sourceDirectory + QStringLiteral("/extraqualification.h"); proc.start(m_moc, QStringList(header)); @@ -834,10 +1003,10 @@ void tst_Moc::warnOnExtraSignalSlotQualifiaction() QVERIFY(!mocOut.isEmpty()); QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError()); QCOMPARE(mocWarning, header + - QString(":43: Warning: Function declaration Test::badFunctionDeclaration contains extra qualification. Ignoring as signal or slot.\n") + - header + QString(":46: 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 linux/gcc"); + QSKIP("Only tested on unix/gcc"); #endif } @@ -849,7 +1018,9 @@ void tst_Moc::uLongLong() QVERIFY(idx != -1); idx = mobj->indexOfSlot("slotWithULongLong(unsigned long long)"); QVERIFY(idx != -1); - idx = mobj->indexOfSlot("slotWithULongLongP(unsigned long long*)"); + idx = mobj->indexOfSlot("slotWithULongLong(qulonglong)"); + QVERIFY(idx != -1); + idx = mobj->indexOfSlot("slotWithULongLongP(qulonglong*)"); QVERIFY(idx != -1); idx = mobj->indexOfSlot("slotWithLong(long)"); @@ -868,22 +1039,20 @@ 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" << ".." - << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-std=c++11" << "-"; + << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-std=c++1z" << "-"; proc.start("gcc", args); QVERIFY(proc.waitForStarted()); proc.write(mocOut); 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 @@ -899,10 +1068,6 @@ void tst_Moc::userProperties() property = mobj->property(mobj->indexOfProperty("user2")); QVERIFY(property.isValid()); QVERIFY(!property.isUser()); - - property = mobj->property(mobj->indexOfProperty("user3")); - QVERIFY(property.isValid()); - QVERIFY(!property.isUser(this)); } void tst_Moc::supportConstSignals() @@ -910,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); } @@ -938,18 +1103,29 @@ 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)")); } +void tst_Moc::classinfoFromVaArgs() +{ + const QMetaObject *mobj = &TestClassinfoFromVaArgs::staticMetaObject; + + QCOMPARE(mobj->classInfoCount(), 1); + QCOMPARE(mobj->classInfo(0).name(), "classinfo_va_args"); + QCOMPARE(mobj->classInfo(0).value(), "a,b,c,d"); +} + void tst_Moc::trNoopInClassInfo() { TestClass t; @@ -1013,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; @@ -1039,7 +1224,7 @@ void tst_Moc::testExtraDataForEnum() const QMetaObject *mobjUser = &EnumUserClass::staticMetaObject; QCOMPARE(mobjUser->enumeratorCount(), 0); - const QMetaObject * const *objects = mobjUser->d.relatedMetaObjects; + const auto *objects = mobjUser->d.relatedMetaObjects; QVERIFY(objects); QCOMPARE(objects[0], mobjSource); QVERIFY(!objects[1]); @@ -1121,7 +1306,7 @@ void tst_Moc::warnOnMultipleInheritance() QVERIFY(!mocOut.isEmpty()); QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError()); QCOMPARE(mocWarning, header + - QString(":43: 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 @@ -1144,25 +1329,21 @@ 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. QStringList gccArgs; gccArgs << "-c" << "-x" << "c++" << "-I" << ".." << "-I" << qtIncludePath << "-I" << includeDir << "-o" << "/dev/null" - << "-fPIC" << "-std=c++11" << "-"; + << "-fPIC" << "-std=c++1z" << "-"; proc.start("gcc", gccArgs); QVERIFY(proc.waitForStarted()); proc.write(mocOut); proc.closeWriteChannel(); QVERIFY(proc.waitForFinished()); - QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardError()), QString()); + VERIFY_NO_ERRORS(proc); #else QSKIP("Only tested on linux/gcc"); #endif @@ -1185,7 +1366,7 @@ void tst_Moc::forgottenQInterface() QVERIFY(!mocOut.isEmpty()); QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError()); QCOMPARE(mocWarning, header + - QString(":45: 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 @@ -1214,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 { @@ -1267,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 @@ -1299,23 +1476,21 @@ void tst_Moc::templateGtGt() #ifdef MOC_CROSS_COMPILED QSKIP("Not tested when cross-compiled"); #endif -#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process) +#if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process) 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 linux/gcc"); + QSKIP("Only tested on unix/gcc"); #endif } void tst_Moc::defineMacroViaCmdline() { -#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process) +#if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process) QProcess proc; QStringList args; @@ -1324,18 +1499,17 @@ 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 - QSKIP("Only tested on linux/gcc"); + QSKIP("Only tested on unix/gcc"); #endif } void tst_Moc::defineMacroViaForcedInclude() { -#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process) +#if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process) QProcess proc; QStringList args; @@ -1344,18 +1518,17 @@ 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 - QSKIP("Only tested on linux/gcc"); + QSKIP("Only tested on unix/gcc"); #endif } void tst_Moc::defineMacroViaForcedIncludeRelative() { -#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process) +#if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process) QProcess proc; QStringList args; @@ -1364,19 +1537,18 @@ 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 - QSKIP("Only tested on linux/gcc"); + QSKIP("Only tested on unix/gcc"); #endif } void tst_Moc::environmentIncludePaths_data() { -#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process) +#if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process) QTest::addColumn<QString>("cmdline"); QTest::addColumn<QString>("varname"); @@ -1390,7 +1562,7 @@ void tst_Moc::environmentIncludePaths_data() void tst_Moc::environmentIncludePaths() { -#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process) +#if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process) QFETCH(QString, cmdline); QFETCH(QString, varname); @@ -1410,31 +1582,31 @@ 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 - QSKIP("Only tested on linux/gcc"); + QSKIP("Only tested on unix/gcc"); #endif } // 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" const char *qt_plugin_query_metadata(); +// 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() { - QStaticPlugin plugin = { &qt_plugin_instance, &qt_plugin_query_metadata }; + QStaticPlugin plugin(qt_plugin_instance, qt_plugin_query_metadata_v2); qRegisterStaticPluginFunction(plugin); } }; 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(); @@ -1452,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()")); } } @@ -1513,6 +1687,7 @@ class PrivatePropertyTest : public QObject Q_PRIVATE_PROPERTY(PrivatePropertyTest::d, QString blub4 MEMBER mBlub NOTIFY blub4Changed) Q_PRIVATE_PROPERTY(PrivatePropertyTest::d, QString blub5 MEMBER mBlub NOTIFY blub5Changed) Q_PRIVATE_PROPERTY(PrivatePropertyTest::d, QString blub6 MEMBER mConst CONSTANT) + Q_PRIVATE_PROPERTY(PrivatePropertyTest::d, int zap READ zap WRITE setZap BINDABLE bindableZap) class MyDPointer { public: MyDPointer() : mConst("const"), mBar(0), mPlop(0) {} @@ -1524,18 +1699,23 @@ class PrivatePropertyTest : public QObject void setBaz(int value) { mBaz = value; } QString blub() const { return mBlub; } void setBlub(const QString &value) { mBlub = value; } + int zap() { return mZap; } + void setZap(int zap) { mZap = zap; } + QBindable<int> bindableZap() { return QBindable<int>(&mZap); } QString mBlub; const QString mConst; private: int mBar; int mPlop; int mBaz; + QProperty<int> mZap; }; public: - PrivatePropertyTest(QObject *parent = 0) : QObject(parent), mFoo(0), d (new MyDPointer) {} + PrivatePropertyTest(QObject *parent = nullptr) : QObject(parent), mFoo(0), d (new MyDPointer) {} int foo() { return mFoo ; } void setFoo(int value) { mFoo = value; } MyDPointer *d_func() {return d.data();} + const MyDPointer *d_func() const {return d.data();} signals: void blub4Changed(); void blub5Changed(const QString &newBlub); @@ -1561,21 +1741,59 @@ void tst_Moc::qprivateproperties() test.setProperty("baz", 4); QCOMPARE(test.property("baz"), QVariant::fromValue(4)); + QMetaProperty zap = test.metaObject()->property(test.metaObject()->indexOfProperty("zap")); + QVERIFY(zap.isValid()); + QVERIFY(zap.isBindable()); + auto zapBindable = zap.bindable(&test); + QVERIFY(zapBindable.isBindable()); } -#include "task189996.h" -void InlineSlotsWithThrowDeclaration::c() throw() {} +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; } -void tst_Moc::inlineSlotsWithThrowDeclaration() +private: + int mFoo = 0; +}; + +class AnonymousPropertyTest2 : public QObject { - InlineSlotsWithThrowDeclaration tst; - const QMetaObject *mobj = tst.metaObject(); - QVERIFY(mobj->indexOfSlot("a()") != -1); - QVERIFY(mobj->indexOfSlot("b()") != -1); - QVERIFY(mobj->indexOfSlot("c()") != -1); - QVERIFY(mobj->indexOfSlot("d()") != -1); - QVERIFY(mobj->indexOfSlot("e()") != -1); + 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() @@ -1583,7 +1801,7 @@ void tst_Moc::warnOnPropertyWithoutREAD() #ifdef MOC_CROSS_COMPILED QSKIP("Not tested when cross-compiled"); #endif -#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process) +#if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process) QProcess proc; const QString header = m_sourceDirectory + QStringLiteral("/warn-on-property-without-read.h"); proc.start(m_moc, QStringList(header)); @@ -1593,9 +1811,9 @@ void tst_Moc::warnOnPropertyWithoutREAD() QVERIFY(!mocOut.isEmpty()); QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError()); QCOMPARE(mocWarning, header + - QString(":36: Warning: Property declaration foo has no READ accessor function or 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 linux/gcc"); + QSKIP("Only tested on unix/gcc"); #endif } @@ -1694,7 +1912,7 @@ void tst_Moc::warnOnVirtualSignal() #ifdef MOC_CROSS_COMPILED QSKIP("Not tested when cross-compiled"); #endif -#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process) +#if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process) QProcess proc; const QString header = m_sourceDirectory + QStringLiteral("/pure-virtual-signals.h"); proc.start(m_moc, QStringList(header)); @@ -1703,10 +1921,10 @@ void tst_Moc::warnOnVirtualSignal() QByteArray mocOut = proc.readAllStandardOutput(); QVERIFY(!mocOut.isEmpty()); QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError()); - QCOMPARE(mocWarning, header + QString(":38: Warning: Signals cannot be declared virtual\n") + - header + QString(":40: 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 linux/gcc"); + QSKIP("Only tested on unix/gcc"); #endif } @@ -1743,6 +1961,9 @@ void tst_Moc::QTBUG5590_dummyProperty() QCOMPARE(o.value2(), 82); } +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wignored-qualifiers") +QT_WARNING_DISABLE_GCC("-Wignored-qualifiers") class QTBUG7421_ReturnConstTemplate: public QObject { Q_OBJECT public slots: @@ -1752,15 +1973,21 @@ public slots: const QString returnConstString(const QString s) { return s; } QString const returnConstString2( QString const s) { return s; } }; +QT_WARNING_POP + +struct science_constant {}; +struct science_const {}; +struct constconst {}; +struct const_ {}; class QTBUG9354_constInName: public QObject { Q_OBJECT public slots: - void slotChooseScientificConst0(struct science_constant const &) {}; - void foo(struct science_const const &) {}; - void foo(struct constconst const &) {}; - void foo(struct constconst *) {}; - void foo(struct const_ *) {}; + void slotChooseScientificConst0(science_constant const &) {}; + void foo(science_const const &) {}; + void foo(constconst const &) {}; + void foo(constconst *) {}; + void foo(const_ *) {}; }; @@ -1784,32 +2011,14 @@ signals: class QTBUG12260_defaultTemplate_Object : public QObject { Q_OBJECT public slots: -#if !(defined(Q_CC_GNU) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) || defined(Q_MOC_RUN) - void doSomething(QHash<QString, QVariant> values = QHash<QString, QVariant>() ) { Q_UNUSED(values); } - void doSomethingElse(QSharedPointer<QVarLengthArray<QString, (16 >> 2)> > val - = QSharedPointer<QVarLengthArray<QString, (16 >> 2)> >() ) - { Q_UNUSED(val); } -#else - // we want to test the previous function, but gcc < 4.4 seemed to have a bug similar to the one moc has. - typedef QHash<QString, QVariant> WorkaroundGCCBug; - void doSomething(QHash<QString, QVariant> values = WorkaroundGCCBug() ) { Q_UNUSED(values); } - void doSomethingElse(QSharedPointer<QVarLengthArray<QString, (16 >> 2)> > val - = (QSharedPointer<QVarLengthArray<QString, (16 >> 2)> >()) ) - { Q_UNUSED(val); } -#endif + void doSomething(QHash<QString, QVariant> = QHash<QString, QVariant>() ) {} + void doSomethingElse(QSharedPointer<QVarLengthArray<QString, (16 >> 2)> > + = QSharedPointer<QVarLengthArray<QString, (16 >> 2)> >() ) {} - void doAnotherThing(bool a = (1 < 3), bool b = (1 > 4)) { Q_UNUSED(a); Q_UNUSED(b); } + void doAnotherThing(bool = (1 < 3), bool = (1 > 4)) {} -#if defined(Q_MOC_RUN) || (defined(Q_COMPILER_AUTO_TYPE) && !(defined(Q_CC_CLANG) && Q_CC_CLANG < 304)) - // There is no Q_COMPILER_>> but if compiler support auto, it should also support >> - void performSomething(QVector<QList<QString>> e = QVector<QList<QString>>(8 < 1), - QHash<int, QVector<QString>> h = QHash<int, QVector<QString>>()) - { Q_UNUSED(e); Q_UNUSED(h); } -#else - void performSomething(QVector<QList<QString> > e = QVector<QList<QString> >(), - QHash<int, QVector<QString> > h = (QHash<int, QVector<QString> >())) - { Q_UNUSED(e); Q_UNUSED(h); } -#endif + void performSomething(QList<QList<QString>> = QList<QList<QString>>(8 < 1), + QHash<int, QList<QString>> = QHash<int, QList<QString>>()) {} }; @@ -1817,8 +2026,8 @@ void tst_Moc::QTBUG12260_defaultTemplate() { QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doSomething(QHash<QString,QVariant>)") != -1); QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doAnotherThing(bool,bool)") != -1); - QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doSomethingElse(QSharedPointer<QVarLengthArray<QString,(16>>2)> >)") != -1); - QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("performSomething(QVector<QList<QString> >,QHash<int,QVector<QString> >)") != -1); + QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doSomethingElse(QSharedPointer<QVarLengthArray<QString,(16>>2)>>)") != -1); + QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("performSomething(QList<QList<QString>>,QHash<int,QList<QString>>)") != -1); } void tst_Moc::notifyError() @@ -1831,15 +2040,14 @@ 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" << "." - << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-std=c++11" << "-"; + << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-std=c++1z" << "-"; proc.start("gcc", args); QVERIFY(proc.waitForStarted()); proc.write(mocOut); @@ -1886,12 +2094,14 @@ class VersionTest : public QObject Q_OBJECT Q_PROPERTY(int prop1 READ foo) Q_PROPERTY(int prop2 READ foo REVISION 2) + Q_PROPERTY(int prop514 READ foo REVISION(5, 14)) public: int foo() const { return 0; } Q_INVOKABLE void method1() {} Q_INVOKABLE Q_REVISION(4) void method2() {} + Q_INVOKABLE Q_REVISION(6, 0) void method60() {} enum TestEnum { One, Two }; Q_ENUM(TestEnum); @@ -1900,18 +2110,26 @@ public: public slots: void slot1() {} Q_REVISION(3) void slot2() {} + Q_REVISION(6, 1) void slot61() {} signals: void signal1(); Q_REVISION(5) void signal2(); + Q_REVISION(6, 2) void signal62(); public slots Q_REVISION(6): void slot3() {} void slot4() {} +public slots Q_REVISION(5, 12): + void slot512() {} + signals Q_REVISION(7): void signal3(); void signal4(); + +signals Q_REVISION(5, 15): + void signal515(); }; // If changed, update VersionTest above @@ -1920,12 +2138,14 @@ class VersionTestNotify : public QObject Q_OBJECT Q_PROPERTY(int prop1 READ foo NOTIFY fooChanged) Q_PROPERTY(int prop2 READ foo REVISION 2) + Q_PROPERTY(int prop514 READ foo REVISION(5, 14)) public: int foo() const { return 0; } Q_INVOKABLE void method1() {} Q_INVOKABLE Q_REVISION(4) void method2() {} + Q_INVOKABLE Q_REVISION(6, 0) void method60() {} enum TestEnum { One, Two }; Q_ENUM(TestEnum); @@ -1933,19 +2153,27 @@ public: public slots: void slot1() {} Q_REVISION(3) void slot2() {} + Q_REVISION(6, 1) void slot61() {} signals: void fooChanged(); void signal1(); Q_REVISION(5) void signal2(); + Q_REVISION(6, 2) void signal62(); public slots Q_REVISION(6): void slot3() {} void slot4() {} +public slots Q_REVISION(5, 12): + void slot512() {} + signals Q_REVISION(7): void signal3(); void signal4(); + +signals Q_REVISION(5, 15): + void signal515(); }; template <class T> @@ -1954,32 +2182,58 @@ void tst_Moc::revisions_T() int idx = T::staticMetaObject.indexOfProperty("prop1"); QCOMPARE(T::staticMetaObject.property(idx).revision(), 0); idx = T::staticMetaObject.indexOfProperty("prop2"); - QCOMPARE(T::staticMetaObject.property(idx).revision(), 2); + QCOMPARE(T::staticMetaObject.property(idx).revision(), + QTypeRevision::fromMinorVersion(2).toEncodedVersion<int>()); + idx = T::staticMetaObject.indexOfProperty("prop514"); + QCOMPARE(T::staticMetaObject.property(idx).revision(), + QTypeRevision::fromVersion(5, 14).toEncodedVersion<int>()); idx = T::staticMetaObject.indexOfMethod("method1()"); QCOMPARE(T::staticMetaObject.method(idx).revision(), 0); idx = T::staticMetaObject.indexOfMethod("method2()"); - QCOMPARE(T::staticMetaObject.method(idx).revision(), 4); + QCOMPARE(T::staticMetaObject.method(idx).revision(), + QTypeRevision::fromMinorVersion(4).toEncodedVersion<int>()); + idx = T::staticMetaObject.indexOfMethod("method60()"); + QCOMPARE(T::staticMetaObject.method(idx).revision(), + QTypeRevision::fromVersion(6, 0).toEncodedVersion<int>()); idx = T::staticMetaObject.indexOfSlot("slot1()"); QCOMPARE(T::staticMetaObject.method(idx).revision(), 0); idx = T::staticMetaObject.indexOfSlot("slot2()"); - QCOMPARE(T::staticMetaObject.method(idx).revision(), 3); + QCOMPARE(T::staticMetaObject.method(idx).revision(), + QTypeRevision::fromMinorVersion(3).toEncodedVersion<int>()); + idx = T::staticMetaObject.indexOfSlot("slot61()"); + QCOMPARE(T::staticMetaObject.method(idx).revision(), + QTypeRevision::fromVersion(6, 1).toEncodedVersion<int>()); idx = T::staticMetaObject.indexOfSlot("slot3()"); - QCOMPARE(T::staticMetaObject.method(idx).revision(), 6); + QCOMPARE(T::staticMetaObject.method(idx).revision(), + QTypeRevision::fromMinorVersion(6).toEncodedVersion<int>()); idx = T::staticMetaObject.indexOfSlot("slot4()"); - QCOMPARE(T::staticMetaObject.method(idx).revision(), 6); + QCOMPARE(T::staticMetaObject.method(idx).revision(), + QTypeRevision::fromMinorVersion(6).toEncodedVersion<int>()); + idx = T::staticMetaObject.indexOfSlot("slot512()"); + QCOMPARE(T::staticMetaObject.method(idx).revision(), + QTypeRevision::fromVersion(5, 12).toEncodedVersion<int>()); idx = T::staticMetaObject.indexOfSignal("signal1()"); QCOMPARE(T::staticMetaObject.method(idx).revision(), 0); idx = T::staticMetaObject.indexOfSignal("signal2()"); - QCOMPARE(T::staticMetaObject.method(idx).revision(), 5); + QCOMPARE(T::staticMetaObject.method(idx).revision(), + QTypeRevision::fromMinorVersion(5).toEncodedVersion<int>()); + idx = T::staticMetaObject.indexOfSignal("signal62()"); + QCOMPARE(T::staticMetaObject.method(idx).revision(), + QTypeRevision::fromVersion(6, 2).toEncodedVersion<int>()); idx = T::staticMetaObject.indexOfSignal("signal3()"); - QCOMPARE(T::staticMetaObject.method(idx).revision(), 7); + QCOMPARE(T::staticMetaObject.method(idx).revision(), + QTypeRevision::fromMinorVersion(7).toEncodedVersion<int>()); idx = T::staticMetaObject.indexOfSignal("signal4()"); - QCOMPARE(T::staticMetaObject.method(idx).revision(), 7); + QCOMPARE(T::staticMetaObject.method(idx).revision(), + QTypeRevision::fromMinorVersion(7).toEncodedVersion<int>()); + idx = T::staticMetaObject.indexOfSignal("signal515()"); + QCOMPARE(T::staticMetaObject.method(idx).revision(), + QTypeRevision::fromVersion(5, 15).toEncodedVersion<int>()); idx = T::staticMetaObject.indexOfEnumerator("TestEnum"); QCOMPARE(T::staticMetaObject.enumerator(idx).keyCount(), 2); @@ -2007,7 +2261,7 @@ void tst_Moc::warnings_data() << QStringList() << 0 << QString() - << QString("standard input:0: 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") @@ -2031,7 +2285,7 @@ void tst_Moc::warnings_data() << QStringList() << 0 << QString("IGNORE_ALL_STDOUT") - << QString("standard input:1: Warning: Property declaration x has no READ accessor function or associated MEMBER variable. The property will be invalid."); + << QString("standard input:1:1: warning: Property declaration x has neither an associated QProperty<> member, nor a READ accessor function nor an associated MEMBER variable. The property will be invalid."); // This should output a warning QTest::newRow("Duplicate property warning") @@ -2039,7 +2293,7 @@ void tst_Moc::warnings_data() << QStringList() << 0 << QString("IGNORE_ALL_STDOUT") - << QString("standard input:1: Warning: The property 'x' is defined multiple times in class X."); + << QString("standard input:1:1: warning: The property 'x' is defined multiple times in class X."); // Passing "-nn" should NOT suppress the warning QTest::newRow("Invalid property warning with -nn") @@ -2047,7 +2301,7 @@ void tst_Moc::warnings_data() << (QStringList() << "-nn") << 0 << QString("IGNORE_ALL_STDOUT") - << QString("standard input:1: Warning: Property declaration x has no READ accessor function or associated MEMBER variable. The property will be invalid."); + << QString("standard input:1:1: warning: Property declaration x has neither an associated QProperty<> member, nor a READ accessor function nor an associated MEMBER variable. The property will be invalid."); // Passing "-nw" should suppress the warning QTest::newRow("Invalid property warning with -nw") @@ -2063,7 +2317,7 @@ void tst_Moc::warnings_data() << QStringList() << 1 << QString() - << QString("standard input:1: Error: Class contains Q_OBJECT macro but does not inherit from QObject"); + << QString("standard input:1:1: error: Class contains Q_OBJECT macro but does not inherit from QObject"); // "-nn" should not suppress the error QTest::newRow("Does not inherit QObject with -nn") @@ -2071,7 +2325,7 @@ void tst_Moc::warnings_data() << (QStringList() << "-nn") << 1 << QString() - << QString("standard input:1: Error: Class contains Q_OBJECT macro but does not inherit from QObject"); + << QString("standard input:1:1: error: Class contains Q_OBJECT macro but does not inherit from QObject"); // "-nw" should not suppress the error QTest::newRow("Does not inherit QObject with -nw") @@ -2079,7 +2333,7 @@ void tst_Moc::warnings_data() << (QStringList() << "-nw") << 1 << QString() - << QString("standard input:1: Error: Class contains Q_OBJECT macro but does not inherit from QObject"); + << QString("standard input:1:1: error: Class contains Q_OBJECT macro but does not inherit from QObject"); QTest::newRow("Warning on invalid macro") << QByteArray("#define Foo(a, b)\n class X : public QObject { Q_OBJECT }; \n Foo(a) \n Foo(a,b,c) \n") @@ -2093,63 +2347,63 @@ void tst_Moc::warnings_data() << QStringList() << 1 << QString() - << QString("standard input:5: Error: Class declaration lacks Q_OBJECT macro."); + << QString("standard input:5:1: error: Class declaration lacks Q_OBJECT macro."); QTest::newRow("Namespace declaration lacks Q_NAMESPACE macro.") << QByteArray("namespace X {\nQ_CLASSINFO(\"key\",\"value\")\nenum class MyEnum {Key1 = 1}\nQ_ENUMS(MyEnum)\n}\n") << QStringList() << 1 << QString() - << QString("standard input:1: Error: Namespace declaration lacks Q_NAMESPACE macro."); + << QString("standard input:1:1: error: Namespace declaration lacks Q_NAMESPACE macro."); QTest::newRow("Wrong Q_ENUM context.") << QByteArray("namespace X {\nQ_NAMESPACE\n\nenum class MyEnum {Key1 = 1}\nQ_ENUM(MyEnum)\n}\n") << QStringList() << 1 << QString() - << QString("standard input:5: Error: Q_ENUM can't be used in a Q_NAMESPACE, use Q_ENUM_NS instead"); + << QString("standard input:5:1: error: Q_ENUM can't be used in a Q_NAMESPACE, use Q_ENUM_NS instead"); QTest::newRow("Wrong Q_FLAG context.") << QByteArray("namespace X {\nQ_NAMESPACE\n\nenum class MyEnum {Key1 = 1}\nQ_FLAG(MyEnum)\n}\n") << QStringList() << 1 << QString() - << QString("standard input:5: Error: Q_FLAG can't be used in a Q_NAMESPACE, use Q_FLAG_NS instead"); + << QString("standard input:5:1: error: Q_FLAG can't be used in a Q_NAMESPACE, use Q_FLAG_NS instead"); QTest::newRow("Wrong Q_ENUM_NS context.") << QByteArray("class X {\nQ_GADGET\n\nenum class MyEnum {Key1 = 1}\nQ_ENUM_NS(MyEnum)\n};\n") << QStringList() << 1 << QString() - << QString("standard input:5: Error: Q_ENUM_NS can't be used in a Q_OBJECT/Q_GADGET, use Q_ENUM instead"); + << QString("standard input:5:1: error: Q_ENUM_NS can't be used in a Q_OBJECT/Q_GADGET, use Q_ENUM instead"); QTest::newRow("Wrong Q_FLAG_NS context.") << QByteArray("class X {\nQ_GADGET\n\nenum class MyEnum {Key1 = 1}\nQ_FLAG_NS(MyEnum)\n};\n") << QStringList() << 1 << QString() - << QString("standard input:5: Error: Q_FLAG_NS can't be used in a Q_OBJECT/Q_GADGET, use Q_FLAG instead"); + << QString("standard input:5:1: error: Q_FLAG_NS can't be used in a Q_OBJECT/Q_GADGET, use Q_FLAG instead"); QTest::newRow("Invalid macro definition") << QByteArray("#define Foo(a, b, c) a b c #a #b #c a##b##c #d\n Foo(45, 42, 39);") << QStringList() << 1 << QString("IGNORE_ALL_STDOUT") - << QString(":2: Error: '#' is not followed by a macro parameter"); + << QString(":2:1: error: '#' is not followed by a macro parameter"); QTest::newRow("QTBUG-46210: crash on invalid macro invocation") << QByteArray("#define Foo(a, b, c) a b c #a #b #c a##b##c\n Foo(45);") << QStringList() << 1 << QString("IGNORE_ALL_STDOUT") - << QString(":2: Error: Macro invoked with too few parameters for a use of '#'"); + << QString(":2:1: error: Macro invoked with too few parameters for a use of '#'"); QTest::newRow("QTBUG-54609: crash on invalid input") << QByteArray::fromBase64("EAkJCQkJbGFzcyBjbGFzcyBiYWkcV2kgTUEKcGYjZGVmaW5lIE1BKFEs/4D/FoQ=") << QStringList() << 1 << QString("IGNORE_ALL_STDOUT") - << QString(":-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 };") @@ -2163,22 +2417,53 @@ void tst_Moc::warnings_data() << QStringList() << 0 << QString() - << QString("standard input:1: Note: No relevant classes found. No output generated."); + << QString("standard input:1:1: note: No relevant classes found. No output generated."); QTest::newRow("Q_PLUGIN_METADATA: invalid file") << QByteArray("class X { \n Q_PLUGIN_METADATA(FILE \"does.not.exists\") \n };") << QStringList() << 1 << QString() - << QString("standard input:2: Error: Plugin Metadata file \"does.not.exists\" does not exist. Declaration will be ignored"); + << QString("standard input:2:1: error: Plugin Metadata file \"does.not.exists\" does not exist. Declaration will be ignored"); -#ifdef Q_OS_LINUX // Limit to Linux because the error message is platform-dependent + QTest::newRow("Auto-declared, missing trailing return") + << QByteArray("class X { \n public slots: \n auto fun() { return 1; } };") + << QStringList() + << 1 + << QString() + << QString("standard input:3:1: error: Function declared with auto as return type but missing trailing return type. Return type deduction is not supported."); + + QTest::newRow("Auto-declared, volatile auto as trailing return type") + << QByteArray("class X { \n public slots: \n auto fun() -> volatile auto { return 1; } };") + << QStringList() + << 1 + << QString() + << QString("standard input:3:1: error: Function declared with auto as return type but missing trailing return type. Return type deduction is not supported."); + + // We don't currently support the decltype keyword, so it's not the same error as above. + // The test is just here to make sure this keeps generating an error until return type deduction + // is supported. + QTest::newRow("Auto-declared, decltype in trailing return type") + << QByteArray("class X { \n public slots: \n auto fun() -> decltype(0+1) { return 1; } };") + << QStringList() + << 1 + << 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 };") << QStringList() << 1 << QString() - << QString("standard input:2: Error: Plugin Metadata file \".\" could not be opened: file to open is a directory"); + << QString("standard input:2:1: error: Plugin Metadata file \".\" could not be opened: file to open is a directory"); #endif } @@ -2194,10 +2479,9 @@ void tst_Moc::warnings() QFETCH(QString, expectedStdErr); #ifdef Q_CC_MSVC - // for some reasons, moc compiled with MSVC uses a different output format - QRegExp lineNumberRe(":(-?\\d+):"); - lineNumberRe.setMinimal(true); - expectedStdErr.replace(lineNumberRe, "(\\1):"); + // moc compiled with MSVC uses a different output format to match MSVC compiler style + QRegularExpression lineNumberRe(":(-?\\d+):(\\d+)", QRegularExpression::InvertedGreedinessOption); + expectedStdErr.replace(lineNumberRe, "(\\1:\\2)"); #endif #if QT_CONFIG(process) @@ -2253,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() @@ -2281,24 +2571,51 @@ 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() +{ + CXX11TrailingReturn retClass; + const QMetaObject *mobj = retClass.metaObject(); + QVERIFY(mobj->indexOfSlot("fun()") != -1); + QVERIFY(mobj->indexOfSlot("arguments(int,char)") != -1); + QVERIFY(mobj->indexOfSlot("inlineFunc(int)") != -1); + QVERIFY(mobj->indexOfSlot("constRefReturn()") != -1); + QVERIFY(mobj->indexOfSlot("constConstRefReturn()") != -1); + QVERIFY(mobj->indexOfSignal("trailingSignalReturn(int)") != -1); } void tst_Moc::returnRefs() @@ -2381,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); @@ -2391,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); } } @@ -2416,7 +2733,7 @@ class SignalConnectionTester : public QObject { Q_OBJECT public: - SignalConnectionTester(QObject *parent = 0) + SignalConnectionTester(QObject *parent = nullptr) : QObject(parent), testPassed(false) { @@ -2444,7 +2761,7 @@ class ClassWithPrivateSignals : public QObject { Q_OBJECT public: - ClassWithPrivateSignals(QObject *parent = 0) + ClassWithPrivateSignals(QObject *parent = nullptr) : QObject(parent) { @@ -2480,7 +2797,7 @@ class SubClassFromPrivateSignals : public ClassWithPrivateSignals { Q_OBJECT public: - SubClassFromPrivateSignals(QObject *parent = 0) + SubClassFromPrivateSignals(QObject *parent = nullptr) : ClassWithPrivateSignals(parent) { @@ -2943,6 +3260,34 @@ void tst_Moc::explicitOverrideControl() #endif } +class OverloadedAddressOperator : public QObject +{ + Q_OBJECT +public: + void* operator&() { return nullptr; } +signals: + void self(OverloadedAddressOperator&); +public slots: + void assertSelf(OverloadedAddressOperator &o) + { + QCOMPARE(std::addressof(o), this); + testResult = (std::addressof(o) == this); + } +public: + bool testResult = false; +}; + +void tst_Moc::overloadedAddressOperator() +{ + OverloadedAddressOperator o; + OverloadedAddressOperator *p = std::addressof(o); + QCOMPARE(&o, nullptr); + QVERIFY(p); + QObject::connect(p, &OverloadedAddressOperator::self, p, &OverloadedAddressOperator::assertSelf); + emit o.self(o); + QVERIFY(o.testResult); +} + class CustomQObject : public QObject { Q_OBJECT @@ -2953,7 +3298,7 @@ public: One, Two }; - explicit CustomQObject(QObject *parent = 0) + explicit CustomQObject(QObject *parent = nullptr) : QObject(parent) { } @@ -2970,7 +3315,7 @@ class NamespacedQObject : public QObject { Q_OBJECT public: - explicit NamespacedQObject(QObject *parent = 0) + explicit NamespacedQObject(QObject *parent = nullptr) : QObject(parent) { @@ -2994,7 +3339,7 @@ public: One, Two }; - explicit CustomQObject2(QObject *parent = 0) + explicit CustomQObject2(QObject *parent = nullptr) : QObject(parent) { } @@ -3011,7 +3356,7 @@ class NamespacedQObject2 : public QObject { Q_OBJECT public: - explicit NamespacedQObject2(QObject *parent = 0) + explicit NamespacedQObject2(QObject *parent = nullptr) : QObject(parent) { @@ -3054,16 +3399,16 @@ class AutoRegistrationObject : public QObject Q_PROPERTY(QWeakPointer<CustomQObject> customObjectWP READ customObjectWP CONSTANT) Q_PROPERTY(QPointer<CustomQObject> customObjectTP READ customObjectTP CONSTANT) Q_PROPERTY(QList<int> listInt READ listInt CONSTANT) - Q_PROPERTY(QVector<QVariant> vectorVariant READ vectorVariant CONSTANT) + Q_PROPERTY(QList<QVariant> listVariant READ listVariant CONSTANT) Q_PROPERTY(QList<CustomQObject*> listObject READ listObject CONSTANT) - Q_PROPERTY(QVector<QList<int>> vectorListInt READ vectorListInt CONSTANT) - Q_PROPERTY(QVector<QList<CustomQObject*>> vectorListObject READ vectorListObject CONSTANT) + Q_PROPERTY(QList<QList<int>> listListInt READ listListInt CONSTANT) + Q_PROPERTY(QList<QList<CustomQObject *>> listListObject READ listListObject CONSTANT) Q_PROPERTY(CustomQObject::Number enumValue READ enumValue CONSTANT) Q_PROPERTY(CustomQObjectStar customObjectTypedef READ customObjectTypedef CONSTANT) Q_PROPERTY(SomeNamespace::NamespacedQObject* customObjectNamespaced READ customObjectNamespaced CONSTANT) Q_PROPERTY(SomeNamespace::NamespacedNonQObject customNonQObjectNamespaced READ customNonQObjectNamespaced CONSTANT) public: - AutoRegistrationObject(QObject *parent = 0) + AutoRegistrationObject(QObject *parent = nullptr) : QObject(parent) { } @@ -3098,25 +3443,16 @@ public: return QList<int>(); } - QVector<QVariant> vectorVariant() const - { - return QVector<QVariant>(); - } + QList<QVariant> listVariant() const { return QList<QVariant>(); } QList<CustomQObject*> listObject() const { return QList<CustomQObject*>(); } - QVector<QList<int> > vectorListInt() const - { - return QVector<QList<int> >(); - } + QList<QList<int>> listListInt() const { return QList<QList<int>>(); } - QVector<QList<CustomQObject*> > vectorListObject() const - { - return QVector<QList<CustomQObject*> >(); - } + QList<QList<CustomQObject *>> listListObject() const { return QList<QList<CustomQObject *>>(); } CustomQObject::Number enumValue() const { @@ -3145,10 +3481,10 @@ public slots: void weakPointerSlot(QWeakPointer<CustomQObject2>) {} void trackingPointerSlot(QPointer<CustomQObject2>) {} void listIntSlot(QList<int>) {} - void vectorVariantSlot(QVector<QVariant>) {} + void listVariantSlot(QList<QVariant>) { } void listCustomObjectSlot(QList<CustomQObject2*>) {} - void vectorListIntSlot(QVector<QList<int> >) {} - void vectorListCustomObjectSlot(QVector<QList<CustomQObject2*> >) {} + void listListIntSlot(QList<QList<int>>) { } + void listListCustomObjectSlot(QList<QList<CustomQObject2 *>>) { } void enumSlot(CustomQObject2::Number) {} void typedefSlot(CustomQObject2Star) {} void namespacedQObjectSlot(SomeNamespace2::NamespacedQObject2*) {} @@ -3176,7 +3512,7 @@ void tst_Moc::autoPropertyMetaTypeRegistration() AutoRegistrationObject aro; static const int numPropertiesUnderTest = 15; - QVector<int> propertyMetaTypeIds; + QList<int> propertyMetaTypeIds; propertyMetaTypeIds.reserve(numPropertiesUnderTest); const QMetaObject *metaObject = aro.metaObject(); @@ -3189,23 +3525,17 @@ void tst_Moc::autoPropertyMetaTypeRegistration() } // Verify that QMetaProperty::userType gave us what we expected. - QVector<int> expectedMetaTypeIds = QVector<int>() - << QMetaType::QString // QObject::userType - << QMetaType::QObjectStar // AutoRegistrationObject::object - << qMetaTypeId<CustomQObject*>() // etc. - << qMetaTypeId<QSharedPointer<CustomQObject> >() - << qMetaTypeId<QWeakPointer<CustomQObject> >() - << qMetaTypeId<QPointer<CustomQObject> >() - << qMetaTypeId<QList<int> >() - << qMetaTypeId<QVector<QVariant> >() - << qMetaTypeId<QList<CustomQObject*> >() - << qMetaTypeId<QVector<QList<int> > >() - << qMetaTypeId<QVector<QList<CustomQObject*> > >() - << qMetaTypeId<CustomQObject::Number>() - << qMetaTypeId<CustomQObjectStar>() - << qMetaTypeId<SomeNamespace::NamespacedQObject*>() - << qMetaTypeId<SomeNamespace::NamespacedNonQObject>() - ; + QList<int> expectedMetaTypeIds = QList<int>() + << QMetaType::QString // QObject::userType + << QMetaType::QObjectStar // AutoRegistrationObject::object + << qMetaTypeId<CustomQObject *>() // etc. + << qMetaTypeId<QSharedPointer<CustomQObject>>() + << qMetaTypeId<QWeakPointer<CustomQObject>>() << qMetaTypeId<QPointer<CustomQObject>>() + << qMetaTypeId<QList<int>>() << qMetaTypeId<QList<QVariant>>() + << qMetaTypeId<QList<CustomQObject *>>() << qMetaTypeId<QList<QList<int>>>() + << qMetaTypeId<QList<QList<CustomQObject *>>>() << qMetaTypeId<CustomQObject::Number>() + << qMetaTypeId<CustomQObjectStar>() << qMetaTypeId<SomeNamespace::NamespacedQObject *>() + << qMetaTypeId<SomeNamespace::NamespacedNonQObject>(); QCOMPARE(propertyMetaTypeIds, expectedMetaTypeIds); } @@ -3226,7 +3556,7 @@ void tst_Moc::autoMethodArgumentMetaTypeRegistration() { AutoRegistrationObject aro; - QVector<int> methodArgMetaTypeIds; + QList<int> methodArgMetaTypeIds; const QMetaObject *metaObject = aro.metaObject(); @@ -3251,20 +3581,20 @@ void tst_Moc::autoMethodArgumentMetaTypeRegistration() ++i; \ } -#define FOR_EACH_SLOT_ARG_TYPE(F) \ - F(QObject*) \ - F(CustomQObject2*) \ - F(QSharedPointer<CustomQObject2>) \ - F(QWeakPointer<CustomQObject2>) \ - F(QPointer<CustomQObject2>) \ - F(QList<int>) \ - F(QVector<QVariant>) \ - F(QList<CustomQObject2*>) \ - F(QVector<QList<int> >) \ - F(QVector<QList<CustomQObject2*> >) \ - F(CustomQObject2::Number) \ - F(CustomQObject2Star) \ - F(SomeNamespace2::NamespacedQObject2*) \ +#define FOR_EACH_SLOT_ARG_TYPE(F) \ + F(QObject *) \ + F(CustomQObject2 *) \ + F(QSharedPointer<CustomQObject2>) \ + F(QWeakPointer<CustomQObject2>) \ + F(QPointer<CustomQObject2>) \ + F(QList<int>) \ + F(QList<QVariant>) \ + F(QList<CustomQObject2 *>) \ + F(QList<QList<int>>) \ + F(QList<QList<CustomQObject2 *>>) \ + F(CustomQObject2::Number) \ + F(CustomQObject2Star) \ + F(SomeNamespace2::NamespacedQObject2 *) \ F(SomeNamespace2::NamespacedNonQObject2) // Note: mulit-arg slots are tested below. @@ -3274,27 +3604,20 @@ void tst_Moc::autoMethodArgumentMetaTypeRegistration() #undef TYPE_LOOP #undef FOR_EACH_SLOT_ARG_TYPE - QVector<int> expectedMetaTypeIds = QVector<int>() - << QMetaType::QObjectStar - << qMetaTypeId<CustomQObject2*>() - << qMetaTypeId<QSharedPointer<CustomQObject2> >() - << qMetaTypeId<QWeakPointer<CustomQObject2> >() - << qMetaTypeId<QPointer<CustomQObject2> >() - << qMetaTypeId<QList<int> >() - << qMetaTypeId<QVector<QVariant> >() - << qMetaTypeId<QList<CustomQObject2*> >() - << qMetaTypeId<QVector<QList<int> > >() - << qMetaTypeId<QVector<QList<CustomQObject2*> > >() - << qMetaTypeId<CustomQObject2::Number>() - << qMetaTypeId<CustomQObject2Star>() - << qMetaTypeId<SomeNamespace2::NamespacedQObject2*>() - << qMetaTypeId<SomeNamespace2::NamespacedNonQObject2>() - ; + QList<int> expectedMetaTypeIds = QList<int>() + << QMetaType::QObjectStar << qMetaTypeId<CustomQObject2 *>() + << qMetaTypeId<QSharedPointer<CustomQObject2>>() + << qMetaTypeId<QWeakPointer<CustomQObject2>>() + << qMetaTypeId<QPointer<CustomQObject2>>() << qMetaTypeId<QList<int>>() + << qMetaTypeId<QList<QVariant>>() << qMetaTypeId<QList<CustomQObject2 *>>() + << qMetaTypeId<QList<QList<int>>>() << qMetaTypeId<QList<QList<CustomQObject2 *>>>() + << qMetaTypeId<CustomQObject2::Number>() << qMetaTypeId<CustomQObject2Star>() + << qMetaTypeId<SomeNamespace2::NamespacedQObject2 *>() + << qMetaTypeId<SomeNamespace2::NamespacedNonQObject2>(); QCOMPARE(methodArgMetaTypeIds, expectedMetaTypeIds); - - QVector<int> methodMultiArgMetaTypeIds; + QList<int> methodMultiArgMetaTypeIds; { const QMetaMethod method = metaObject->method(i); @@ -3345,23 +3668,12 @@ void tst_Moc::autoMethodArgumentMetaTypeRegistration() ++i; } - QVector<int> expectedMultiMetaTypeIds = QVector<int>() - << QMetaType::Int - << qMetaTypeId<CustomObject3>() - << qMetaTypeId<CustomObject4>() - << QMetaType::Int - << qMetaTypeId<CustomObject5>() - << qMetaTypeId<CustomObject6>() - << qMetaTypeId<CustomObject7>() - << QMetaType::Int - << qMetaTypeId<CustomObject8>() - << QMetaType::Int - << qMetaTypeId<CustomObject9>() - << qMetaTypeId<CustomObject10>() - << QMetaType::Int - << qMetaTypeId<CustomObject11>() - << QMetaType::Int - ; + QList<int> expectedMultiMetaTypeIds = QList<int>() + << QMetaType::Int << qMetaTypeId<CustomObject3>() << qMetaTypeId<CustomObject4>() + << QMetaType::Int << qMetaTypeId<CustomObject5>() << qMetaTypeId<CustomObject6>() + << qMetaTypeId<CustomObject7>() << QMetaType::Int << qMetaTypeId<CustomObject8>() + << QMetaType::Int << qMetaTypeId<CustomObject9>() << qMetaTypeId<CustomObject10>() + << QMetaType::Int << qMetaTypeId<CustomObject11>() << QMetaType::Int; QCOMPARE(methodMultiArgMetaTypeIds, expectedMultiMetaTypeIds); @@ -3372,7 +3684,7 @@ void tst_Moc::autoSignalSpyMetaTypeRegistration() { AutoRegistrationObject aro; - QVector<int> methodArgMetaTypeIds; + QList<int> methodArgMetaTypeIds; const QMetaObject *metaObject = aro.metaObject(); @@ -3380,12 +3692,12 @@ void tst_Moc::autoSignalSpyMetaTypeRegistration() QVERIFY(i > 0); - QCOMPARE(QMetaType::type("CustomObject12"), (int)QMetaType::UnknownType); + QCOMPARE(QMetaType::fromName("CustomObject12").id(), (int)QMetaType::UnknownType); QSignalSpy spy(&aro, SIGNAL(someSignal(CustomObject12))); - QVERIFY(QMetaType::type("CustomObject12") != QMetaType::UnknownType); - QCOMPARE(QMetaType::type("CustomObject12"), qMetaTypeId<CustomObject12>()); + QVERIFY(QMetaType::fromName("CustomObject12").id() != QMetaType::UnknownType); + QCOMPARE(QMetaType::fromName("CustomObject12").id(), qMetaTypeId<CustomObject12>()); } void tst_Moc::parseDefines() @@ -3472,18 +3784,17 @@ void tst_Moc::preprocessorOnly() #ifdef MOC_CROSS_COMPILED QSKIP("Not tested when cross-compiled"); #endif -#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process) +#if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process) 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 - QSKIP("Only tested on linux/gcc"); + QSKIP("Only tested on unix/gcc"); #endif } @@ -3493,7 +3804,7 @@ void tst_Moc::unterminatedFunctionMacro() #ifdef MOC_CROSS_COMPILED QSKIP("Not tested when cross-compiled"); #endif -#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process) +#if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process) QProcess proc; proc.start(m_moc, QStringList() << "-E" << m_sourceDirectory + QStringLiteral("/unterminated-function-macro.h")); QVERIFY(proc.waitForFinished()); @@ -3526,10 +3837,9 @@ namespace QTBUG32933_relatedObjectsDontIncludeItself { void tst_Moc::QTBUG32933_relatedObjectsDontIncludeItself() { const QMetaObject *mo = &QTBUG32933_relatedObjectsDontIncludeItself::NS::Obj::staticMetaObject; - const QMetaObject * const *objects = mo->d.relatedMetaObjects; + const auto *objects = mo->d.relatedMetaObjects; // the related objects should be empty because the enums is in the same object. QVERIFY(!objects); - } class UnrelatedClass : public QObject @@ -3598,7 +3908,7 @@ void tst_Moc::relatedMetaObjectsInGadget() void tst_Moc::relatedMetaObjectsNameConflict_data() { - typedef QVector<const QMetaObject*> QMetaObjects; + typedef QList<const QMetaObject *> QMetaObjects; QTest::addColumn<const QMetaObject*>("dependingObject"); QTest::addColumn<QMetaObjects>("relatedMetaObjects"); @@ -3629,20 +3939,20 @@ void tst_Moc::relatedMetaObjectsNameConflict_data() void tst_Moc::relatedMetaObjectsNameConflict() { - typedef QVector<const QMetaObject*> QMetaObjects; + 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; - const QMetaObject *const *i = dependingObject->d.relatedMetaObjects; + const auto *i = dependingObject->d.relatedMetaObjects; while (*i) { dependency.insert(*i); ++i; } // 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 @@ -3709,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")) @@ -3757,31 +4068,33 @@ 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() { QCOMPARE(NonGadgetParent::Derived::staticMetaObject.superClass(), static_cast<const QMetaObject*>(nullptr)); QCOMPARE(GrandParentGadget::DerivedGadget::staticMetaObject.superClass(), &GrandParentGadget::BaseGadget::staticMetaObject); + QCOMPARE(GrandParentGadget::CRTPDerivedGadget::staticMetaObject.superClass(), &GrandParentGadget::BaseGadget::staticMetaObject); } void tst_Moc::optionsFileError_data() @@ -3809,33 +4122,78 @@ void tst_Moc::optionsFileError() #endif } -static void checkEnum(const QMetaEnum &enumerator, const QByteArray &name, const QVector<QPair<QByteArray, int >> &keys) +static void checkEnum(const QMetaEnum &enumerator, const QByteArray &name, + 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)); } } +class EnumFromNamespaceClass : public QObject +{ + Q_OBJECT + Q_PROPERTY(FooNamespace::Enum1 prop READ prop CONSTANT) +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(), 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()); @@ -3843,9 +4201,18 @@ void tst_Moc::testQNamespace() QCOMPARE(meta.enclosingMetaObject(), &TestQNamespace::staticMetaObject); QCOMPARE(meta.keyCount(), 2); + QCOMPARE(TestExportNamespace::staticMetaObject.enumeratorCount(), 1); + checkEnum(TestExportNamespace::staticMetaObject.enumerator(0), "MyEnum", + {{"Key1", 0}, {"Key2", 1}}); + QCOMPARE(FooNamespace::staticMetaObject.enumeratorCount(), 1); QCOMPARE(FooNamespace::FooNestedNamespace::staticMetaObject.enumeratorCount(), 2); QCOMPARE(FooNamespace::FooNestedNamespace::FooMoreNestedNamespace::staticMetaObject.enumeratorCount(), 1); + + EnumFromNamespaceClass obj; + const QVariant prop = obj.property("prop"); + QCOMPARE(prop.userType(), QMetaType::fromType<FooNamespace::Enum1>().id()); + QCOMPARE(prop.toInt(), int(FooNamespace::Enum1::Key2)); } void tst_Moc::cxx17Namespaces() @@ -3867,6 +4234,475 @@ void tst_Moc::cxx17Namespaces() QCOMPARE(QMetaEnum::fromType<CXX17Namespace::A::B::C::D::ClassInNamespace::GadEn>().value(0), 3); } +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); + for (auto a: {"deprecatedSlot", "deprecatedSlot2", "deprecatedReason", "deprecatedReasonWithLBRACK", + "deprecatedReasonWith2LBRACK", "deprecatedReasonWithRBRACK", "deprecatedReasonWith2RBRACK", + "slotWithArguments" +#if !defined(_MSC_VER) || _MSC_VER >= 1912 + , "noreturnSlot", "noreturnSlot2", "returnInt", "noreturnDeprecatedSlot", + "noreturnSlot3" +#endif + }) { + QVERIFY(so.indexOfSlot(a) != 1); + } + + QCOMPARE(TestQNamespaceDeprecated::staticMetaObject.enumeratorCount(), 2); + checkEnum(TestQNamespaceDeprecated::staticMetaObject.enumerator(0), "TestEnum1", + {{"Key1", 11}, {"Key2", 12}, {"Key3", 13}, {"Key4", 14}, {"Key5", 15}, {"Key6", 16}, + {"Key7", 17}}); + checkEnum(TestQNamespaceDeprecated::staticMetaObject.enumerator(1), "TestFlag1", + {{"None", 0}, {"Flag1", 1}, {"Flag2", 2}, {"Flag3", 3}, {"Any", 1 | 2 | 3}}); + + QCOMPARE(TestQNamespaceDeprecated::TestGadget::staticMetaObject.enumeratorCount(), 1); + checkEnum(TestQNamespaceDeprecated::TestGadget::staticMetaObject.enumerator(0), "TestGEnum1", + {{"Key1", 13}, {"Key2", 14}, {"Key3", 15}}); + + QMetaEnum meta = QMetaEnum::fromType<TestQNamespaceDeprecated::TestEnum1>(); + QVERIFY(meta.isValid()); + QCOMPARE(meta.name(), "TestEnum1"); + QCOMPARE(meta.enclosingMetaObject(), &TestQNamespaceDeprecated::staticMetaObject); + QCOMPARE(meta.keyCount(), 7); +} + +void tst_Moc::mocJsonOutput() +{ + const auto readFile = [](const QString &fileName) -> std::optional<QJsonDocument> { + QFile f(fileName); + if (!f.open(QIODevice::ReadOnly)) { + qWarning() << "Could not open file" << fileName << f.errorString(); + return std::nullopt; + } + return QJsonDocument::fromJson(f.readAll()); + }; + + QString actualFile = QStringLiteral(":/allmocs.json"); + QString expectedFile = QStringLiteral(":/allmocs_baseline.json"); + if (!QFile::exists(actualFile)) { + // TODO: necessary with cmake as we cannot generate the qrc file soon enough + auto const appDir = QCoreApplication::applicationDirPath(); + actualFile = appDir + QDir::separator() + QLatin1String("./allmocs.json"); + expectedFile = appDir + QDir::separator() + QLatin1String("./allmocs_baseline.json"); + } + + QVERIFY2(QFile::exists(actualFile), qPrintable(actualFile)); + QVERIFY2(QFile::exists(expectedFile), qPrintable(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) + QByteArray actualStr = actual.toJson(); + QByteArray expectedStr = expected.toJson(); + + QTemporaryFile actualFile; + if (!actualFile.open()) + return "Error opening actual temp file"; + actualFile.write(actualStr); + actualFile.flush(); + + QTemporaryFile expectedFile; + if (!expectedFile.open()) + return "Error opening expected temp file"; + expectedFile.write(expectedStr); + expectedFile.flush(); + + QProcess diffProc; + diffProc.setProgram("diff"); + diffProc.setArguments(QStringList() << "-ub" << expectedFile.fileName() << actualFile.fileName()); + diffProc.start(); + if (!diffProc.waitForStarted()) + return "Error waiting for diff process to start."; + if (!diffProc.waitForFinished()) + 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()); +} + +void TestFwdProperties::setProp1(const FwdClass1 &v) +{ + prop1.reset(new FwdClass1(v)); +} +void TestFwdProperties::setProp2(const FwdClass2 &v) +{ + prop2.reset(new FwdClass2(v)); +} +void TestFwdProperties::setProp3(const FwdClass3 &v) +{ + prop3.reset(new FwdClass3(v)); +} +TestFwdProperties::~TestFwdProperties() {} + +Q_DECLARE_METATYPE(FwdClass1); + +void tst_Moc::mocInclude() +{ + TestFwdProperties obj; + obj.setProperty("prop1", QVariant::fromValue(FwdClass1 { 45 })); + QCOMPARE(obj.prop1->x, 45); +} + +class RequiredTest :public QObject +{ + Q_OBJECT + + Q_PROPERTY(int required MEMBER m_required REQUIRED) + Q_PROPERTY(int notRequired MEMBER m_notRequired) + +private: + int m_required; + int m_notRequired; +}; + +void tst_Moc::requiredProperties() +{ + QMetaObject mo = RequiredTest::staticMetaObject; + QMetaProperty required = mo.property(mo.indexOfProperty("required")); + QVERIFY(required.isValid()); + QVERIFY(required.isRequired()); + QMetaProperty notRequired = mo.property(mo.indexOfProperty("notRequired")); + QVERIFY(notRequired.isValid()); + QVERIFY(!notRequired.isRequired()); +} + +class ClassWithQPropertyMembers : public QObject +{ + Q_OBJECT + Q_PROPERTY(int publicProperty MEMBER publicProperty BINDABLE bindablePublicProperty + NOTIFY publicPropertyChanged) + Q_PROPERTY(int privateExposedProperty MEMBER privateExposedProperty) +public: + +signals: + void publicPropertyChanged(); + +public: + QBindable<int> bindablePublicProperty() { return QBindable<int>(&publicProperty); } + Q_OBJECT_BINDABLE_PROPERTY(ClassWithQPropertyMembers, int, publicProperty, &ClassWithQPropertyMembers::publicPropertyChanged); + QProperty<int> notExposed; + + +protected: + QProperty<int> protectedProperty; + +private: + QProperty<int> privateProperty; + QProperty<int> privateExposedProperty; +}; + +void tst_Moc::qpropertyMembers() +{ + const auto metaObject = &ClassWithQPropertyMembers::staticMetaObject; + + QCOMPARE(metaObject->propertyCount() - metaObject->superClass()->propertyCount(), 2); + + QCOMPARE(metaObject->indexOfProperty("notExposed"), -1); + + QMetaProperty prop = metaObject->property(metaObject->indexOfProperty("publicProperty")); + QVERIFY(prop.isValid()); + + QVERIFY(metaObject->property(metaObject->indexOfProperty("privateExposedProperty")).isValid()); + + ClassWithQPropertyMembers instance; + + prop.write(&instance, 42); + QCOMPARE(instance.publicProperty.value(), 42); + + QSignalSpy publicPropertySpy(&instance, SIGNAL(publicPropertyChanged())); + + instance.publicProperty.setValue(100); + QCOMPARE(prop.read(&instance).toInt(), 100); + QCOMPARE(publicPropertySpy.size(), 1); + + QCOMPARE(prop.metaType(), QMetaType(QMetaType::Int)); + + QVERIFY(prop.notifySignal().isValid()); +} + + + +void tst_Moc::observerMetaCall() +{ + const auto metaObject = &ClassWithQPropertyMembers::staticMetaObject; + QMetaProperty prop = metaObject->property(metaObject->indexOfProperty("publicProperty")); + QVERIFY(prop.isValid()); + + ClassWithQPropertyMembers instance; + + int observerCallCount = 0; + + + auto observer = [&observerCallCount]() { + ++observerCallCount; + }; + + auto bindable = prop.bindable(&instance); + QVERIFY(bindable.isBindable()); + + auto handler = bindable.onValueChanged(observer); + + QCOMPARE(observerCallCount, 0); + instance.publicProperty.setValue(100); + QCOMPARE(observerCallCount, 1); + instance.publicProperty.setValue(101); + QCOMPARE(observerCallCount, 2); +} + + + +void tst_Moc::setQPRopertyBinding() +{ + const auto metaObject = &ClassWithQPropertyMembers::staticMetaObject; + QMetaProperty prop = metaObject->property(metaObject->indexOfProperty("publicProperty")); + QVERIFY(prop.isValid()); + + ClassWithQPropertyMembers instance; + + bool bindingCalled = false; + auto binding = Qt::makePropertyBinding([&bindingCalled]() { + bindingCalled = true; + return 42; + }); + + auto bindable = prop.bindable(&instance); + QVERIFY(bindable.isBindable()); + bindable.setBinding(binding); + + QCOMPARE(instance.publicProperty.value(), 42); + QVERIFY(bindingCalled); // but now it should've been called :) +} + +class ClassWithPrivateQPropertyShim :public QObject +{ + Q_OBJECT +public: + Q_PROPERTY(int testProperty READ testProperty WRITE setTestProperty + BINDABLE bindableTestProperty NOTIFY testPropertyChanged) + Q_PROPERTY(int testProperty2 READ testProperty2 WRITE setTestProperty2 + BINDABLE bindableTestProperty2) + //Q_PROPERTY(d_func(), int, lazyTestProperty, setLazyTestProperty, NOTIFY lazyTestPropertyChanged) + +signals: + void testPropertyChanged(); + void lazyTestPropertyChanged(); +public: + + int testProperty() const { return priv.testProperty; } + void setTestProperty(int val) { priv.testProperty = val; } + int testProperty2() const { return priv.testProperty2; } + void setTestProperty2(int val) { priv.testProperty2 = val; } + + QBindable<int> bindableTestProperty() { return QBindable<int>(&priv.testProperty); } + QBindable<int> bindableTestProperty2() { return QBindable<int>(&priv.testProperty2); } + + struct Private { + Private(ClassWithPrivateQPropertyShim *pub) + : q(pub) + {} + + QBindingStorage bindingStorage; + + ClassWithPrivateQPropertyShim *q = nullptr; + + void onTestPropertyChanged() { q->testPropertyChanged(); } + Q_OBJECT_BINDABLE_PROPERTY(Private, int, testProperty, &Private::onTestPropertyChanged); + QProperty<int> testProperty2; + }; + Private priv{this}; + + Private *d_func() { return &priv; } + const Private *d_func() const { return &priv; } +}; + +inline const QBindingStorage *qGetBindingStorage(const ClassWithPrivateQPropertyShim::Private *o) +{ + return &o->bindingStorage; +} +inline QBindingStorage *qGetBindingStorage(ClassWithPrivateQPropertyShim::Private *o) +{ + return &o->bindingStorage; +} + +void tst_Moc::privateQPropertyShim() +{ + ClassWithPrivateQPropertyShim testObject; + + { + auto metaObject = &ClassWithPrivateQPropertyShim::staticMetaObject; + QMetaProperty prop = metaObject->property(metaObject->indexOfProperty("testProperty")); + QVERIFY(prop.isValid()); + QVERIFY(prop.notifySignal().isValid()); + } + + testObject.priv.testProperty.setValue(42); + QCOMPARE(testObject.property("testProperty").toInt(), 42); + + // Behave like a QProperty + QVERIFY(!testObject.bindableTestProperty().hasBinding()); + testObject.bindableTestProperty().setBinding([]() { return 100; }); + QCOMPARE(testObject.testProperty(), 100); + QVERIFY(testObject.bindableTestProperty().hasBinding()); + + // Old style setter getters + testObject.setTestProperty(400); + QVERIFY(!testObject.bindableTestProperty().hasBinding()); + QCOMPARE(testObject.testProperty(), 400); + + // moc generates correct code for plain QProperty in PIMPL + testObject.setTestProperty2(42); + 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 @@ -3875,4 +4711,3 @@ QTEST_MAIN(tst_Moc) #undef emit #include "tst_moc.moc" - 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>
|