Widget::Widget(QWidget *parent) : QWidget(parent) { QLineEdit *edit = new QLineEdit(this); connect(edit, SIGNAL(returnPressed()), this, SLOT(slotEditClicked())); } void Widget::slotEditClicked() { QLineEdit* button = (QLineEdit*)sender(); qDebug() << button->text(); }