Continues migration with DDS, Common
This commit is contained in:
1 parent
9b15cee841
commit
fa48db111e
668 files changed
+111841
-2
No files matched your search
Executable
+117
@@ -0,0 +1,117 @@
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "lts_widgets_export.h"
|
||||
|
||||
namespace LtsWidgets
|
||||
{
|
||||
|
||||
|
||||
|
||||
class LTSWIDGETS_EXPORT LtsLedWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum class AspectHint
|
||||
{
|
||||
WidthIsHeight,
|
||||
NoHint,
|
||||
HeightIsWidth
|
||||
};
|
||||
Q_ENUM(AspectHint)
|
||||
|
||||
Q_PROPERTY(QColor oncolor READ onColor WRITE setOnColor)
|
||||
Q_PROPERTY(QColor offcolor READ offColor WRITE setOffColor)
|
||||
Q_PROPERTY(bool status READ status WRITE setStatus)
|
||||
Q_PROPERTY(bool usesGradient READ usesGradient WRITE setUseGradient)
|
||||
Q_PROPERTY(int animTime READ animTime WRITE setAnimTime)
|
||||
Q_PROPERTY(AspectHint aspectHint READ aspectHint WRITE setAspectHint)
|
||||
Q_PROPERTY(QColor currentcolor READ currentColor WRITE setCurrentColor DESIGNABLE false)
|
||||
|
||||
|
||||
|
||||
explicit LtsLedWidget(QWidget *parent = nullptr, const QColor &oncolor = Qt::red, const QColor &offcolor = Qt::black, bool useGradient = true, int animtime = 0);
|
||||
|
||||
void paintEvent(QPaintEvent *pe);
|
||||
|
||||
|
||||
|
||||
void setAnimTime(int time) { m_animTime = time; }
|
||||
|
||||
|
||||
|
||||
int animTime() const { return m_animTime; }
|
||||
|
||||
|
||||
|
||||
bool status() const { return m_status; }
|
||||
|
||||
|
||||
|
||||
void setUseGradient(bool useGradient);
|
||||
|
||||
|
||||
|
||||
bool usesGradient() const { return m_gradient; }
|
||||
|
||||
|
||||
|
||||
void setOnColor(const QColor &oncolor);
|
||||
|
||||
|
||||
|
||||
QColor onColor() const { return m_oncolor; }
|
||||
|
||||
|
||||
|
||||
void setOffColor(const QColor &offcolor);
|
||||
|
||||
|
||||
|
||||
QColor offColor() const { return m_offcolor; }
|
||||
|
||||
|
||||
|
||||
void setColor(const QColor &oncolor, const QColor &offcolor = Qt::black);
|
||||
|
||||
|
||||
|
||||
QColor currentColor() const { return m_currentcolor; }
|
||||
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
AspectHint aspectHint() const { return m_aspectHint; }
|
||||
|
||||
public slots:
|
||||
|
||||
|
||||
void setStatus(bool status);
|
||||
|
||||
void setAspectHint(AspectHint aspectHint)
|
||||
{
|
||||
m_aspectHint = aspectHint;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
|
||||
void setCurrentColor(const QColor ¤tcolor);
|
||||
|
||||
|
||||
|
||||
void animate();
|
||||
|
||||
bool m_status;
|
||||
QColor m_oncolor;
|
||||
QColor m_offcolor;
|
||||
QColor m_currentcolor;
|
||||
|
||||
bool m_gradient;
|
||||
int m_animTime;
|
||||
AspectHint m_aspectHint = AspectHint::NoHint;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user