[Qt-interest] Drawing rectangular

Yuvaraj R yuvaraj at ongobiz.com
Mon Sep 21 11:42:09 CEST 2009


 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


On Mon, Sep 21, 2009 at 2:52 PM, Yuvaraj R <yuvaraj at ongobiz.com> wrote:

> Hi All
>
> I want to paint the text browser string..
>
> How can i do it ?
>
> Thanks
>
> Yuvaraj R
>
>
> On Mon, Sep 21, 2009 at 2:46 PM, Yuvaraj R <yuvaraj at ongobiz.com> wrote:
>
>> Thanks for  All
>>
>>
>>
>> On Mon, Sep 21, 2009 at 2:03 PM, Stephen Jackson <spjackson42 at gmail.com>wrote:
>>
>>> On Mon, Sep 21, 2009 at 8:38 AM, Yuvaraj R wrote:
>>> > No
>>> >
>>> > I used simple lines
>>> >
>>> > QPainter paint(this)
>>> >
>>> > paint.DrawRect(100,100,100,100);
>>> >
>>> >
>>> > what's with this code?
>>> >
>>>
>>> Given the *right context*, there's nothing whatsoever wrong with the
>>> above code.
>>>
>>> Below is a minimum compilable example that demonstrates a rectangle
>>> being drawn with precisely the above code.
>>>
>>> #include <QtGui>
>>>
>>> class MyWidget : public QWidget
>>> {
>>> protected:
>>>    virtual void paintEvent(QPaintEvent *);
>>> };
>>>
>>> void MyWidget::paintEvent(QPaintEvent * e)
>>> {
>>>    QPainter paint(this);
>>>    paint.drawRect(100,100,100,100);
>>> }
>>>
>>> int main(int argc, char **argv)
>>> {
>>>    QApplication app(argc, argv);
>>>
>>>    MyWidget *widget = new MyWidget();
>>>    widget->show();
>>>
>>>    return app.exec();
>>> }
>>>
>>> --
>>> HTH,
>>>
>>> Stephen Jackson
>>> _______________________________________________
>>> Qt-interest mailing list
>>> Qt-interest at trolltech.com
>>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090921/43e21af0/attachment.html 


More information about the Qt-interest-old mailing list