I don't see how putting the widgets inside a QGraphicsScene should make a difference here.
Keep a pointer to the QLineEdit "l" in your class, e.g. as QLineEdit* m_lineEdit.
connect b, SIGNAL(clicked()) to a slot buttonClicked().
Implement buttonClicked like this:
void MyWidget::buttonClicked() { const QString text = m_lineEdit->text(); //do something with "text" }