Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt & Qt Designer - Making widget fill the parent without padding

I wanted to make my widget fill the parent window, even when the window resizes, so I read this: How to make a Qt Widget grow with the window size?

But this solution created a new problem: my widget automatically re-sizes to the size of the window, but there's padding on the sides of the window. I want the widget to completely fill the parent, and it's not doing that. Look:



Here you can see that the tab widget doesn't entirely fill the parent. I've done some research and have seen that through programming, you can configure the layout to get rid of this padding. Problem is, I'm building my GUI in QDesigner, so I can't just go layout->setMargin(0);

My question is, how to I get rid of this padding on the sides of my window through Qt Designer?

like image 211
Aaron Avatar asked Jun 12 '13 16:06

Aaron


1 Answers

In the bottom of central widget properties there is a section of Layout (it is red), where you can set layout margins. Also, you still can do it programmatically:

QMainWindow::centralWidget()->layout()->setContentsMargins(0, 0, 0, 0);
like image 165
Amartel Avatar answered Oct 01 '22 02:10

Amartel