Ignore minimum size when resizing QWidget

自闭症网瘾萝莉.ら 提交于 2019-12-02 08:22:48

You can use:

button.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)

but you'll have to set the initial size yourself.
Or you can just set the minimum size to a small non-zero value:

button.setMinimumSize(1,1)

To apply that to all buttons within a widget, you could try to use a style sheet, but the borders don't disappear when the button is at its minimum content size (at least with QGtkStyle on Linux):

dialog.setStyleSheet("QPushButton { min-height: 0px; min-width: 0px }");
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!