[Qt-interest] Drawing rectangular

Yuvaraj R yuvaraj at ongobiz.com
Mon Sep 21 11:55:56 CEST 2009


Thanks for your reply

As per you ,

I need to over ride the paintEvent of TextBrowser ?


Thanks

Yuvaraj R

On Mon, Sep 21, 2009 at 3:26 PM, Samuel Rødal <sroedal at trolltech.com> wrote:

> Yuvaraj R wrote:
>
>> QPainter paint();
>>
>> paint.begin(ui->textBrowser);
>>
>> paint.drawRect(100,100,100,100);
>>
>> paint.end();
>>
>>
>>  i tried with this code..
>>
>>
>> is it correct ?
>>
>>
>> I am not getting anything .
>>
>>
>> Thanks
>>
>>
>> Yuvaraj R
>>
>
> Painting on a widget needs to happen in that widget's paint event. In this
> case you're trying to paint on ui->textBrowser. For this to work you'd need
> to subclass QTextBrowser, reimplement its paintEvent(), call the base class
> paint event to let QTextBrowser do its normal painting operations, and
> finally do your own painting.
>
> Btw, I also think you should remove the () in the "QPainter paint();" line,
> or the compiler will treat it as a function forward declaration.
>
> --
> Samuel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090921/19890cc8/attachment.html 


More information about the Qt-interest-old mailing list