C++/Qt/QHBoxLayout
Using for loop to add widget to Layout
<source lang="cpp">
- 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();
}
</source>