NDEVR
API Documentation
BubbleLevelWidget.h
1#pragma once
2#include <QWidget>
3#include <NDEVR/Angle.h>
4class QVariantAnimation;
5namespace NDEVR
6{
13 class BubbleLevelWidget : public QWidget
14 {
15 Q_OBJECT
16 public:
21 explicit BubbleLevelWidget(QWidget* parent = nullptr);
26 void setAngles(Vector<2, Angle<fltp08>> angles);
31 void animateTo(const Vector<2, Angle<fltp08>>& angles);
41 QSize sizeHint() const override;
42 protected:
47 void paintEvent(QPaintEvent* event) override;
52 void resizeEvent(QResizeEvent* event) override;
53 private slots:
55 void onSensorUpdated();
56 private:
58 void init();
59 private:
60 QTimer* m_timer;
61 QVariantAnimation* m_animation;
67 QPointF calculateBubblePosition(Angle<fltp08> radius) const;
68 OrientationSensor* m_orientation_sensor = nullptr;
69 Vector<2, Angle<fltp08>> m_angles;
70 Vector<2, Angle<fltp08>> m_display_angles;
71 Angle<fltp08> m_warning_angle;
72 Angle<fltp08> m_max_angle;
73 fltp04 m_radius;
74 QPointF m_center;
75 };
76}
Stores an angle in an optimized internal format with support for efficient trigonometric operations.
Definition Angle.h:83
void setSensor(OrientationSensor *sensor)
Sets the orientation sensor whose tilt data drives the bubble display.
void paintEvent(QPaintEvent *event) override
Paints the bubble level visualization.
QSize sizeHint() const override
Returns the recommended size for this widget.
BubbleLevelWidget(QWidget *parent=nullptr)
Constructs a BubbleLevelWidget.
void resizeEvent(QResizeEvent *event) override
Handles resize events to recalculate layout geometry.
void setAngles(Vector< 2, Angle< fltp08 > > angles)
Sets the tilt angles to display immediately without animation.
void animateTo(const Vector< 2, Angle< fltp08 > > &angles)
Smoothly animates the bubble to the specified tilt angles.
Forward declaration for design object lookup service.
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
Definition Vector.hpp:62
The primary namespace for the NDEVR SDK.
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...