Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

how to call or change the text of a lineEdit which locates in another cpp



  • Hi all,
    how can i reach the lineEdit which locates in another cpp?

    ui->roomnolineEdit->setText(qry.value(0).toString()); what i know all is not like this...


  • Lifetime Qt Champion

    Hi,

    Have a look at the signals and slots chapter of Qt's documentation. Basically, your widget handling the query should emit a signal containing that string value, and in your other widget, you implement a slot that will call ui->roomnolineEdit->setText(). Doing so also allows you to avoid tight coupling between your widgets.

    Hope it helps


Log in to reply