/** * @RDE_HEADER@ * Implements n QLedChars to display a line of Text/Image * $Id$ * $HeadURL$ * $Author$ * Created by Florian Schult, SLSE, 2016-03-18 */ #pragma once #include #include #ifndef QLEDLINE_EXPORT # ifdef BUILD_STATIC_LIBRARIES # define QLEDLINE_EXPORT # else # ifdef MAKE_QLEDLINE_LIB # define QLEDLINE_EXPORT Q_DECL_EXPORT # else # define QLEDLINE_EXPORT Q_DECL_IMPORT # endif # endif #endif namespace Ui { class QLedLine; } class QHBoxLayout; class QLedChar; class QTimer; class QImage; class QLEDLINE_EXPORT QLedLine : public QWidget { Q_OBJECT public: explicit QLedLine(QWidget *parent = nullptr); ~QLedLine(); int height() const; void setHeight(int height); int charCount() const; void setCharCount(int charCount); // Returns the QSize of the first QLedChar QSize charSize() const; void setCharCountAndHeight(int charCount, int height); bool isTextVisible() const; int flashTime() const; QColor color() const; QString shownText() const; QString text() const; private: void addChar(); void deleteChar(); public slots: void setText(const QString &text); void setFlashing(int msecs = 0); void setTextVisible(bool visible = true); void setColor(const QColor &color); void clear(); void setImage(const QImage &image); private: int m_charCount; int m_height; bool m_visible; QString m_text; QHBoxLayout *m_layout; QVector m_chars; QTimer *m_flashTimer; QColor m_color; QImage m_image; };