Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Common/LtsWidgets/lts_led_widget.h
T
torstenandCopilot d6b6ffce7c Apply clang-format to Lts/Common and DTC/enum headers
- Formatted all CodeGen module files (9 files)
- Formatted LtsAppDescriptor module files
- Formatted LtsAppManager/AppChooser files
- Applied clang-format to all DTC and enum headers across modules
- Removed coordTransTests from CommonUnitTestsPlaceholder (moved to tests/)

Cosmetic changes only, no functional modifications.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-19 14:46:29 +02:00

108 lines
2.2 KiB
C++

#pragma once
#include "ltswidgets_export.h"
#include <QObject>
#include <QWidget>
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& currentcolor);
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;
};
} // namespace LtsWidgets