qskinny/src/controls/LevelingSensor/QskLevelingSensor.h

55 lines
1.7 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-20 10:01:16 +00:00
#include <unordered_map>
2023-07-17 09:14:43 +00:00
class QSK_EXPORT QskLevelingSensor : 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>>;
2023-07-17 09:14:43 +00:00
explicit QskLevelingSensor(QQuickItem* parent = nullptr);
2023-07-10 13:54:53 +00:00
public Q_SLOTS:
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-20 10:01:16 +00:00
void setSubControlRotation(QskAspect::Subcontrol subControl, const QVector3D& degree);
2023-07-13 07:38:44 +00:00
Q_SIGNALS:
2023-07-10 13:54:53 +00:00
void anglesChanged(const QVector3D& degree);
2023-07-20 10:01:16 +00:00
void subControlRotationChanged(QskAspect::Subcontrol subControl, const QVector3D& degree);
2023-07-10 13:54:53 +00:00
public:
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;
2023-07-20 10:01:16 +00:00
Q_REQUIRED_RESULT const QVector3D& subControlRotation(QskAspect::Subcontrol subControl) const noexcept;
2023-07-10 13:54:53 +00:00
private:
2023-07-20 10:01:16 +00:00
// TODO use pimpl
2023-07-10 13:54:53 +00:00
QVector3D m_rotation;
QVector3D m_angle = { 45,45,45 };
Tickmarks m_tickmarks[3];
TickmarksLabels m_tickmarksLabels[3];
2023-07-20 10:01:16 +00:00
std::unordered_map<QskAspect::Subcontrol, QVector3D> m_subControlRotation;
2023-07-10 13:54:53 +00:00
};