#include <QApplication>
#include <QPainter>
#include <QWidget>
{
protected:
{
painter.setPen(Qt::red);
QBrush brush
(Qt
:: Dense6Pattern);
brush.setColor(Qt::blue);
painter.setBrush(brush);
painter.setWindow(0, 0, 1000, 1000); // try to comment out this line
painter.drawRect(50, 50, 100, 200);
painter.setWindow(0, 0, 2000, 2000);
painter.drawRect(500, 100, 200, 400);
painter.setWindow(0, 0, 3000, 3000);
painter.drawRect(1350, 150, 300, 600);
painter.setWindow(0, 0, 4000, 4000);
painter.drawRect(2600, 200, 400, 800);
painter.setWindow(0, 0, 5000, 5000);
painter.drawRect(4250, 250, 500, 1000);
}
};
int main( int argc, char **argv )
{
Test t;
t.show();
return app.exec();
}
#include <QApplication>
#include <QPainter>
#include <QWidget>
class Test : public QWidget
{
protected:
void paintEvent( QPaintEvent * )
{
QPainter painter(this);
painter.setPen(Qt::red);
QBrush brush(Qt:: Dense6Pattern);
brush.setColor(Qt::blue);
painter.setBrush(brush);
painter.setWindow(0, 0, 1000, 1000); // try to comment out this line
painter.drawRect(50, 50, 100, 200);
painter.setWindow(0, 0, 2000, 2000);
painter.drawRect(500, 100, 200, 400);
painter.setWindow(0, 0, 3000, 3000);
painter.drawRect(1350, 150, 300, 600);
painter.setWindow(0, 0, 4000, 4000);
painter.drawRect(2600, 200, 400, 800);
painter.setWindow(0, 0, 5000, 5000);
painter.drawRect(4250, 250, 500, 1000);
}
};
int main( int argc, char **argv )
{
QApplication app( argc, argv );
Test t;
t.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks