[Qt-interest] Drawing rectangular

Yuvaraj R yuvaraj at ongobiz.com
Mon Sep 21 11:16:51 CEST 2009


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/c2cce4c5/attachment.html 


More information about the Qt-interest-old mailing list