Ask Your Question

When the size of QFormLayout is changed, the rows are colliding with each other.

asked 2022-03-31 11:00:00 +0000

woof gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-04-02 00:00:00 +0000

bukephalos gravatar image

This issue could be caused by incorrect settings of the size policies or stretch factors of the widgets within the QFormLayout. To solve this, you can try adjusting the following:

  1. set the horizontal stretch factor of the labels to 1 and the fields to 2 or more to allow the fields to take up more horizontal space
  2. set the vertical size policy of the labels and fields to "MinimumExpanding" so they will adjust their size based on available space
  3. use QSizePolicy::Expanding for the size policy of the QFormLayout to allow it to expand and shrink according to the size of its parent widget
  4. adjust the margins of the QFormLayout to give more space between the rows.

You may need to experiment with these settings to find the optimal values for your layout.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer

Question Tools


Asked: 2022-03-31 11:00:00 +0000

Seen: 14 times

Last updated: Apr 02 '22