blob: e7b922343c06cc6b5ff75cfce9f529ccb0776f15 (
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
|
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef BACKEND_H
#define BACKEND_H
#include "animatedparam.h"
#include <QObject>
#include <qqmlregistration.h>
//! [class definition]
class Backend : public QObject
{
Q_OBJECT
QML_ELEMENT
Q_PROPERTY(int rotation1Angle READ rotation1Angle WRITE setRot1Angle NOTIFY rot1AngleChanged)
Q_PROPERTY(int rotation2Angle READ rotation2Angle WRITE setRot2Angle NOTIFY rot2AngleChanged)
Q_PROPERTY(int rotation3Angle READ rotation3Angle WRITE setRot3Angle NOTIFY rot3AngleChanged)
Q_PROPERTY(int rotation4Angle READ rotation4Angle WRITE setRot4Angle NOTIFY rot4AngleChanged)
Q_PROPERTY(int clawsAngle READ clawsAngle WRITE setClawsAngle NOTIFY clawsAngleChanged)
Q_PROPERTY(QString status READ status BINDABLE bindableStatus)
//! [class definition]
public:
explicit Backend(QObject *parent = nullptr);
int rotation1Angle() const;
void setRot1Angle(const int angle);
int rotation2Angle() const;
void setRot2Angle(const int angle);
int rotation3Angle() const;
void setRot3Angle(const int angle);
int rotation4Angle() const;
void setRot4Angle(const int angle);
int clawsAngle() const;
void setClawsAngle(const int angle);
QString status() const;
QBindable<QString> bindableStatus() const;
signals:
void rot1AngleChanged();
void rot2AngleChanged();
void rot3AngleChanged();
void rot4AngleChanged();
void clawsAngleChanged();
private:
AnimatedParam m_rotation1Angle;
AnimatedParam m_rotation2Angle;
AnimatedParam m_rotation3Angle;
AnimatedParam m_rotation4Angle;
AnimatedParam m_clawsAngle;
QProperty<QString> m_status;
QProperty<bool> m_isCollision;
void detectCollision();
};
#endif // BACKEND_H
|