1: 2: 3: 4: 5: 6: 7: 8: 9: 10:
string s[3]={"Qt::black","Qt::red","Qt::blue"}; int a[3] ={60,40,120}; for(int i=0 ; i<3 ;i++){ for(int x=6 ;x<18;x=x+6){ QRectF rect1(x,0.0,0.0,-a[i]); // line.setPen(QPen(s[i],8,Qt::SolidLine,Qt::RoundCap,Qt::MiterJoin)); line.drawRect(rect1); } }
1: 2: 3: 4: 5: 6: 7: 8: 9:
QColor s[3]={Qt::black,Qt::red,Qt::blue}; int a[3] ={60,40,120}; for(int i=0 ; i<3 ;i++){ for(int x=6 ;x<18;x=x+6){ QRectF rect1(x,0.0,0.0,-a[i]); // line.setPen(QPen(s[i],8,Qt::SolidLine,Qt::RoundCap,Qt::MiterJoin)); line.drawRect(rect1); } }