问题描述
我在 Qt 5.12 中工作。我应该在一个表单中创建一个 qlineedit 形状,如下所示:
但是我不能为它写样式表。
解决方法
我想我做到了:
我将 QLineEdit 放入 QGroupBox,并为 QGroupBox 设置布局。并将水平和垂直策略设置为 QLineEdit 的首选。我的样式表:
QLineEdit{
border: none;
font: 10pt "Segoe UI";
}
QGroupBox {
border: 1px solid #C4C4C4;;
border-radius: 20px;
margin-top: 10px
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top left; /* position at the top left */
color: #C4C4C4;
left: 15px;
}