문제

How can I resize a QLabel and be able to retain its current position? What I want to do is basically resize it, but I want this to be resized from all four sides equally instead of resizing from top-left corner. In other words I want to change the resize point of a widget.

I can accomplish what I'm describing above by basically resizing and repositioning the widget once it has been resize but this is a tedious process and I'm wondering if there is a better way.

I'm not sure if I'm explaining this right, I hope it makes sense.

도움이 되었습니까?

해결책

You can resize and reposition the widget in one go using QWidget::setGeometry(), taking the new position and size as rectangle (QRect). There's no ready-made function for your exact requirement, but you can of course write a little helper function doing the math.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top