QToolButton* btn = new QToolButton;
btn->setText("...");
btn->setCursor(Qt::ArrowCursor);
QWidgetAction* action = new QWidgetAction(ui.lineEdit);
action->setDefaultWidget(btn);
ui.lineEdit->addAction(action, QLineEdit::TrailingPosition);
connect(btn, &QToolButton::clicked, this, [this]() {
// do some thing
});