Qt 如何设置影响按钮大小的QPushButton样式表?

Qt 如何设置影响按钮大小的QPushButton样式表?,qt,stylesheet,qpushbutton,qtstylesheets,Qt,Stylesheet,Qpushbutton,Qtstylesheets,当我使用以下样式表创建QApplication::setStyleSheet()时 QPushButton { border-radius: 2px; padding: 0.2em 0.2em 0.3em 0.2em; border: 1px solid rgb(100, 100, 100); background: qlineargradient(x1:0, y1:0, x2:0, y2:1,

当我使用以下样式表创建QApplication::setStyleSheet()时

QPushButton {
    border-radius: 2px;
    padding: 0.2em 0.2em 0.3em 0.2em;
    border: 1px solid rgb(100, 100, 100);
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                                  stop:0 #f4f4f4, stop:0.1 #8F8F8F, stop:1  #7B7B7B);
    color: white;
}

所有按钮的大小都被截断为文本的大小。例如,OK按钮变为正方形。效果与我在QPushButton上尝试的任何其他样式表相同。如何在不影响按钮默认大小的情况下设置按钮样式表?

我认为在不影响小部件默认大小的情况下,您无法处理边框或填充。不过你可以设定

从文档:
如果未指定此属性,则根据小部件的内容和样式导出最小宽度。

QPushButton {
    border-radius: 2px;
    padding: 0.2em 0.2em 0.3em 0.2em;
    border: 1px solid rgb(100, 100, 100);
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                                  stop:0 #f4f4f4, stop:0.1 #8F8F8F, stop:1  #7B7B7B);
    color: white;
    min-width: 70px;
}