Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drawing inside a QFrame: coordinate system

Tags:

qt

I would like to draw inside a Qt QFrame, however the QFrame will have a border. As far as I understand, the paintEvent receives a QPainter which is associated to the whole frameRect, so I will have to offset my paint operations of the border. Is this correct? Is there a way of getting a QPainter already associated to the inner part of the widget, without the (variable in size) border?

like image 539
Stefano Borini Avatar asked Nov 20 '25 01:11

Stefano Borini


1 Answers

you have to consider the contentsRect contentsRect()-> Returns the area inside the widget's margins.using the return value rect of contensRect() you can restrict to draw anything inside the rect.

like image 123
Wagmare Avatar answered Nov 21 '25 17:11

Wagmare



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!