I need help inserting a button inside in a QLineEdit
that can call a function.
For example, like this google image:
In qt C++, I can drag and drop pushButton
in the left of LineEdit
. After that, I just need to set styleSheet
for LineEdit
with this code:
int FramWidth = lineEdit->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
lineEdit->setStyleSheet(QString("QLineEdit{padding-right: %1px; }").arg(ui->pushButton->sizeHint().width() + FramWidth +5));
And it works for me. Hope it can help.