Friday, 15 July 2011

layout - Qt layouting: default size constraints vertically, setFixedSize horizontally -


I am developing a complex hierarchy of an app widgets and layouts, but in essence that there is a formula One formula is in the form of the upper widget and in the form of QScrollArea tabular widget (via QVBoxLayout ).

That can be QScrollArea represents a catalog (grid layout actually) QPushButton too many buttons s (or not).

I want my app to fit the following issues:

  • (both form and list) consume horizontal space all available, (the horizontal position and < Code> SpaceItem s) to refine its contents to fill the content margin.
  • Both will save as vertical space as possible, "lines" closer to each other.

I have resolved to use part of my problem setSizeConstraint (QLayout :: SetFixedSize) to form, which raises it, But also horizontally, due to which both the list and the form are different width, which does not look very well.

How can I get it? I mean, how something like might have to be incremented horizontally to fill the widget but should be standing as much as possible ?

Add a spacer as the last item in the layout:

  gridLayout-> addItem (new QSpacerItem (10, 10, QSizePolicy :: expanding, QSizePolicy :: detail), the last, 0);  

No comments:

Post a Comment