QAction *searchAction = new QAction(ui->lineEdit); searchAction->setIcon(QIcon(":/image/user.png"));
ui->lineEdit->addAction(searchAction,QLineEdit::LeadingPosition );//编辑框左侧 //QLineEdit::TrailingPosition 在右侧 备注:不知道原理,但是亲测可行