Alex22
2nd December 2015, 08:26
Hi
I have 100 Check-boxes (objects of QCheckBox) and 100 Line-edits (objects of QLineEdit) like this:
QCheckBox chb[100];
QLineEdit lndt[100];
now I want to connect chb[0] to lndt[0] and chb[1] to lndt[1] and chb[2] to lndt[2] ,... and chb[99] to lndt[99]
One way is to write 100 times connects like:
QObject::connect(chb, SIGNAL(textChanged(QString)), lndt, SLOT(setText(QString)));
QObject::connect(chb+1, SIGNAL(textChanged(QString)), lndt+1, SLOT(setText(QString)));
QObject::connect(chb+2, SIGNAL(textChanged(QString)), lndt+2, SLOT(setText(QString)));
.
.
.
QObject::connect(chb+99, SIGNAL(textChanged(QString)), lndt+99, SLOT(setText(QString)));
Is there any other idea for using a for loop to do this.
Thanks a lot for any help
I have 100 Check-boxes (objects of QCheckBox) and 100 Line-edits (objects of QLineEdit) like this:
QCheckBox chb[100];
QLineEdit lndt[100];
now I want to connect chb[0] to lndt[0] and chb[1] to lndt[1] and chb[2] to lndt[2] ,... and chb[99] to lndt[99]
One way is to write 100 times connects like:
QObject::connect(chb, SIGNAL(textChanged(QString)), lndt, SLOT(setText(QString)));
QObject::connect(chb+1, SIGNAL(textChanged(QString)), lndt+1, SLOT(setText(QString)));
QObject::connect(chb+2, SIGNAL(textChanged(QString)), lndt+2, SLOT(setText(QString)));
.
.
.
QObject::connect(chb+99, SIGNAL(textChanged(QString)), lndt+99, SLOT(setText(QString)));
Is there any other idea for using a for loop to do this.
Thanks a lot for any help