First commit

This commit is contained in:
spiros
2024-05-29 03:49:25 +03:00
parent 550b26a41e
commit b36b55f575
10 changed files with 916 additions and 0 deletions

17
statusdot.cpp Normal file
View File

@@ -0,0 +1,17 @@
#include "statusdot.h"
void StatusDot::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QStyleOptionViewItem opt = option;
initStyleOption(&opt, index);
int dotSize = qMin(opt.rect.width(), opt.rect.height()) * 0.5;
painter->save();
painter->setRenderHint(QPainter::Antialiasing, true);
QRect dotRect(opt.rect.center().x() - dotSize / 2, opt.rect.center().y() - dotSize / 2, dotSize, dotSize);
QColor color = QColor(index.data(Qt::BackgroundRole).value<QColor>());
painter->setBrush(color);
painter->setPen(Qt::NoPen);
painter->drawEllipse(dotRect);
painter->restore();
}