Nov-18-2022, 07:54 PM
I have a QGridLayout with some QLabels and QLineEdits and a QProgressBar. As the progress bar fills, the QLineEdits shrink. What's up with that. Code:
Well, I posted prior to any real attempt to solve this problem on my own. I fixed it with a different approach. By using a VBoxLayout as my main layout, and then nesting HBoxLayout's with the necessary widgets, the problem is gone.
If anyone has any idea about the grid issue, I'd like to hear a solution or potential solution.
wnd_grid, wnd_edit = QGridLayout(), QTextEdit() prog = QProgressBar header = ['To:', 'CC:', 'BCC:', 'Subject:'] edits = [QLineEdit(), QLineEdit(), QLineEdit(), QLineEdit()] for i, (lab, lin) in enumerate(zip(header, edits)): wnd_grid.addWidget(W.QLabel(lab), i, 0) wnd_grid.addWidget(lin, i, 1, 1, 5) wnd_grid.addWidget(wnd_edit, 4, 0, 1, 6) wnd_grid.addWidget(prog, 5, 1)Standard stuff. I just don't know why growing progress shrinks a column space? These widgets are set in a QMainWindow with a frame as the central widget, then the GridLayout's parent is the frame. Obviously, the QMainWindow has a layout by default, so I can't add a second. It has a central widget, but can I set another widget (like a frame), and then set another layout to house the progressbar. I'm just thinking separating the PB from the layout with Line Edits. Is there something else I can do?
Well, I posted prior to any real attempt to solve this problem on my own. I fixed it with a different approach. By using a VBoxLayout as my main layout, and then nesting HBoxLayout's with the necessary widgets, the problem is gone.
If anyone has any idea about the grid issue, I'd like to hear a solution or potential solution.