Unsolved QLineEdits and QPushButtons don't maintain their sizes
-
Hi,
I designed a form using the designer, it has many lineedits and several buttons. When the program starts everything looks fine until I click the maximize button, every widget shrinks vertically. I thought it was cause because I have small monitor.
When I tried to run on a much larger monitor, I still get the same behavior even there is plenty of white space all around. The lineedits and pushbutton are inside a girdlayout. How can I fix it?
-
Hi,
Did you add a spacer item at the bottom of your grid ? Or a stretch ? What exact result would you like ?
-
I only added horizontal spacer. I just want the form to display the lineedits and pushbuttons big enough for text to display completely and not be partially visible where part to the text from top and bottom is cut off and sometimes it's difficult to read the text on the pushbuttons.
Everything looks perfect in the designer.
I want to add that the layout which contains the lineedits and pushbuttons is inside a widget.
-
Do you have labels + controls on your grid ?
If so, you should rather consider using QFormLayout
-
There are labels. What do you mean by controls?
Is there any other way around this? The only reason I used a gridlayout instead of formlayout is some of the input I need require multiple columns and formlayout allows for a label and lineedit in each row.
-
By control I mean widgets (custom or not)
That's not true, QFormLayout allows complex widgets and layouts (see the addRow overloads. It just happens that the classic use case involves a QLineEdit.
-
Check the preview function of the FormDesigner. I here all ok ?
What happens if you resize the running windows a little bit with the mouse - not maximize ?
Have you code behind the button click, what makes something with widgets ?