1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the test suite of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 as published by the Free Software
20** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21** included in the packaging of this file. Please review the following
22** information to ensure the GNU General Public License requirements will
23** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24**
25** $QT_END_LICENSE$
26**
27****************************************************************************/
28
29#ifndef RELATED_METAOBJECTS_NAME_CONFLICT_H
30#define RELATED_METAOBJECTS_NAME_CONFLICT_H
31
32#include <QObject>
33
34#define DECLARE_GADGET_AND_OBJECT_CLASSES \
35 class Gadget { \
36 Q_GADGET \
37 Q_ENUMS(SomeEnum) \
38 public: \
39 enum SomeEnum { SomeEnumValue = 0 }; \
40 }; \
41 class Object : public QObject{ \
42 Q_OBJECT \
43 Q_ENUMS(SomeEnum) \
44 public: \
45 enum SomeEnum { SomeEnumValue = 0 }; \
46 };
47
48#define DECLARE_DEPENDING_CLASSES \
49 class DependingObject : public QObject \
50 { \
51 Q_OBJECT \
52 Q_PROPERTY(Gadget::SomeEnum gadgetPoperty READ gadgetPoperty) \
53 Q_PROPERTY(Object::SomeEnum objectPoperty READ objectPoperty) \
54 public: \
55 Gadget::SomeEnum gadgetPoperty() const { return Gadget::SomeEnumValue; } \
56 Object::SomeEnum objectPoperty() const { return Object::SomeEnumValue; } \
57 };\
58 struct DependingNestedGadget : public QObject \
59 { \
60 Q_OBJECT \
61 Q_PROPERTY(Nested::Gadget::SomeEnum nestedGadgetPoperty READ nestedGadgetPoperty) \
62 Nested::Gadget::SomeEnum nestedGadgetPoperty() const { return Nested::Gadget::SomeEnumValue; } \
63 };\
64 struct DependingNestedObject : public QObject \
65 { \
66 Q_OBJECT \
67 Q_PROPERTY(Nested::Object::SomeEnum nestedObjectPoperty READ nestedObjectPoperty) \
68 Nested::Object::SomeEnum nestedObjectPoperty() const { return Nested::Object::SomeEnumValue; } \
69 };\
70
71
72namespace Unsused {
73 DECLARE_GADGET_AND_OBJECT_CLASSES
74} // Unused
75
76namespace NS1 {
77namespace Nested {
78 DECLARE_GADGET_AND_OBJECT_CLASSES
79} // Nested
80
81namespace NestedUnsused {
82 DECLARE_GADGET_AND_OBJECT_CLASSES
83} // NestedUnused
84
85DECLARE_GADGET_AND_OBJECT_CLASSES
86DECLARE_DEPENDING_CLASSES
87
88} // NS1
89
90namespace NS2 {
91namespace Nested {
92 DECLARE_GADGET_AND_OBJECT_CLASSES
93} // Nested
94
95namespace NestedUnsused {
96 DECLARE_GADGET_AND_OBJECT_CLASSES
97} // NestedUnused
98
99DECLARE_GADGET_AND_OBJECT_CLASSES
100DECLARE_DEPENDING_CLASSES
101
102} // NS2
103
104#endif // RELATED_METAOBJECTS_NAME_CONFLICT_H
105

source code of qtbase/tests/auto/tools/moc/related-metaobjects-name-conflict.h