Search code examples
qlineedit

QLineEdit: Change clearButton


When I set clearButtonEnabled= true, clearButton looks blurry. Is there any way to change the size of clearButton or to customize it with another icon?


Solution

  • For anyone interested, I found this workaround:

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