Python Forum
[PyQt] QGridLayout, QProgressBar bar fills widgets shrink
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] QGridLayout, QProgressBar bar fills widgets shrink
#1
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:
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.
Reply


Messages In This Thread
QGridLayout, QProgressBar bar fills widgets shrink - by malonn - Nov-18-2022, 07:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyQt] QGridLayout and stretching widgets when maximized malonn 1 2,098 Oct-05-2022, 09:58 AM
Last Post: malonn

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020