PDA

View Full Version : text inside QGraphicsEllipseItem



stoned
9th June 2008, 17:43
Hello,

I create circles(or discs) on QGraphicsScene using QGraphicsEllipseItem. Now what I need is to number these circles. How can I use QPaint to drawtext on a QGraphicsEllipseItem ?? or is there any better way to number the circles ??

I am using Qt 4.4

jacek
10th June 2008, 01:02
Subclass QGraphicsEllipseItem and make it draw a numbered circle.

stoned
10th June 2008, 01:12
Thanks Jacek,

I am quite new to Qt. Can you point me an example for subclassing ?

aamer4yu
10th June 2008, 07:44
class myItem :public QGraphicsEllipseItem
{
public:
paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 )
{

painter->drawText() // Draw you text
}

};

Hope this helps