Using for loop to add widget to Layout
#include <QtGui>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidgetw;
QHBoxLayout lay(&w);
QTextEdit *txtEdit = 0;
for (intstretch = 1;stretch <= 5; stretch++) {
txtEdit = new QTextEdit(&w);
lay.addWidget(txtEdit, stretch);
}
w.show();
return a.exec();
}
Related examples in the same category