qskinny/src/controls/LevelingSensor/QskLevelingSensor.h

48 lines
1.6 KiB
C
Raw Normal View History

2023-07-10 13:54:53 +00:00
#pragma once
#include <QskControl.h>
#include <QskScaleTickmarks.h>
#include <QVector3D>
#include <QskAspect.h>
2023-07-13 07:38:44 +00:00
class QSK_EXPORT LevelingSensor : public QskControl
2023-07-10 13:54:53 +00:00
{
Q_OBJECT
using Inherited = QskControl;
public:
QSK_SUBCONTROLS(
OuterDisk,
Horizon,
TickmarksX,
TickmarksXLabels,
TickmarksY,
TickmarksYLabels,
TickmarksZ,
TickmarksZLabels)
using Tickmarks = QskScaleTickmarks;
using TickmarksLabels = QVector<QPair<qreal, QString>>;
explicit LevelingSensor(QQuickItem* parent = nullptr);
public Q_SLOTS:
void setRotation(const QVector3D& degree);
void setRotation(Qt::Axis axis, float degree);
void setTickmarks(Qt::Axis axis, Tickmarks tickmarks);
void setTickmarksLabels(Qt::Axis axis, TickmarksLabels labels);
void setAngle(const QVector3D& degree);
void setAngle(Qt::Axis axis, float degree);
2023-07-13 07:38:44 +00:00
Q_SIGNALS:
2023-07-10 13:54:53 +00:00
void rotationXChanged(qreal degree);
void rotationYChanged(qreal degree);
void rotationZChanged(qreal degree);
void rotationChanged(const QVector3D& degree);
void anglesChanged(const QVector3D& degree);
public:
Q_REQUIRED_RESULT const QVector3D& rotation() const noexcept;
Q_REQUIRED_RESULT const Tickmarks& tickmarks(Qt::Axis axis) const;
Q_REQUIRED_RESULT const TickmarksLabels& tickmarkLabels(Qt::Axis axis) const;
Q_REQUIRED_RESULT const QVector3D& angle() const noexcept;
private:
QVector3D m_rotation;
QVector3D m_angle = { 45,45,45 };
Tickmarks m_tickmarks[3];
TickmarksLabels m_tickmarksLabels[3];
};