Search code examples
qtdynamically-generatedqlineedit

Event textChanged on dynamically created QLineEdit


I have some code in on_pushButton_clicked() that creates another QLineEdit, and I would like to ask you how can I access the on_lineEdit_textChanged() event of that new QLineEdit.


Solution

  • You should use connect method like this:

    QLineEdit* le= new QLineEdit(this);
    ....add to layout.....
    connect(le, SIGNAL(textChanged(const QString &)), this, SLOT(on_lineEdit_textChanged(const QString &)));