QLineEdit:更改clearButton

时间:2017-10-11 15:28:18

标签: qlineedit

当我设置clearButtonEnabled = true时,clearButton看起来很模糊。有没有办法改变clearButton的大小或用另一个图标自定义它?

1 个答案:

答案 0 :(得分:1)

对于任何有兴趣的人,我发现了这个解决方法:

QHBoxLayout *pSearchLayout = new QHBoxLayout();
pSearchLayout->addStretch();
pSearchLayout->addWidget(ui->pushButton);
pSearchLayout->setSpacing(0);
pSearchLayout->setContentsMargins(0, 0, 0, 0);
ui->lineEditSearch->setLayout(pSearchLayout);