使用setObjectName给对象命名便于通过findChild查找this下的字对象,拿到子对象后可对其进行操作.
QLineEdit * aa = new QLineEdit(this);
aa->setObjectName("bb");
QLineEdit * cc = this->findChild<QLineEdit *>("bb");
cc->setText("你好啊");
cc->show();
使用setObjectName给对象命名便于通过findChild查找this下的字对象,拿到子对象后可对其进行操作.
QLineEdit * aa = new QLineEdit(this);
aa->setObjectName("bb");
QLineEdit * cc = this->findChild<QLineEdit *>("bb");
cc->setText("你好啊");
cc->show();