blob: 2dbfd7b0379f59e436805d8557897b9bb6a444cf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#include "roundrectitem.h"
#include <QPainter>
#include <QStyleOptionGraphicsItem>
RoundRectItem::RoundRectItem(double radius, QGraphicsItem *parent) : QGraphicsRectItem(parent),
radius(radius)
{
}
void RoundRectItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *)
{
painter->save();
painter->setClipRect(option->rect);
painter->setPen(pen());
painter->setBrush(brush());
painter->drawRoundedRect(rect(), radius, radius, Qt::AbsoluteSize);
painter->restore();
}
|