So i have a QGroupBox
with a vertical layout inside of it.
There is a QWidget
container at top(blue).
I have used setContentsMargins(0,0,0,0)
for both the QGroupBox
and the QWidget
container yet no matter what i do i cannot get the QWidget
container to be at (0,0) in the top left of the groupbox. Ive marked in red the spacing i want to remove.
Those are QLayout
margins. Set them to zero.
You must algo set the margins of the layout to 0. Given a widget -- either your QGroupBox
or your QWidget
-- you can use the layout()
method to access its underlying layout, and then set the margins on it. Something like this:
widget->layout()->setContentsMargins(0, 0, 0, 0);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.