Initial commit (project based on widgets)

This commit is contained in:
Yury Shuvakin
2022-08-01 21:53:36 +03:00
parent d9396cdc2f
commit 14a7aa699f
411 changed files with 95119 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
#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