0
我遇到了一個我無法解決的問題。我有一個父(在QTDesigner中添加)和子(由代碼添加)佈局。我想補充QLineEdit的和Qlabel小部件子佈局,然後我這個佈局添加到父之一:在另一個裏面的佈局中訪問lineEdit
lbl = new QLabel(this);
currentResistorText += tr("Resistor") + tr("#") + QString::number(resistorCounter);
lbl->setText(currentResistorText);
newResistorLayout = new QHBoxLayout();
lineEdit = new QLineEdit(this);
newResistorLayout->addWidget(lbl);
ui->resistorsLayout->addRow(newResistorLayout);
我怎樣才能得到newResistorLayout內部訪問lineEdit元素?
我正在使用Qt 5.8。
感謝您的幫助。它是這樣的:QList widgets = ui-> centralwidget-> findChildren (); –
Vladimir