how to make boundary line have also a border of black color using Qpainter

183 views Asked by At

I am using Qt. I used QPainter to make boundary line. But I want boundary line have also a 1 pixel broad border so it visible more.

The following image shows the yellow border with black boundary. this image is reference for the logic. i will applied it on random shaped

enter image description here

1

There are 1 answers

1
znoopy2k On

Create a smaller rect from your boundingbox.

QRect adjusted(int dx1, int dy1, int dx2, int dy2) const

QRect smallerbox = boundingRect().adjusted(boundingRect.topLeft().x() +1, boundingRect.topLeft().y() +1, boundingRect.bottomRight().x() -1, boundingRect.bottomRight().y() -1);