I guess you are trying to do this.
#include <QApplication>
#include <QDialog>
#include <QLineEdit>
#include <QVBoxLayout>
#include <QList>
int main(int argc, char *argv[])
{
QList<QLineEdit *> qle_list;
for(int i = 0; i < 10; ++i)
{
qle_list.
at(i
)->setObjectName
(QString("lineEdit%1").
arg(i
));
// It's easier to recognize an object by name vLayout->addWidget(qle_list.at(i));
}
w.setLayout(vLayout);
w.show();
return a.exec();
}
#include <QApplication>
#include <QDialog>
#include <QLineEdit>
#include <QVBoxLayout>
#include <QList>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QDialog w;
QVBoxLayout * vLayout = new QVBoxLayout(&w);
QList<QLineEdit *> qle_list;
for(int i = 0; i < 10; ++i)
{
qle_list.append(new QLineEdit());
qle_list.at(i)->setObjectName(QString("lineEdit%1").arg(i)); // It's easier to recognize an object by name
vLayout->addWidget(qle_list.at(i));
}
w.setLayout(vLayout);
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
For example, you can get the object name by
for-loop: qle_list.at(i)->objectName();
for-loop: qle_list.at(i)->objectName();
To copy to clipboard, switch view to plain text mode
Bookmarks