summaryrefslogtreecommitdiffstats
path: root/plugin/redirect.h
blob: 232f07b8409c29cade6da1b310b265aab9f16cb3 (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
#ifndef REDIRECT_H
#define REDIRECT_H

#include <QObject>

class QQuickItem;

class Redirect : public QObject
{
    Q_OBJECT

    Q_PROPERTY(qreal start READ start WRITE setStart)
    Q_PROPERTY(qreal end READ end WRITE setEnd)
    Q_PROPERTY(QQuickItem *target READ target WRITE setTarget)
public:
    Redirect(QObject *parent = nullptr);
    virtual ~Redirect();

    qreal start() const;
    qreal end() const;
    QQuickItem *target() const;

    void setStart(qreal start);
    void setEnd(qreal end);
    void setTarget(QQuickItem *target);

    bool angleIsIncluded(qreal angle);

private slots:
    void onTargetDestroyed();

private:
    qreal m_start;
    qreal m_end;
    //fitted angles in radians
    qreal m_startR;
    qreal m_endR;
    QQuickItem *m_target;
};

#endif // REDIRECT_H