#ifndef LEDTEXT_H
#define LEDTEXT_H

/**
 * 字模提取控件
 * 1:可设置字模文字
 * 2:可设置字体名称及字号
 * 3:可设置步长间隔
 * 4:可设置前景色
 */

#include <QWidget>
#include <QPainterPath>


class LedText : public QWidget
{
    Q_OBJECT
    Q_PROPERTY(QString text READ getText WRITE setText)
    Q_PROPERTY(int step READ getStep WRITE setStep)

    Q_PROPERTY(QColor foreground READ getForeground WRITE setForeground)
    Q_PROPERTY(QColor background READ getBackground WRITE setBackground)

public:
    explicit LedText(QWidget *parent = 0);

    QString getText()               const;
    int getStep()                   const;

    QColor getForeground()          const;
    QColor getBackground()          const;

    QSize sizeHint()                const;
    QSize minimumSizeHint()         const;

    void setFontSize(int size);

public Q_SLOTS:
    //设置字模信息
    void setText(const QString &text);
    void setStep(int step);

    //设置前景色
    void setForeground(const QColor &foreground);
    //设置背景色
    void setBackground(const QColor &background);

protected:
    void paintEvent(QPaintEvent *);

private:
    QString text;                   //文字
    int step;                       //步长
    int fontSize;//字体大小

    QColor foreground;              //前景色
    QColor background;              //背景色
};

#endif // LEDTEXT_H
