#ifndef CHECKBOXDELEGATE_H
#define CHECKBOXDELEGATE_H

#include <QStyledItemDelegate>
#include <QPainter>

class CheckBoxDelegate : public QStyledItemDelegate
{
    Q_OBJECT

public:
    CheckBoxDelegate(QObject *parent = nullptr);

public:
    void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
    void setEditorData(QWidget *editor, const QModelIndex &index) const;
    void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
    void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;

    class RectClass
    {
    public:
        void draw(QPainter *painter, const QRectF &rectL, QColor colorL = QColor("#FFFFFF"), int radiusL = 0) const
        {
            painter->save();
            // Rect
            QPen penw(colorL);
            painter->setPen(penw);
            painter->drawRect(rectL);
            painter->restore();
        }
    };



    class RectangleClass
    {
    public:
        //void draw(QPainter *painter, const QRectF &rect, QColor color = QColor("#FFFFFF"), int radius = 0) const;
        //void RectangleClass::draw(QPainter *painter, const QRectF &rect, QColor color, int radius) const
        void draw(QPainter *painter, const QRectF &rect, QColor color = QColor("#FFFFFF"), int radius = 0)
        {
            painter->save();

            QPainterPath path;
            path.addRoundedRect(rect, radius, radius);
            QPen pen(color);
            painter->setPen(pen);
            painter->fillPath(path, color);
            painter->drawPath(path);

            painter->restore();
        }
    };




private:
    int m_circleSize;
};

#endif // CHECKBOXDELEGATE_H
