[Qt-interest] Drawing rectangular
Yuvaraj R
yuvaraj at ongobiz.com
Mon Sep 21 09:38:14 CEST 2009
No
I used simple lines
QPainter paint(this)
paint.DrawRect(100,100,100,100);
what's with this code?
Thanks
Yuvaraj r
On Mon, Sep 21, 2009 at 1:07 PM, Samuel Rødal <sroedal at trolltech.com> wrote:
> Yuvaraj R wrote:
>
>> Hi All
>>
>> I am trying to draw rectangular in Main window, But i don't get my
>> output..
>>
>> My piece of code is:
>>
>> QPainter *painter=new QPainter(this);
>>
>> painter->setPen(Qt::red);
>>
>> painter->drawRect(100,100,100,100);
>>
>>
>> any mistake is there in above code ?
>>
>
> Is this code from the overriden paintEvent()? Make sure you delete the
> painter at the end, otherwise the painter will be left active on the widget
> after the paint event is done. Ideally you shouldn't even use new to create
> the painter, but create it on the stack.
>
> --
> Samuel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090921/1a1afe97/attachment.html
More information about the Qt-interest-old
mailing list