QLineEdit本身自带returnPressed()信号,可以自己写一个槽函数,便实现了每次按enter键时可以获取lineEdit编辑器中的文本。
代码:

connect(ui.stabuyEdit, SIGNAL(returnPressed()), this, SLOT(savestabuyEditinfo()));//连接信号与槽
QString s;
void HomePage::savestabuyEditinfo()    
{
    s=ui.stabuyEdit->text();
}

相关文章:

  • 2022-02-09
  • 2022-12-23
  • 2021-10-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-04
  • 2022-12-23
猜你喜欢
  • 2021-11-02
  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
  • 2022-12-23
  • 2021-09-23
相关资源
相似解决方案