#ifndef PQLABEL_H
#define PQLABEL_H

#include <QLabel>
#include "classes/pqwidget.h"

class PQLabel;
class PQLabel : public QLabel {
    Q_OBJECT
    PQ_WIDGET_EX(QLabel)

    Q_PROPERTY(QString text READ text WRITE setText)
    Q_PROPERTY(QString icon READ icon WRITE setIcon)
    Q_PROPERTY(PQObject *pixmap READ pixmap WRITE setPixmap)
    Q_PROPERTY(int alignment READ alignment WRITE setAlignment)
    Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap)
    Q_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks)
    Q_PROPERTY(int textFormat READ textFormat WRITE setTextFormat)

public:
    Q_INVOKABLE explicit PQLabel(QWidget * parent=0, int f = 0);
    Q_INVOKABLE explicit PQLabel(const QString &text, QWidget * parent=0, int f = 0);
    virtual ~PQLabel();

    Q_INVOKABLE QString text() const;
    Q_INVOKABLE QString icon() const;
    Q_INVOKABLE PQObject *pixmap() const;
    Q_INVOKABLE int alignment() const;
    Q_INVOKABLE bool wordWrap() const;
    Q_INVOKABLE bool openExternalLinks() const;
    Q_INVOKABLE int textFormat() const;

public Q_SLOTS:
    Q_INVOKABLE void setText(const QString &text);
    Q_INVOKABLE void setIcon(const QString &iconPath);
    Q_INVOKABLE void setPixmap(const QString &pixmapPath, int pw, int ph);
    Q_INVOKABLE void setPixmap(PQObject *pqpixmap);
    Q_INVOKABLE void setAlignment(int alignment);
    Q_INVOKABLE void setWordWrap(bool wordWrap);
    Q_INVOKABLE void setOpenExternalLinks(bool openExternalLinks);
    Q_INVOKABLE void setTextFormat(int textFormat);

private:
    QString m_iconPath = "";
    PQObject *m_pixmap = nullptr;

    void linkActivated_pslot(const QString &link);
    void linkHovered_pslot(const QString &link);

    PQ_ON_SIGNAL_DECL_START {
        PQ_ON_SIGNAL(linkActivated_pslot(string));
        PQ_ON_SIGNAL(linkHovered_pslot(string));
        PQWIDGET_ON_SIGNALS();
    } PQ_ON_SIGNAL_DECL_END
};


#endif // PQLABEL_H
