how to find child widget from parent.
hi to all, I've centos7.5 and Qt 5.7 in VM. I am trying to get child (lineEdit) from parent. I tried like this :-
Code:
void dialogAddNewRecord
::insert_intoDB(QString *name, qint32
*stock, qint32
*rate, qint32
*number
) {
logindlg = new dialogLogin(this);
QLineEdit *uname_l
= logindlg
->findChild<QLineEdit
*>
("lineEditUserNameLoginForm");
QString uname
= uname_l
->text
().
trimmed();
qDebug() << "uname = " << uname;
qDebug() << uname_l;
}
this shows following output:-
Code:
uname = ""
QLineEdit(0x1c323e0, name
="lineEditUserNameLoginForm")
how to get child lineEdit in form.
Re: how to find child widget from parent.
But what's the problem? You found what you were looking for. Maybe the problem is that you are creating a new instance of the dialogue in line 3.