Here is a possibility:
#include "dialog.h"
#include "ui_dialog.h"
: QDialog(parent
), ui
(new Ui
::DialogClass) {
ui->setupUi(this);
array[0] = ui->l1;
array[1] = ui->l2;
array[2] = ui->l3;
for(int i = 0; i < 3 ; i++)
array[i]->setText("yess!");
}
Dialog::~Dialog()
{
delete ui;
}
#include "dialog.h"
#include "ui_dialog.h"
Dialog::Dialog(QWidget *parent)
: QDialog(parent), ui(new Ui::DialogClass)
{
ui->setupUi(this);
QLineEdit *array[3];
array[0] = ui->l1;
array[1] = ui->l2;
array[2] = ui->l3;
for(int i = 0; i < 3 ; i++)
array[i]->setText("yess!");
}
Dialog::~Dialog()
{
delete ui;
}
To copy to clipboard, switch view to plain text mode
l1, l2 and l3 are QLineEdit objects created using Designer.
array[0], array[1] and array[2] are the "clones"
Bookmarks