Window 使用 sizeHint 调整大小,但希望它在之后仍可由用户调整
Window sized using sizeHint, but woud like it to still be adjustable by the user after
我正在使用 Python 和 PySide 创建一个具有动态小部件数量的 GUI。我现在正在使用 sizeHint 来计算 window 的大小。它工作得很好,但是 window 在生成时是固定大小的。我希望用户能够在 sizeHint 进行初始计算后根据具体情况调整 GUI window。谢谢
#window.setMinimumWidth(1125)
#window.setFixedWidth(740)
#window.setMinimumHeight(800)
#window.setFixedHeight(200)
window.setFixedSize(grid_layout.sizeHint())
window.setFixedWidth(3500)
window.setAttribute(QtCore.Qt.WA_DeleteOnClose)
window.show()
不设置固定尺寸,只在show()
之后设置几何
window.show()
height = grid_layout.sizeHint().height()
width = 3500
geometry = QtCore.QRect(window.pos(), QtCore.QSize(width, height))
window.setGeometry(geometry)
我正在使用 Python 和 PySide 创建一个具有动态小部件数量的 GUI。我现在正在使用 sizeHint 来计算 window 的大小。它工作得很好,但是 window 在生成时是固定大小的。我希望用户能够在 sizeHint 进行初始计算后根据具体情况调整 GUI window。谢谢
#window.setMinimumWidth(1125)
#window.setFixedWidth(740)
#window.setMinimumHeight(800)
#window.setFixedHeight(200)
window.setFixedSize(grid_layout.sizeHint())
window.setFixedWidth(3500)
window.setAttribute(QtCore.Qt.WA_DeleteOnClose)
window.show()
不设置固定尺寸,只在show()
window.show()
height = grid_layout.sizeHint().height()
width = 3500
geometry = QtCore.QRect(window.pos(), QtCore.QSize(width, height))
window.setGeometry(geometry)