mirror of
https://github.com/edisionnano/QDiskInfo.git
synced 2026-03-11 15:20:52 +03:00
Move source to src folder
This commit is contained in:
17
src/statusdot.cpp
Normal file
17
src/statusdot.cpp
Normal 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 = 15;
|
||||
|
||||
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();
|
||||
}
|
||||
Reference in New Issue
Block a user