c++ - How to create a compact Qt4 vBoxLayout -


I have got a vBoxLayout that has 3 simple buttons, when I increase the size of the widget with layout, between the inter buttons Increases I want to stop this behavior and keep the button in a consistent and compact layout, regardless of the size of the parent widget. This is what I have so far received, but this vacancy, no suggestion changes? Thanks.

  button_layout = new QVBoxLayout; Button_layout - & gt; (0) setSpacing; Button_layout - & gt; SetContentsMargins (0,0,0,0);  

You would like to add an expandable spacer to the layout:

button_layout = new QVBoxLayout; Button_layout - & gt; (0) setSpacing; Button_layout - & gt; SetContentsMargins (0,0,0,0); Button_layout - & gt; AddStretch (); Button_layout - & gt; AddWidget (button_1); Button_layout - & gt; AddWidget (button_2); Button_layout - & gt; AddWidget (button_3);

This button is always due to being at the bottom of the widget, note that the horizontal section will still spread if your widget has expanded in this way; To fix this, you'll need to either either wrap it in another (hbbox) layout or switch to grid layout.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -