aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmltc/QmltcTests/cpptypes/typewithnamespace.h
blob: 173e8624ffc1ca91eb099ff1fddfdca8937b45fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#ifndef TYPEWITHNAMESPACE_H
#define TYPEWITHNAMESPACE_H

#include <QtCore/qobject.h>
#include <QtQml/qqmlregistration.h>

namespace MyNamespace {

class TypeWithNamespace : public QObject
{
    Q_OBJECT
    QML_ELEMENT
public:
    TypeWithNamespace(QObject *parent = nullptr);

signals:
};

namespace Sub1 {
namespace Sub2 {
namespace Sub3 {

class TypeWithSubnamespace : public QObject
{
    Q_OBJECT
    QML_ELEMENT

    int m_x = 55;

public:
    TypeWithSubnamespace(QObject *parent = nullptr);

    Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged);
    int x() { return m_x; }
    void setX(int x)
    {
        if (x == m_x)
            return;
        m_x = x;
        emit xChanged();
    }

signals:
    void xChanged();
};
} // namespace Sub3
} // namespace Sub2
} // namespace Sub1
} // namespace MyNamespace

#endif // TYPEWITHNAMESPACE_H