Uga*_*uga 4 qt stylesheet qtstylesheets qpushbutton
当我 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;
}
Run Code Online (Sandbox Code Playgroud)
所有按钮的大小都被截断为文本的大小。例如,OK 按钮变成方形。效果与我在 QPushButton 上尝试的任何其他样式表相同。如何设置按钮样式表而不影响其默认大小?
我不认为你可以在不影响小部件的默认大小的情况下弄乱边框或填充。min-width不过可以设置。
从文档: If this property is not specified, the minimum width is derived based on the widget's contents and the style.
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;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8812 次 |
| 最近记录: |