Textboxes change size when layout added in Qt5 Designer
-
I wrote an app using Qt5 Designer without layouts. It works fine, but resizing the screen does not reposition and resize the individual widgets. They stay in the upper left corner. I would like them to resize.
I understand that I will need to use nested layouts to get the look that I want.
My problem is with textboxes in layouts:
I have a line of 5 labels. I can select them and add a horizontal layout to them and it does what I expect. I get 5 columns, each with a label of close to the same size as the originals.
I have a row containing buttons, labels and a date selector. If I select them and apply a horizontal layout it also does what I would expect. I will need to add a spacer, or two, to get exactly what I want, but that is easy to do.
I have ten rows of five textboxes each. If I select a row of textboxes and apply a horizontal layout, all of the textboxes change size to 256 x 192 (they were 60 x 26 before applying the layout). The same thing happens if I select a column of textboxes and apply a vertical layout, or if I select all of the textboxes and apply a grid layout.
What do I need to do, either to the textboxes before I apply the layout, or to the layout after application, to get the textboxes to keep their original size (like every other control seems to) and yet resize when the program is running and I resize the window?
-
I was using a QPlainTextEdit. I had not noticed that there were several different type of controls for inputting text. QTextEdit does the same thing for me as QplainTextEdit. QLineEdit, however, does not change size on me. It also looks like it may be closer to what I actually need. I will change all of the QPlainTextEdit widgets to QLineEdit and see how that works.
@Shap
QPlainTextEdit
will (should) behave the same asQTextEdit
so far as sizing is concerned. They are both for multiline input, and can grow vertically.QLineEdit
is for single-line input, and would not grow vertically. Same as the other widgets you talked about. -
I wrote an app using Qt5 Designer without layouts. It works fine, but resizing the screen does not reposition and resize the individual widgets. They stay in the upper left corner. I would like them to resize.
I understand that I will need to use nested layouts to get the look that I want.
My problem is with textboxes in layouts:
I have a line of 5 labels. I can select them and add a horizontal layout to them and it does what I expect. I get 5 columns, each with a label of close to the same size as the originals.
I have a row containing buttons, labels and a date selector. If I select them and apply a horizontal layout it also does what I would expect. I will need to add a spacer, or two, to get exactly what I want, but that is easy to do.
I have ten rows of five textboxes each. If I select a row of textboxes and apply a horizontal layout, all of the textboxes change size to 256 x 192 (they were 60 x 26 before applying the layout). The same thing happens if I select a column of textboxes and apply a vertical layout, or if I select all of the textboxes and apply a grid layout.
What do I need to do, either to the textboxes before I apply the layout, or to the layout after application, to get the textboxes to keep their original size (like every other control seems to) and yet resize when the program is running and I resize the window?
@Shap said in Textboxes change size when layout added in Qt5 Designer:
What do I need to do
Add a spacer to the right and at the bottom of the layout with these text boxes
-
I wrote an app using Qt5 Designer without layouts. It works fine, but resizing the screen does not reposition and resize the individual widgets. They stay in the upper left corner. I would like them to resize.
I understand that I will need to use nested layouts to get the look that I want.
My problem is with textboxes in layouts:
I have a line of 5 labels. I can select them and add a horizontal layout to them and it does what I expect. I get 5 columns, each with a label of close to the same size as the originals.
I have a row containing buttons, labels and a date selector. If I select them and apply a horizontal layout it also does what I would expect. I will need to add a spacer, or two, to get exactly what I want, but that is easy to do.
I have ten rows of five textboxes each. If I select a row of textboxes and apply a horizontal layout, all of the textboxes change size to 256 x 192 (they were 60 x 26 before applying the layout). The same thing happens if I select a column of textboxes and apply a vertical layout, or if I select all of the textboxes and apply a grid layout.
What do I need to do, either to the textboxes before I apply the layout, or to the layout after application, to get the textboxes to keep their original size (like every other control seems to) and yet resize when the program is running and I resize the window?
@Shap said in Textboxes change size when layout added in Qt5 Designer:
I have ten rows of five textboxes each
what do you mean by text box?....Text edit or Text Browser. It may not matter but, I want to replicate this issue in my PC and check.
And can you post any screenshots of this issue, so that we can get more clarity?
-
I was using a QPlainTextEdit. I had not noticed that there were several different type of controls for inputting text. QTextEdit does the same thing for me as QplainTextEdit. QLineEdit, however, does not change size on me. It also looks like it may be closer to what I actually need. I will change all of the QPlainTextEdit widgets to QLineEdit and see how that works.
-
I was using a QPlainTextEdit. I had not noticed that there were several different type of controls for inputting text. QTextEdit does the same thing for me as QplainTextEdit. QLineEdit, however, does not change size on me. It also looks like it may be closer to what I actually need. I will change all of the QPlainTextEdit widgets to QLineEdit and see how that works.
@Shap
QPlainTextEdit
will (should) behave the same asQTextEdit
so far as sizing is concerned. They are both for multiline input, and can grow vertically.QLineEdit
is for single-line input, and would not grow vertically. Same as the other widgets you talked about. -
-