void linia:: paintEvent (QPaintEvent *c)
{
//lines
QPainter linia (to);
line.setRenderHint (QPainter:: Antialiasing, true);
line.setPen (QPen (Qt:: czerń, 2, Qt:: SolidLine, Qt:: RoundCap, Qt:: MiterJoin));
line.setBrush (QBrush (Qt:: czerń, Qt:: SolidPattern));
line.drawLine (50,50,50,200); // Y oś
line.drawLine (50,200,250,200); // x oś
// prostokąt
int a [5] = {20,60,120,30,200}; //length = a []
int x= 50.0;
int y= 200;
dla (int i=0; i<5; i++)
{
int inc = 200/5;
dla (int j=0; j<200; j=j+inc)
{
QRectF rect ((x+j), (y-a [i]), 0.0, a [i]);
line.setPen (QPen (Qt:: zieleń, 8, Qt:: SolidLine, Qt:: RoundCap, Qt:: MiterJoin));
line.drawRect (rect);
}
}
}
|