Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grid Layout does not divide the space equally in Qt Designer

When the window contains QWebView and QGraphicsView, the Grid Layout setting does not divide the spaces equally.

Is there good way to separate the two spaces equally with the window resize compatibility?

like image 780
Licht Takeuchi Avatar asked Mar 21 '15 09:03

Licht Takeuchi


1 Answers

You can set the stretch values for the widgets inside the layout. For example set the horizontal stretches of all the widgets to 1 for equal widths :

webView.sizePolicy.setHorizontalStretch(1)
graphicsView.sizePolicy.setHorizontalStretch(1)

If you want a specific column to be wider, set a higher stretch value for the widget in that column. The same is true for widget heights in different rows of layout.

You can also set the stretch values in the designer. Just click on a widget and on properties pane set Horizontal Stretch and Vertical Stretch from sizePolicy section.

like image 54
Nejat Avatar answered Nov 09 '22 02:11

Nejat