Unsolved why setPen didn't work?
stackprogramer last edited by stackprogramer
hi, here is a part of my source,
why despite changing color pen,my shape is created in only one color blue??
i want to some line is blue,some line is black...
myPolygon << QPointF(-100, -100) << QPointF(100, -100) << QPointF(100, 100) ; setPen(QPen(Qt::black, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); path.addRect(0,0,200, 200); myPolygon = path.toFillPolygon(); setPen(QPen(Qt::blue, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); path.setFillRule(Qt::OddEvenFill); path.addRect(90,0,20,20); path.addRect(0,90,20,20); path.addRect(180,90,20,20); myPolygon << QPointF(0, 0) << QPointF(40,0) << QPointF(0, 40) ; path.addPolygon( myPolygon);
this is link image shape:
thanks for reply
mrjj Lifetime Qt Champion last edited by mrjj
What are u calling setPen on?
Paths do not store color and such information
so Im not sure its possible to do with only 1 polygon.
Maybe create a subclass of QGraphicsItem and paint it directly with
qpainter::drawLine which supports colors very easy.