[Qt-interest] Drawing rectangular

Srdjan Todorovic todorovic.s at googlemail.com
Mon Sep 21 17:27:30 CEST 2009


On 21/09/2009, Yuvaraj R <yuvaraj at ongobiz.com> wrote:
> Thanks for your reply
>
> I want to draw the rounded rectangular around the the particular text of
> text browser.

You could use:
void QPainter::drawRoundedRect ( const QRectF & rect, qreal xRadius,
qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize )

and pass the string's bounding rect as the first parameter. You would
have to manually calculate the bounding rectangle I think.

http://doc.trolltech.com/4.5/qpainter.html#boundingRect
Might help with finding out what size the rectangle has to be.

Srdjan

> On Mon, Sep 21, 2009 at 8:36 PM, Srdjan Todorovic <
> todorovic.s at googlemail.com> wrote:
>
>> On 21/09/2009, Yuvaraj R <yuvaraj at ongobiz.com> wrote:
>>
>> > Can u please help how i paint the textbrowser Text ?
>>
>> Like so:
>>
>> QString h("hello!");
>> painter.drawText ( 50, 50, h );
>>
>> yes?
>>
>> Srdjan
>>
>



More information about the Qt-interest-old mailing list