aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmljsscope/QQmlJSScopeTests/typewithproperties.h
blob: 9126cf8f6914f16506761126ba851efdfc7d6260 (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
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#ifndef TYPEWITHPROPERTIES_H
#define TYPEWITHPROPERTIES_H

#include <QtCore/qobject.h>
#include <QtCore/qproperty.h>
#include <QtCore/qstring.h>
#include <QtCore/qvariant.h>
#include <QtQml/qqmlregistration.h>

class TypeWithProperties : public QObject
{
    Q_OBJECT
    QML_ELEMENT

    Q_PROPERTY(double a READ a WRITE setA NOTIFY aChanged)

    QProperty<double> m_a { 0.0 };

public:
    TypeWithProperties(QObject *parent = nullptr) : QObject(parent) { }
    double a() const { return m_a; }
    void setA(double a_) { m_a = a_; }

Q_SIGNALS:
    void aChanged();
};

#endif // TYPEWITHPROPERTIES_H