aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmltc_qprocess/cpptypes/testtype.h
blob: 81c5f00c8452510c1f96b849ccb05625097953be (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#ifndef TESTTYPE_H
#define TESTTYPE_H

#include <QtQmlIntegration/qqmlintegration.h>
#include <QtCore/qobject.h>
#include <QtQml/qqmlregistration.h>
#include <QtGui/qfont.h>

class TypeWithVersionedAlias : public QObject
{
    Q_OBJECT
    QML_UNCREATABLE("")
    QML_ELEMENT
    QString m_readAndWrite;

public:
    TypeWithVersionedAlias() { }
    Q_PROPERTY(QString notExisting MEMBER m_readAndWrite REVISION(6, 0));
    Q_PROPERTY(QString existing MEMBER m_readAndWrite REVISION(1, 0));
};

class UncreatableType : public QObject
{
    Q_OBJECT
    QML_ELEMENT
    QML_UNCREATABLE("")
};

class NoDefaultConstructorType : public QObject
{
    Q_OBJECT
    QML_ELEMENT
    QML_UNCREATABLE("")
    NoDefaultConstructorType() = delete;
};

class SingletonType : public QObject
{
    Q_OBJECT
    QML_ELEMENT
    QML_SINGLETON
};

class NotSingletonType : public SingletonType
{
    Q_OBJECT
    QML_ELEMENT
};

class NormalTypeAttached : public QObject
{
    Q_OBJECT
    QML_ANONYMOUS
public:
    NormalTypeAttached(QObject* parent): QObject(parent) {}
};

class NormalType : public QObject
{
    Q_OBJECT
    QML_ELEMENT
    QML_ATTACHED(NormalTypeAttached)

    static NormalTypeAttached *qmlAttachedProperties(QObject *object) {
        return new NormalTypeAttached(object);
    }
};

class TypeWithSignals : public QObject
{
    Q_OBJECT
    QML_ELEMENT
public:
Q_SIGNALS:
    void signalWithConstPointerToGadget(const QFont *); // not allowed
    void signalWithConstPointerToGadgetConst(const QFont *const); // not allowed
    void signalWithPointerToGadgetConst(QFont *const); // not allowed
    void signalWithPointerToGadget(QFont *); // not allowed

    void signalWithPrimitivePointer(int *);
    void signalWithConstPrimitivePointer(const int *);
};

#endif // TESTTYPE_H