PDA

View Full Version : Number inside the circle



Jeneo W.
4th December 2010, 20:03
Hello

I have created a circle, like this example in http://doc.trolltech.com/4.7/graphicsview-elasticnodes.html.

Now, I want to insert number inside the circle, as:
http://www.watblog.com/wp-content/uploads/2009/12/11NumberElevenInCircle.png

How can add number inside the circle ??
Thank you

ChrisW67
4th December 2010, 20:28
Congratulations. Was there a question?

Jeneo W.
4th December 2010, 20:35
Was there a question?
How can add number inside the circle ??

ChrisW67
4th December 2010, 20:41
QPainter::drawText() in the Node::paint() method would be a good starting point.

Jeneo W.
6th December 2010, 19:42
Is there a way to minimize the size of the font in the QPainter::drawText() ??

Thank :)

totem
6th December 2010, 20:58
a good way is to use the same QRect or QRectF to draw the circle

QPainter::drawEllipse(QRectF)
and to draw the text

QPainter::drawText(QRectF,AlignCenter,"text")

To change font's size, use QFont::setPointSize() or QFont::setPointSizeF()